-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resync requestIdleCallback WPT tests
https://bugs.webkit.org/show_bug.cgi?id=259917 Reviewed by Tim Nguyen. Updated WPT tests for requestIdleCallback as of 0f0227f. * LayoutTests/TestExpectations: Added flaky failure expectation on the tests that yield different result each time. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/basic.html: * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-idle-periods.html: * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-invoked.html: * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeRemaining-cross-realm-method.html: * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-after-expired-timer-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-after-expired-timer.html: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-dynamic-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-dynamic.html: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF.html: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-timeout-dynamic-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-timeout-dynamic.html: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max.html: Added. * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/resources/ric-utils.js: Added. (getDeadlineForNextIdleCallback): (getRICRetryCount): * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/resources/w3c-import.log: * LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/w3c-import.log: * LayoutTests/tests-options.json: Canonical link: https://commits.webkit.org/266678@main
- Loading branch information
Showing
18 changed files
with
208 additions
and
2 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
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
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
1 change: 1 addition & 0 deletions
1
LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-invoked.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
3 changes: 3 additions & 0 deletions
3
...rted/w3c/web-platform-tests/requestidlecallback/deadline-after-expired-timer-expected.txt
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,3 @@ | ||
|
||
FAIL The deadline after an expired timer must not be negative assert_false: expected false got true | ||
|
22 changes: 22 additions & 0 deletions
22
...sts/imported/w3c/web-platform-tests/requestidlecallback/deadline-after-expired-timer.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,22 @@ | ||
<!doctype html><!-- webkit-test-runner [ RequestIdleCallbackEnabled=true ] --> | ||
<meta charset=utf-8> | ||
<title>The deadline after an expired timer must not be negative</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<div id="log"></div> | ||
<script> | ||
async_test(function(t) { | ||
setTimeout(() => { | ||
|
||
requestIdleCallback( | ||
t.step_func((deadline) => { | ||
assert_false(deadline.didTimeout); | ||
assert_greater_than_equal(deadline.timeRemaining(), 0); | ||
t.done(); | ||
}), | ||
{ timeout: 1000 } | ||
); | ||
|
||
}, 0); | ||
}); | ||
</script> |
9 changes: 9 additions & 0 deletions
9
LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-expected.txt
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,9 @@ | ||
Test of requestIdleCallback deadline behavior | ||
|
||
This test validates that deadlines returned for requestIdleCallback are less than 50ms. | ||
|
||
The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. It runs multiple times to expose potential failures. | ||
|
||
|
||
FAIL Check that the deadline is less than 50ms. assert_less_than_equal: expected a number less than or equal to 50 but got 93 | ||
|
7 changes: 7 additions & 0 deletions
7
...imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-dynamic-expected.txt
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,7 @@ | ||
Test of requestIdleCallback deadline behavior | ||
|
||
The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. It runs multiple times to expose potential failures. | ||
|
||
|
||
FAIL Check that the deadline is changed if there is a new requestAnimationFrame from within requestIdleCallback. assert_less_than_equal: expected a number less than or equal to 16.666666666666668 but got 101 | ||
|
31 changes: 31 additions & 0 deletions
31
...utTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-dynamic.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,31 @@ | ||
<!DOCTYPE html><!-- webkit-test-runner [ RequestIdleCallbackEnabled=true ] --> | ||
<title>window.requestIdleCallback max idle period deadline (requestAnimationFrame).</title> | ||
<meta name="timeout" content="long"> | ||
<link rel="author" title="Noam Rosenthal" href="mailto:noam@webkit.org" /> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/ric-utils.js"></script> | ||
<script> | ||
|
||
promise_test(async () => { | ||
for (let i = 0; i < getRICRetryCount(); ++i) { | ||
const {before, after} = await new Promise(resolve => requestIdleCallback(async deadline => { | ||
const before = deadline.timeRemaining(); | ||
const animationFramePromise = new Promise(requestAnimationFrame); | ||
const after = deadline.timeRemaining(); | ||
|
||
// Waiting till rAF is handled before the next iteration, to avoid residual callacks between iterations. | ||
await animationFramePromise; | ||
resolve({before, after}) | ||
})) | ||
|
||
assert_less_than_equal(after, before) | ||
assert_less_than_equal(after, getPendingRenderDeadlineCap()) | ||
} | ||
|
||
}, 'Check that the deadline is changed if there is a new requestAnimationFrame from within requestIdleCallback.'); | ||
</script> | ||
<h1>Test of requestIdleCallback deadline behavior</h1> | ||
<p>The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. | ||
It runs multiple times to expose potential failures.</p> | ||
<div id="log"></div> |
7 changes: 7 additions & 0 deletions
7
...utTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-expected.txt
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,7 @@ | ||
Test of requestIdleCallback deadline behavior | ||
|
||
The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. It runs multiple times to expose potential failures. | ||
|
||
|
||
FAIL Check that the deadline is less than 16ms when there is a pending animation frame. assert_less_than_equal: expected a number less than or equal to 16.666666666666668 but got 115 | ||
|
21 changes: 21 additions & 0 deletions
21
LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF.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,21 @@ | ||
<!DOCTYPE html><!-- webkit-test-runner [ RequestIdleCallbackEnabled=true ] --> | ||
<title>window.requestIdleCallback max idle period deadline (requestAnimationFrame).</title> | ||
<meta name="timeout" content="long"> | ||
<link rel="author" title="Noam Rosenthal" href="mailto:noam@webkit.org" /> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/ric-utils.js"></script> | ||
<script> | ||
|
||
promise_test(async done => { | ||
for (let i = 0; i < getRICRetryCount(); ++i) { | ||
requestAnimationFrame(() => {}) | ||
assert_less_than_equal(await getDeadlineForNextIdleCallback(), getPendingRenderDeadlineCap()) | ||
} | ||
|
||
}, 'Check that the deadline is less than 16ms when there is a pending animation frame.'); | ||
</script> | ||
<h1>Test of requestIdleCallback deadline behavior</h1> | ||
<p>The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. | ||
It runs multiple times to expose potential failures.</p> | ||
<div id="log"></div> |
7 changes: 7 additions & 0 deletions
7
...rted/w3c/web-platform-tests/requestidlecallback/deadline-max-timeout-dynamic-expected.txt
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,7 @@ | ||
Test of requestIdleCallback deadline behavior | ||
|
||
The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. It runs multiple times to expose potential failures. | ||
|
||
|
||
FAIL Check that the deadline is changed if there is a new timeout from within requestIdleCallback. assert_less_than_equal: expected a number less than or equal to 10 but got 95 | ||
|
31 changes: 31 additions & 0 deletions
31
...sts/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-timeout-dynamic.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,31 @@ | ||
<!DOCTYPE html><!-- webkit-test-runner [ RequestIdleCallbackEnabled=true ] --> | ||
<title>window.requestIdleCallback max idle period deadline (dynamic timoeout).</title> | ||
<meta name="timeout" content="long"> | ||
<link rel="author" title="Noam Rosenthal" href="mailto:noam@webkit.org" /> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/ric-utils.js"></script> | ||
<script> | ||
|
||
promise_test(async () => { | ||
for (let i = 0; i < getRICRetryCount(); ++i) { | ||
for (const timeout of [10, 20, 30]) { | ||
const {before, after} = await new Promise(resolve => requestIdleCallback(async deadline => { | ||
const before = deadline.timeRemaining(); | ||
const timerPromise = new Promise(resolve => step_timeout(resolve, timeout)); | ||
const after = deadline.timeRemaining(); | ||
await timerPromise; | ||
resolve({before, after}) | ||
})) | ||
|
||
assert_less_than_equal(after, before) | ||
assert_less_than_equal(after, timeout) | ||
} | ||
} | ||
|
||
}, 'Check that the deadline is changed if there is a new timeout from within requestIdleCallback.'); | ||
</script> | ||
<h1>Test of requestIdleCallback deadline behavior</h1> | ||
<p>The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. | ||
It runs multiple times to expose potential failures.</p> | ||
<div id="log"></div> |
20 changes: 20 additions & 0 deletions
20
LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max.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,20 @@ | ||
<!DOCTYPE html><!-- webkit-test-runner [ RequestIdleCallbackEnabled=true ] --> | ||
<title>window.requestIdleCallback max idle period deadline.</title> | ||
<meta name="timeout" content="long"> | ||
<link rel="author" title="Noam Rosenthal" href="mailto:noam@webkit.org" /> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/ric-utils.js"></script> | ||
<script> | ||
|
||
promise_test(async done => { | ||
for (let i = 0; i < getRICRetryCount(); ++i) | ||
assert_less_than_equal(await getDeadlineForNextIdleCallback(), 50) | ||
|
||
}, 'Check that the deadline is less than 50ms.'); | ||
</script> | ||
<h1>Test of requestIdleCallback deadline behavior</h1> | ||
<p>This test validates that deadlines returned for requestIdleCallback are less than 50ms.</p> | ||
<p>The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. | ||
It runs multiple times to expose potential failures.</p> | ||
<div id="log"></div> |
14 changes: 14 additions & 0 deletions
14
LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/resources/ric-utils.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,14 @@ | ||
function getDeadlineForNextIdleCallback() { | ||
return new Promise( | ||
resolve => | ||
requestIdleCallback(deadline => resolve(deadline.timeRemaining())) | ||
); | ||
} | ||
|
||
function getPendingRenderDeadlineCap() { | ||
return 1000 / 60; | ||
} | ||
|
||
function getRICRetryCount() { | ||
return 10; | ||
} |
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
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
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