Skip to content

Commit

Permalink
test: update all Web Platform Tests
Browse files Browse the repository at this point in the history
PR-URL: #37467
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
targos authored and danielleadams committed Mar 16, 2021
1 parent c09bd77 commit a44daff
Show file tree
Hide file tree
Showing 26 changed files with 1,575 additions and 281 deletions.
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
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
934 changes: 934 additions & 0 deletions test/fixtures/wpt/common/third_party/reftest-analyzer.xhtml

Large diffs are not rendered by default.

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)
}
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.");
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);
97 changes: 45 additions & 52 deletions test/fixtures/wpt/interfaces/html.idl
Original file line number Diff line number Diff line change
Expand Up @@ -1397,11 +1397,11 @@ interface mixin CanvasDrawImage {

interface mixin CanvasImageData {
// pixel manipulation
ImageData createImageData(long sw, long sh);
ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh);
ImageData createImageData(ImageData imagedata);
ImageData getImageData(long sx, long sy, long sw, long sh);
undefined putImageData(ImageData imagedata, long dx, long dy);
undefined putImageData(ImageData imagedata, long dx, long dy, long dirtyX, long dirtyY, long dirtyWidth, long dirtyHeight);
ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh);
undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy);
undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight);
};

enum CanvasLineCap { "butt", "round", "square" };
Expand Down Expand Up @@ -1440,8 +1440,8 @@ interface mixin CanvasPath {
undefined bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y);
undefined arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius);
undefined rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
undefined arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
undefined arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean counterclockwise = false);
undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean counterclockwise = false);
};

[Exposed=(Window,Worker)]
Expand Down Expand Up @@ -2027,48 +2027,6 @@ interface mixin NavigatorCookies {
readonly attribute boolean cookieEnabled;
};

interface mixin NavigatorPlugins {
[SameObject] readonly attribute PluginArray plugins;
[SameObject] readonly attribute MimeTypeArray mimeTypes;
boolean javaEnabled();
};

[Exposed=Window,
LegacyUnenumerableNamedProperties]
interface PluginArray {
undefined refresh(optional boolean reload = false);
readonly attribute unsigned long length;
getter Plugin? item(unsigned long index);
getter Plugin? namedItem(DOMString name);
};

[Exposed=Window,
LegacyUnenumerableNamedProperties]
interface MimeTypeArray {
readonly attribute unsigned long length;
getter MimeType? item(unsigned long index);
getter MimeType? namedItem(DOMString name);
};

[Exposed=Window,
LegacyUnenumerableNamedProperties]
interface Plugin {
readonly attribute DOMString name;
readonly attribute DOMString description;
readonly attribute DOMString filename;
readonly attribute unsigned long length;
getter MimeType? item(unsigned long index);
getter MimeType? namedItem(DOMString name);
};

[Exposed=Window]
interface MimeType {
readonly attribute DOMString type;
readonly attribute DOMString description;
readonly attribute DOMString suffixes; // comma-separated
readonly attribute Plugin enabledPlugin;
};

[Exposed=(Window,Worker), Serializable, Transferable]
interface ImageBitmap {
readonly attribute unsigned long width;
Expand Down Expand Up @@ -2396,10 +2354,6 @@ interface HTMLMarqueeElement : HTMLElement {
[CEReactions] attribute unsigned long vspace;
[CEReactions] attribute DOMString width;

attribute EventHandler onbounce;
attribute EventHandler onfinish;
attribute EventHandler onstart;

undefined start();
undefined stop();
};
Expand Down Expand Up @@ -2678,3 +2632,42 @@ interface External {
undefined AddSearchProvider();
undefined IsSearchProviderInstalled();
};

interface mixin NavigatorPlugins {
[SameObject] readonly attribute PluginArray plugins;
[SameObject] readonly attribute MimeTypeArray mimeTypes;
boolean javaEnabled();
};

[Exposed=Window]
interface PluginArray {
undefined refresh();
readonly attribute unsigned long length;
getter object? item(unsigned long index);
object? namedItem(DOMString name);
};

[Exposed=Window]
interface MimeTypeArray {
readonly attribute unsigned long length;
getter object? item(unsigned long index);
object? namedItem(DOMString name);
};

[Exposed=Window]
interface Plugin {
readonly attribute undefined name;
readonly attribute undefined description;
readonly attribute undefined filename;
readonly attribute undefined length;
getter undefined item(unsigned long index);
undefined namedItem(DOMString name);
};

[Exposed=Window]
interface MimeType {
readonly attribute undefined type;
readonly attribute undefined description;
readonly attribute undefined suffixes;
readonly attribute undefined enabledPlugin;
};
18 changes: 16 additions & 2 deletions test/fixtures/wpt/resources/idlharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -3483,6 +3483,22 @@ IdlNamespace.prototype.test_self = function ()
subsetTestByKey(this.name, test, () => {
assert_equals(typeof namespaceObject, "object");
}, `${this.name} namespace: typeof is "object"`);

subsetTestByKey(this.name, test, () => {
assert_equals(
Object.getOwnPropertyDescriptor(namespaceObject, "length"),
undefined,
"length property must be undefined"
);
}, `${this.name} namespace: has no length property`);

subsetTestByKey(this.name, test, () => {
assert_equals(
Object.getOwnPropertyDescriptor(namespaceObject, "name"),
undefined,
"name property must be undefined"
);
}, `${this.name} namespace: has no name property`);
};

IdlNamespace.prototype.test = function ()
Expand Down Expand Up @@ -3527,8 +3543,6 @@ IdlNamespace.prototype.test = function ()
function idl_test(srcs, deps, idl_setup_func) {
return promise_test(function (t) {
var idl_array = new IdlArray();
srcs = (srcs instanceof Array) ? srcs : [srcs] || [];
deps = (deps instanceof Array) ? deps : [deps] || [];
var setup_error = null;
const validationIgnored = [
"constructor-member",
Expand Down
Loading

0 comments on commit a44daff

Please sign in to comment.