Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and update web platform tests #37467

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/common/wpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class StatusRuleSet {
if (key.includes('*')) {
this.patternMatch.push(new StatusRule(key, rules[key], key));
} else {
this.exactMatch[key] = new StatusRule(key, rules[key]);
const normalizedPath = path.normalize(key);
this.exactMatch[normalizedPath] = new StatusRule(key, rules[key]);
}
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ See [test/wpt](../../wpt/README.md) for information on how these tests are run.

Last update:

- common: https://github.com/web-platform-tests/wpt/tree/3586ff740b/common
- console: https://github.com/web-platform-tests/wpt/tree/3b1f72e99a/console
- encoding: https://github.com/web-platform-tests/wpt/tree/3c9820d1cc/encoding
- url: https://github.com/web-platform-tests/wpt/tree/1783c9bccf/url
- resources: https://github.com/web-platform-tests/wpt/tree/351a99782b/resources
- interfaces: https://github.com/web-platform-tests/wpt/tree/b4be9a3fdf/interfaces
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/264f12bc7b/html/webappapis/timers
- hr-time: https://github.com/web-platform-tests/wpt/tree/a5d1774ecf/hr-time
- common: https://github.com/web-platform-tests/wpt/tree/841a51412f/common
- dom/abort: https://github.com/web-platform-tests/wpt/tree/7caa3de747/dom/abort
- dom/abort: https://github.com/web-platform-tests/wpt/tree/625e1310ce/dom/abort
- encoding: https://github.com/web-platform-tests/wpt/tree/35f70910d3/encoding
- FileAPI: https://github.com/web-platform-tests/wpt/tree/3b279420d4/FileAPI
- hr-time: https://github.com/web-platform-tests/wpt/tree/9910784394/hr-time
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers
- interfaces: https://github.com/web-platform-tests/wpt/tree/8602e9c9a1/interfaces
- resources: https://github.com/web-platform-tests/wpt/tree/e366371a19/resources
- url: https://github.com/web-platform-tests/wpt/tree/59d28c8f2d/url

[Web Platform Tests]: https://github.com/web-platform-tests/wpt
[`git node wpt`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt
Binary file modified test/fixtures/wpt/common/square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
934 changes: 934 additions & 0 deletions test/fixtures/wpt/common/third_party/reftest-analyzer.xhtml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/fixtures/wpt/encoding/eof-shift_jis.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<meta charset=shift_jis>
<title>Shift_JIS file ending with a truncated sequence</title>
<link rel=match href=/encoding/eof-shift_jis-ref.html>
One-byte truncated sequence:�
One-byte truncated sequence:�
2 changes: 1 addition & 1 deletion test/fixtures/wpt/encoding/eof-utf-8-one.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<meta charset=utf-8>
<title>UTF-8 file ending with a one-byte truncated sequence</title>
<link rel=match href="eof-utf-8-one-ref.html">
One-byte truncated sequence:�
One-byte truncated sequence:�
2 changes: 1 addition & 1 deletion test/fixtures/wpt/encoding/eof-utf-8-three.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<meta charset=utf-8>
<title>UTF-8 file ending with a three-byte truncated sequence</title>
<link rel=match href="eof-utf-8-three-ref.html">
Three-byte truncated sequence:�
Three-byte truncated sequence:�
2 changes: 1 addition & 1 deletion test/fixtures/wpt/encoding/eof-utf-8-two.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<meta charset=utf-8>
<title>UTF-8 file ending with a two-byte truncated sequence</title>
<link rel=match href="eof-utf-8-two-ref.html">
Two-byte truncated sequence:�
Two-byte truncated sequence:�

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<meta charset="euc-jp">
<title>EUC-JP characters</title>
</head>
<body><span>�</span> <span>���</span> <span>���</span> <span>�</span> <span>���</span> <span>�</span> <span>���</span> <span>�1</span> <span>��</span> <span>��</span> <span>��</span> </body>
<body><span>�</span> <span>���</span> <span>���</span> <span>�</span> <span>���</span> <span>�</span> <span>���</span> <span>�1</span> <span>��</span> <span>��</span> <span>��</span> </body>
</html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<meta charset="shift_jis">
<title>Shift_JIS characters</title>
</head>
<body><span>�</span> <span>�n�</span> <span>���</span> <span>�</span> <span>�</span> <span>�</span> <span>���</span> <span>��</span> <span>��</span> <span>��</span> </body>
<body><span>�</span> <span>�n�</span> <span>���</span> <span>�</span> <span>�</span> <span>�</span> <span>���</span> <span>��</span> <span>��</span> <span>��</span> </body>
</html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<meta charset="euc-kr">
<title>EUC-KR characters</title>
</head>
<body><span>�</span> <span>���</span> <span>���</span> <span>�</span> <span>���</span> <span>�1</span> <span>��</span> <span>�[</span> </body>
<body><span>�</span> <span>���</span> <span>���</span> <span>�</span> <span>���</span> <span>�1</span> <span>��</span> <span>�[</span> </body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// META: script=./resources/ranges.js

const decode = (input, output, desc) => {
test(function () {
for (const encoding of ["gb18030", "gbk"]) {
assert_equals(
new TextDecoder(encoding).decode(new Uint8Array(input)),
output,
);
}
}, "gb18030 decoder: " + desc);
};

decode([115], "s", "ASCII");
decode([0x80], "\u20AC", "euro");
decode([0xFF], "\uFFFD", "initial byte out of accepted ranges");
decode([0x81], "\uFFFD", "end of queue, gb18030 first not 0");
decode([0x81, 0x28], "\ufffd(", "two bytes 0x81 0x28");
decode([0x81, 0x40], "\u4E02", "two bytes 0x81 0x40");
decode([0x81, 0x7E], "\u4E8A", "two bytes 0x81 0x7e");
decode([0x81, 0x7F], "\ufffd\u007f", "two bytes 0x81 0x7f");
decode([0x81, 0x80], "\u4E90", "two bytes 0x81 0x80");
decode([0x81, 0xFE], "\u4FA2", "two bytes 0x81 0xFE");
decode([0x81, 0xFF], "\ufffd", "two bytes 0x81 0xFF");
decode([0xFE, 0x40], "\uFA0C", "two bytes 0xFE 0x40");
decode([0xFE, 0xFE], "\uE4C5", "two bytes 0xFE 0xFE");
decode([0xFE, 0xFF], "\ufffd", "two bytes 0xFE 0xFF");
decode([0x81, 0x30], "\ufffd", "two bytes 0x81 0x30");
decode([0x81, 0x30, 0xFE], "\ufffd", "three bytes 0x81 0x30 0xFE");
decode([0x81, 0x30, 0xFF], "\ufffd0\ufffd", "three bytes 0x81 0x30 0xFF");
decode(
[0x81, 0x30, 0xFE, 0x29],
"\ufffd0\ufffd)",
"four bytes 0x81 0x30 0xFE 0x29",
);
decode([0xFE, 0x39, 0xFE, 0x39], "\ufffd", "four bytes 0xFE 0x39 0xFE 0x39");
decode([0x81, 0x35, 0xF4, 0x36], "\u1E3E", "pointer 7458");
decode([0x81, 0x35, 0xF4, 0x37], "\ue7c7", "pointer 7457");
decode([0x81, 0x35, 0xF4, 0x38], "\u1E40", "pointer 7459");
decode([0x84, 0x31, 0xA4, 0x39], "\uffff", "pointer 39419");
decode([0x84, 0x31, 0xA5, 0x30], "\ufffd", "pointer 39420");
decode([0x8F, 0x39, 0xFE, 0x39], "\ufffd", "pointer 189999");
decode([0x90, 0x30, 0x81, 0x30], "\u{10000}", "pointer 189000");
decode([0xE3, 0x32, 0x9A, 0x35], "\u{10FFFF}", "pointer 1237575");
decode([0xE3, 0x32, 0x9A, 0x36], "\ufffd", "pointer 1237576");
decode([0x83, 0x36, 0xC8, 0x30], "\uE7C8", "legacy ICU special case 1");
decode([0xA1, 0xAD], "\u2026", "legacy ICU special case 2");
decode([0xA1, 0xAB], "\uFF5E", "legacy ICU special case 3");

let i = 0;
for (const range of ranges) {
const pointer = range[0];
decode(
[
Math.floor(pointer / 12600) + 0x81,
Math.floor((pointer % 12600) / 1260) + 0x30,
Math.floor((pointer % 1260) / 10) + 0x81,
pointer % 10 + 0x30,
],
range[1],
"range " + i++,
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const gbkPointers = [
6432, 7533, 7536, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684,
23766, 23770, 23771, 23772, 23773, 23774, 23776, 23777, 23778, 23779, 23780, 23781, 23782, 23784, 23785, 23786,
23787, 23790, 23791, 23792, 23793, 23796, 23797, 23798, 23799, 23800, 23801, 23802, 23803, 23805, 23806, 23807,
23808, 23809, 23810, 23811, 23813, 23814, 23815, 23816, 23817, 23818, 23819, 23820, 23821, 23822, 23823, 23824,
23825, 23826, 23827, 23828, 23831, 23832, 23833, 23834, 23835, 23836, 23837, 23838, 23839, 23840, 23841, 23842,
23843, 23844
];
const codePoints = [
0x20ac, 0x1e3f, 0x01f9, 0x303e, 0x2ff0, 0x2ff1, 0x2ff2, 0x2ff3, 0x2ff4, 0x2ff5, 0x2ff6, 0x2ff7, 0x2ff8, 0x2ff9, 0x2ffa, 0x2ffb,
0x2e81, 0x2e84, 0x3473, 0x3447, 0x2e88, 0x2e8b, 0x359e, 0x361a, 0x360e, 0x2e8c, 0x2e97, 0x396e, 0x3918, 0x39cf, 0x39df, 0x3a73,
0x39d0, 0x3b4e, 0x3c6e, 0x3ce0, 0x2ea7, 0x2eaa, 0x4056, 0x415f, 0x2eae, 0x4337, 0x2eb3, 0x2eb6, 0x2eb7, 0x43b1, 0x43ac, 0x2ebb,
0x43dd, 0x44d6, 0x4661, 0x464c, 0x4723, 0x4729, 0x477c, 0x478d, 0x2eca, 0x4947, 0x497a, 0x497d, 0x4982, 0x4983, 0x4985, 0x4986,
0x499f, 0x499b, 0x49b7, 0x49b6, 0x4ca3, 0x4c9f, 0x4ca0, 0x4ca1, 0x4c77, 0x4ca2, 0x4d13, 0x4d14, 0x4d15, 0x4d16, 0x4d17, 0x4d18,
0x4d19, 0x4dae
];

for (let i = 0; i < gbkPointers.length; i++) {
const pointer = gbkPointers[i];
test(function() {
const lead = pointer / 190 + 0x81;
const trail = pointer % 190;
const offset = trail < 0x3F ? 0x40 : 0x41;
const encoded = [lead, trail + offset];
const decoded = new TextDecoder("GBK").decode(new Uint8Array(encoded)).charCodeAt(0);
assert_equals(decoded, codePoints[i]);
}, "gbk pointer: " + pointer)
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<meta charset="big5">
<title>Big5 characters</title>
</head>
<body><span>�</span> <span>���</span> <span>���</span> <span>�</span> <span>���</span> <span>�1</span> <span>��</span> <span>��</span> </body>
<body><span>�</span> <span>���</span> <span>���</span> <span>�</span> <span>���</span> <span>�1</span> <span>��</span> <span>��</span> </body>
</html>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
����
����
Original file line number Diff line number Diff line change
@@ -1 +1 @@
����
����
Binary file modified test/fixtures/wpt/encoding/resources/utf-32-big-endian-bom.html
Binary file not shown.
Binary file modified test/fixtures/wpt/encoding/resources/utf-32-big-endian-bom.xml
Binary file not shown.
Binary file not shown.
Binary file not shown.
49 changes: 49 additions & 0 deletions test/fixtures/wpt/encoding/textdecoder-arguments.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// META: title=Encoding API: TextDecoder decode() optional arguments

test(t => {
const decoder = new TextDecoder();

// Just passing nothing.
assert_equals(
decoder.decode(undefined), '',
'Undefined as first arg should decode to empty string');

// Flushing an incomplete sequence.
decoder.decode(new Uint8Array([0xc9]), {stream: true});
assert_equals(
decoder.decode(undefined), '\uFFFD',
'Undefined as first arg should flush the stream');

}, 'TextDecoder decode() with explicit undefined');

test(t => {
const decoder = new TextDecoder();

// Just passing nothing.
assert_equals(
decoder.decode(undefined, undefined), '',
'Undefined as first arg should decode to empty string');

// Flushing an incomplete sequence.
decoder.decode(new Uint8Array([0xc9]), {stream: true});
assert_equals(
decoder.decode(undefined, undefined), '\uFFFD',
'Undefined as first arg should flush the stream');

}, 'TextDecoder decode() with undefined and undefined');

test(t => {
const decoder = new TextDecoder();

// Just passing nothing.
assert_equals(
decoder.decode(undefined, {}), '',
'Undefined as first arg should decode to empty string');

// Flushing an incomplete sequence.
decoder.decode(new Uint8Array([0xc9]), {stream: true});
assert_equals(
decoder.decode(undefined, {}), '\uFFFD',
'Undefined as first arg should flush the stream');

}, 'TextDecoder decode() with undefined and options');
1 change: 1 addition & 0 deletions test/fixtures/wpt/encoding/textdecoder-labels.any.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// META: title=Encoding API: Encoding labels
// META: script=resources/encodings.js
// META: timeout=long

var whitespace = [' ', '\t', '\n', '\f', '\r'];
encodings_table.forEach(function(section) {
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/wpt/hr-time/basic.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ async_test(function() {
this.done();
}, 2000);
}, 'High resolution time has approximately the right relative magnitude');

test(function() {
var didHandle = false;
self.performance.addEventListener("testEvent", function() {
didHandle = true;
}, { once: true} );
self.performance.dispatchEvent(new Event("testEvent"));
assert_true(didHandle, "Performance extends EventTarget, so event dispatching should work.");
}, "Performance interface extends EventTarget.");
1 change: 1 addition & 0 deletions test/fixtures/wpt/hr-time/resources/unload.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ const setupListeners = (docName, nextDocument) => {
if (docName !== "c") { syncDelay(1000); }
});
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
setup({ single_test: true });
var i = 0;
var interval;
function next() {
i++;
if (i === 20) {
clearInterval(interval);
done();
}
}
setTimeout(assert_unreached, 1000);
interval = setInterval(next, -100);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
setup({ single_test: true });
setTimeout(done, -100);
setTimeout(assert_unreached, 10);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
setup({ single_test: true });
var interval;
function next() {
clearInterval(interval);
done();
}
interval = setInterval(next, Math.pow(2, 32));
setTimeout(assert_unreached, 100);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
setup({ single_test: true });
setTimeout(done, Math.pow(2, 32));
setTimeout(assert_unreached, 100);
Loading