-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: pull html/webappapis/timers WPT
Using ``` git node wpt html/webappapis/timers ``` PR-URL: #25618 Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
4b6e4c1
commit 476531b
Showing
8 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 34 additions & 0 deletions
34
test/fixtures/wpt/html/webappapis/timers/missing-timeout-setinterval.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 17 additions & 0 deletions
17
test/fixtures/wpt/html/webappapis/timers/negative-setinterval.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 8 additions & 0 deletions
8
test/fixtures/wpt/html/webappapis/timers/negative-settimeout.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 13 additions & 0 deletions
13
test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 8 additions & 0 deletions
8
test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters