deadline-max-rAF.html (975B)
1 <!DOCTYPE html> 2 <title>window.requestIdleCallback max idle period deadline (requestAnimationFrame).</title> 3 <meta name="timeout" content="long"> 4 <link rel="author" title="Noam Rosenthal" href="mailto:noam@webkit.org" /> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="resources/ric-utils.js"></script> 8 <script> 9 10 function runRAFLoop() 11 { 12 requestAnimationFrame(runRAFLoop); 13 } 14 15 promise_test(async done => { 16 runRAFLoop(); 17 for (let i = 0; i < getRICRetryCount(); ++i) { 18 assert_less_than_equal(await getDeadlineForNextIdleCallback(), getPendingRenderDeadlineCap()) 19 } 20 }, 'Check that the deadline is less than 16ms when there is a pending animation frame.'); 21 </script> 22 <h1>Test of requestIdleCallback deadline behavior</h1> 23 <p>The test can pass accidentally as idle deadlines have a maximum but they can always be shorter. 24 It runs multiple times to expose potential failures.</p> 25 <div id="log"></div>