diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 457a05f07d5306..51450f918bd1b8 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -16,6 +16,7 @@ Last update: - resources: https://github.com/web-platform-tests/wpt/tree/679a364421/resources - interfaces: https://github.com/web-platform-tests/wpt/tree/712c9f275e/interfaces - html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/0c3bed38df/html/webappapis/microtask-queuing +- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/ddfe9c089b/html/webappapis/timers [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 diff --git a/test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html b/test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html new file mode 100644 index 00000000000000..77a8746908d742 --- /dev/null +++ b/test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html @@ -0,0 +1,23 @@ + +Interaction of setTimeout and WebIDL + + + + + + +
+ diff --git a/test/fixtures/wpt/html/webappapis/timers/missing-timeout-setinterval.any.js b/test/fixtures/wpt/html/webappapis/timers/missing-timeout-setinterval.any.js new file mode 100644 index 00000000000000..33a1cc073c8c1f --- /dev/null +++ b/test/fixtures/wpt/html/webappapis/timers/missing-timeout-setinterval.any.js @@ -0,0 +1,34 @@ +function timeout_trampoline(t, timeout, message) { + t.step_timeout(function() { + // Yield in case we managed to be called before the second interval callback. + t.step_timeout(function() { + assert_unreached(message); + }, timeout); + }, timeout); +} + +async_test(function(t) { + let ctr = 0; + let h = setInterval(t.step_func(function() { + if (++ctr == 2) { + clearInterval(h); + t.done(); + return; + } + }) /* no interval */); + + timeout_trampoline(t, 100, "Expected setInterval callback to be called two times"); +}, "Calling setInterval with no interval should be the same as if called with 0 interval"); + +async_test(function(t) { + let ctr = 0; + let h = setInterval(t.step_func(function() { + if (++ctr == 2) { + clearInterval(h); + t.done(); + return; + } + }), undefined); + + timeout_trampoline(t, 100, "Expected setInterval callback to be called two times"); +}, "Calling setInterval with undefined interval should be the same as if called with 0 interval"); diff --git a/test/fixtures/wpt/html/webappapis/timers/negative-setinterval.html b/test/fixtures/wpt/html/webappapis/timers/negative-setinterval.html new file mode 100644 index 00000000000000..430d13c58aab69 --- /dev/null +++ b/test/fixtures/wpt/html/webappapis/timers/negative-setinterval.html @@ -0,0 +1,17 @@ + +Negative timeout in setInterval + + + diff --git a/test/fixtures/wpt/html/webappapis/timers/negative-settimeout.html b/test/fixtures/wpt/html/webappapis/timers/negative-settimeout.html new file mode 100644 index 00000000000000..57e88ee701d807 --- /dev/null +++ b/test/fixtures/wpt/html/webappapis/timers/negative-settimeout.html @@ -0,0 +1,8 @@ + +Negative timeout in setTimeout + + + diff --git a/test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.html b/test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.html new file mode 100644 index 00000000000000..af029959984668 --- /dev/null +++ b/test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.html @@ -0,0 +1,13 @@ + +Type long timeout for setInterval + + + diff --git a/test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.html b/test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.html new file mode 100644 index 00000000000000..31fa4f1264211e --- /dev/null +++ b/test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.html @@ -0,0 +1,8 @@ + +Type long timeout for setTimeout + + + diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index 4ca402a3491d4c..7bd65d90237370 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -22,5 +22,9 @@ "html/webappapis/microtask-queuing": { "commit": "0c3bed38df6d9dcd1441873728fb5c1bb59c92df", "path": "html/webappapis/microtask-queuing" + }, + "html/webappapis/timers": { + "commit": "ddfe9c089bab565a9d3aa37bdef63d8012c1a94c", + "path": "html/webappapis/timers" } } \ No newline at end of file