mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: pull html/webappapis/timers WPT
Using ``` git node wpt html/webappapis/timers ``` PR-URL: https://github.com/nodejs/node/pull/25618 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1
test/fixtures/wpt/README.md
vendored
1
test/fixtures/wpt/README.md
vendored
@@ -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
|
||||
|
||||
23
test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html
vendored
Normal file
23
test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<title>Interaction of setTimeout and WebIDL</title>
|
||||
<link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-windowtimers-settimeout">
|
||||
<link rel="help" href="https://heycam.github.io/webidl/#es-operations">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test()
|
||||
function finishTest() {
|
||||
assert_equals(log, "ONE TWO ")
|
||||
t.done()
|
||||
}
|
||||
var log = '';
|
||||
function logger(s) { log += s + ' '; }
|
||||
|
||||
setTimeout({ toString: function () {
|
||||
setTimeout("logger('ONE')", 100);
|
||||
return "logger('TWO'); t.step(finishTest)";
|
||||
} }, 100);
|
||||
</script>
|
||||
34
test/fixtures/wpt/html/webappapis/timers/missing-timeout-setinterval.any.js
vendored
Normal file
34
test/fixtures/wpt/html/webappapis/timers/missing-timeout-setinterval.any.js
vendored
Normal file
@@ -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");
|
||||
17
test/fixtures/wpt/html/webappapis/timers/negative-setinterval.html
vendored
Normal file
17
test/fixtures/wpt/html/webappapis/timers/negative-setinterval.html
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<!doctype html>
|
||||
<title>Negative timeout in setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var i = 0;
|
||||
var interval;
|
||||
function next() {
|
||||
i++;
|
||||
if (i === 20) {
|
||||
clearInterval(interval);
|
||||
done();
|
||||
}
|
||||
}
|
||||
setTimeout(assert_unreached, 1000);
|
||||
interval = setInterval(next, -100);
|
||||
</script>
|
||||
8
test/fixtures/wpt/html/webappapis/timers/negative-settimeout.html
vendored
Normal file
8
test/fixtures/wpt/html/webappapis/timers/negative-settimeout.html
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<!doctype html>
|
||||
<title>Negative timeout in setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setTimeout(done, -100);
|
||||
setTimeout(assert_unreached, 10);
|
||||
</script>
|
||||
13
test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.html
vendored
Normal file
13
test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.html
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<title>Type long timeout for setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var interval;
|
||||
function next() {
|
||||
clearInterval(interval);
|
||||
done();
|
||||
}
|
||||
interval = setInterval(next, Math.pow(2, 32));
|
||||
setTimeout(assert_unreached, 100);
|
||||
</script>
|
||||
8
test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.html
vendored
Normal file
8
test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.html
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<!doctype html>
|
||||
<title>Type long timeout for setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setTimeout(done, Math.pow(2, 32));
|
||||
setTimeout(assert_unreached, 100);
|
||||
</script>
|
||||
4
test/fixtures/wpt/versions.json
vendored
4
test/fixtures/wpt/versions.json
vendored
@@ -22,5 +22,9 @@
|
||||
"html/webappapis/microtask-queuing": {
|
||||
"commit": "0c3bed38df6d9dcd1441873728fb5c1bb59c92df",
|
||||
"path": "html/webappapis/microtask-queuing"
|
||||
},
|
||||
"html/webappapis/timers": {
|
||||
"commit": "ddfe9c089bab565a9d3aa37bdef63d8012c1a94c",
|
||||
"path": "html/webappapis/timers"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user