diff --git a/testing/web-platform/tests/requestidlecallback/deadline-max-rAF-dynamic.html b/testing/web-platform/tests/requestidlecallback/deadline-max-rAF-dynamic.html new file mode 100644 index 0000000000000..43eebd7641be0 --- /dev/null +++ b/testing/web-platform/tests/requestidlecallback/deadline-max-rAF-dynamic.html @@ -0,0 +1,31 @@ + +window.requestIdleCallback max idle period deadline (requestAnimationFrame). + + + + + + +

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.

+
diff --git a/testing/web-platform/tests/requestidlecallback/deadline-max-rAF.html b/testing/web-platform/tests/requestidlecallback/deadline-max-rAF.html new file mode 100644 index 0000000000000..314f250254f95 --- /dev/null +++ b/testing/web-platform/tests/requestidlecallback/deadline-max-rAF.html @@ -0,0 +1,21 @@ + +window.requestIdleCallback max idle period deadline (requestAnimationFrame). + + + + + + +

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.

+
diff --git a/testing/web-platform/tests/requestidlecallback/deadline-max-timeout-dynamic.html b/testing/web-platform/tests/requestidlecallback/deadline-max-timeout-dynamic.html new file mode 100644 index 0000000000000..169e6db548530 --- /dev/null +++ b/testing/web-platform/tests/requestidlecallback/deadline-max-timeout-dynamic.html @@ -0,0 +1,31 @@ + +window.requestIdleCallback max idle period deadline (dynamic timoeout). + + + + + + +

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.

+
diff --git a/testing/web-platform/tests/requestidlecallback/deadline-max.html b/testing/web-platform/tests/requestidlecallback/deadline-max.html new file mode 100644 index 0000000000000..e33341ac9dd97 --- /dev/null +++ b/testing/web-platform/tests/requestidlecallback/deadline-max.html @@ -0,0 +1,20 @@ + +window.requestIdleCallback max idle period deadline. + + + + + + +

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.

+
diff --git a/testing/web-platform/tests/requestidlecallback/resources/ric-utils.js b/testing/web-platform/tests/requestidlecallback/resources/ric-utils.js new file mode 100644 index 0000000000000..d6d22767a98ee --- /dev/null +++ b/testing/web-platform/tests/requestidlecallback/resources/ric-utils.js @@ -0,0 +1,14 @@ +function getDeadlineForNextIdleCallback() { + return new Promise( + resolve => + requestIdleCallback(deadline => resolve(deadline.timeRemaining())) + ); +} + +function getPendingRenderDeadlineCap() { + return 1000 / 60; +} + +function getRICRetryCount() { + return 10; +} \ No newline at end of file