diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 3f4c7dc79e134d..71755da8fc5a54 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -21,7 +21,6 @@ Last update: - html/webappapis/atob: https://github.com/web-platform-tests/wpt/tree/f267e1dca6/html/webappapis/atob - html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing - html/webappapis/structured-clone: https://github.com/web-platform-tests/wpt/tree/47d3fb280c/html/webappapis/structured-clone -- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers - interfaces: https://github.com/web-platform-tests/wpt/tree/df731dab88/interfaces - performance-timeline: https://github.com/web-platform-tests/wpt/tree/17ebc3aea0/performance-timeline - resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing diff --git a/test/fixtures/wpt/html/webappapis/timers/cleartimeout-clearinterval.any.js b/test/fixtures/wpt/html/webappapis/timers/cleartimeout-clearinterval.any.js deleted file mode 100644 index 44551aa8a1bb80..00000000000000 --- a/test/fixtures/wpt/html/webappapis/timers/cleartimeout-clearinterval.any.js +++ /dev/null @@ -1,29 +0,0 @@ -async_test((t) => { - const handle = setTimeout( - t.step_func(() => { - assert_unreached("Timeout was not canceled"); - }), - 0 - ); - - clearInterval(handle); - - setTimeout(() => { - t.done(); - }, 100); -}, "Clear timeout with clearInterval"); - -async_test((t) => { - const handle = setInterval( - t.step_func(() => { - assert_unreached("Interval was not canceled"); - }), - 0 - ); - - clearTimeout(handle); - - setTimeout(() => { - t.done(); - }, 100); -}, "Clear interval with clearTimeout"); diff --git a/test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html b/test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html deleted file mode 100644 index 77a8746908d742..00000000000000 --- a/test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html +++ /dev/null @@ -1,23 +0,0 @@ - -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 deleted file mode 100644 index 33a1cc073c8c1f..00000000000000 --- a/test/fixtures/wpt/html/webappapis/timers/missing-timeout-setinterval.any.js +++ /dev/null @@ -1,34 +0,0 @@ -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.any.js b/test/fixtures/wpt/html/webappapis/timers/negative-setinterval.any.js deleted file mode 100644 index 5646140c2a45f3..00000000000000 --- a/test/fixtures/wpt/html/webappapis/timers/negative-setinterval.any.js +++ /dev/null @@ -1,12 +0,0 @@ -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); diff --git a/test/fixtures/wpt/html/webappapis/timers/negative-settimeout.any.js b/test/fixtures/wpt/html/webappapis/timers/negative-settimeout.any.js deleted file mode 100644 index da191f1bf00d92..00000000000000 --- a/test/fixtures/wpt/html/webappapis/timers/negative-settimeout.any.js +++ /dev/null @@ -1,3 +0,0 @@ -setup({ single_test: true }); -setTimeout(done, -100); -setTimeout(assert_unreached, 10); diff --git a/test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.any.js b/test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.any.js deleted file mode 100644 index 164527f18b1e6f..00000000000000 --- a/test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.any.js +++ /dev/null @@ -1,8 +0,0 @@ -setup({ single_test: true }); -var interval; -function next() { - clearInterval(interval); - done(); -} -interval = setInterval(next, Math.pow(2, 32)); -setTimeout(assert_unreached, 100); diff --git a/test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.any.js b/test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.any.js deleted file mode 100644 index 9092f13f3b1000..00000000000000 --- a/test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.any.js +++ /dev/null @@ -1,3 +0,0 @@ -setup({ single_test: true }); -setTimeout(done, Math.pow(2, 32)); -setTimeout(assert_unreached, 100); diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index 6b9c6cb80a4659..257ee003eda66a 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -43,10 +43,6 @@ "commit": "47d3fb280c9c632e684dee3b78ae1f4c5d5ba640", "path": "html/webappapis/structured-clone" }, - "html/webappapis/timers": { - "commit": "5873f2d8f1f7bbb9c64689e52d04498614632906", - "path": "html/webappapis/timers" - }, "interfaces": { "commit": "df731dab88a1a25c04eb7e6238c11dc28fda0801", "path": "interfaces" diff --git a/test/sequential/test-timers-clearinterval-from-callback.js b/test/sequential/test-timers-clearinterval-from-callback.js new file mode 100644 index 00000000000000..db7c404c45ebf9 --- /dev/null +++ b/test/sequential/test-timers-clearinterval-from-callback.js @@ -0,0 +1,19 @@ +'use strict'; + +const common = require('../common'); + +// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/clearinterval-from-callback.any.js + +let wasPreviouslyCalled = false; + +const handle = setInterval(() => { + if (!wasPreviouslyCalled) { + wasPreviouslyCalled = true; + + clearInterval(handle); + + setInterval(process.exit, 750); + } else { + common.mustNotCall()(); + } +}, 500); diff --git a/test/sequential/test-timers-cleartimeout-clearinterval.js b/test/sequential/test-timers-cleartimeout-clearinterval.js new file mode 100644 index 00000000000000..d48deb5dc70495 --- /dev/null +++ b/test/sequential/test-timers-cleartimeout-clearinterval.js @@ -0,0 +1,17 @@ +'use strict'; + +const common = require('../common'); + +// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/cleartimeout-cleartinterval.any.js + +{ + const handle = setTimeout(common.mustNotCall(), 0); + clearInterval(handle); +} + +{ + const handle = setInterval(common.mustNotCall(), 0); + clearTimeout(handle); +} + +setTimeout(process.exit, 100); diff --git a/test/sequential/test-timers-missing-timeout-setinterval.js b/test/sequential/test-timers-missing-timeout-setinterval.js new file mode 100644 index 00000000000000..01ff172f4d8225 --- /dev/null +++ b/test/sequential/test-timers-missing-timeout-setinterval.js @@ -0,0 +1,34 @@ +'use strict'; + +const common = require('../common'); + +// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/missing-timeout-setinterval.any.js + +// Calling setInterval with no interval should be the same as if called with 0 interval +{ + let ctr = 0; + let doneHandle; + // eslint-disable-next-line no-restricted-syntax + const handle = setInterval(() => { + if (++ctr === 2) { + clearInterval(handle); + clearTimeout(doneHandle); + } + }/* no interval */); + + doneHandle = setTimeout(common.mustNotCall(), 100); +} + +// Calling setInterval with undefined interval should be the same as if called with 0 interval +{ + let ctr = 0; + let doneHandle; + const handle = setInterval(() => { + if (++ctr === 2) { + clearInterval(handle); + clearTimeout(doneHandle); + } + }, undefined); + + doneHandle = setTimeout(common.mustNotCall(), 100); +} diff --git a/test/sequential/test-timers-negative-setinterval.js b/test/sequential/test-timers-negative-setinterval.js new file mode 100644 index 00000000000000..5750797cbf176a --- /dev/null +++ b/test/sequential/test-timers-negative-setinterval.js @@ -0,0 +1,17 @@ +'use strict'; + +const common = require('../common'); + +// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/negative-setinterval.any.js + +let i = 0; +let interval; +function next() { + i++; + if (i === 20) { + clearInterval(interval); + process.exit(); + } +} +setTimeout(common.mustNotCall(), 1000); +interval = setInterval(next, -100); diff --git a/test/sequential/test-timers-negative-settimeout.js b/test/sequential/test-timers-negative-settimeout.js new file mode 100644 index 00000000000000..4201169ee52dad --- /dev/null +++ b/test/sequential/test-timers-negative-settimeout.js @@ -0,0 +1,8 @@ +'use strict'; + +const common = require('../common'); + +// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/negative-settimeout.any.js + +setTimeout(process.exit, -100); +setTimeout(common.mustNotCall(), 10); diff --git a/test/sequential/test-timers-type-long-setinterval.js b/test/sequential/test-timers-type-long-setinterval.js new file mode 100644 index 00000000000000..dc0d1472002b7a --- /dev/null +++ b/test/sequential/test-timers-type-long-setinterval.js @@ -0,0 +1,8 @@ +'use strict'; + +const common = require('../common'); + +// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/type-long-setinterval.any.js + +setInterval(process.exit, Math.pow(2, 32)); +setTimeout(common.mustNotCall(), 100); diff --git a/test/sequential/test-timers-type-long-settimeout.js b/test/sequential/test-timers-type-long-settimeout.js new file mode 100644 index 00000000000000..956fd78bc3c4ff --- /dev/null +++ b/test/sequential/test-timers-type-long-settimeout.js @@ -0,0 +1,8 @@ +'use strict'; + +const common = require('../common'); + +// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/type-long-settimeout.any.js + +setTimeout(process.exit, Math.pow(2, 32)); +setTimeout(common.mustNotCall(), 100); diff --git a/test/wpt/status/html/webappapis/timers.json b/test/wpt/status/html/webappapis/timers.json deleted file mode 100644 index 21e77a089d5ca7..00000000000000 --- a/test/wpt/status/html/webappapis/timers.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "negative-settimeout.any.js": { - "skip": "unreliable in Node.js; Refs: https://github.com/nodejs/node/issues/37672" - } -} diff --git a/test/wpt/test-timers.js b/test/wpt/test-timers.js deleted file mode 100644 index 86b1cf35b80629..00000000000000 --- a/test/wpt/test-timers.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -const { WPTRunner } = require('../common/wpt'); - -const runner = new WPTRunner('html/webappapis/timers'); - -runner.runJsTests();