loaf-event-blocking-duration.html (1207B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Long Animation Frame Timing: blocking duration with events</title> 4 <meta name="timeout" content="long"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <script src="/resources/testdriver-actions.js"></script> 10 <script src="resources/utils.js"></script> 11 12 <body> 13 <h1>Long Animation Frame: blocking duration with events</h1> 14 <div id="log"></div> 15 <output id="output"></output> 16 <script> 17 promise_test(async t => { 18 const [entry, script] = await expect_long_frame_with_script(async (t, busy_wait) => { 19 const button = document.createElement("button"); 20 button.innerText = "click"; 21 button.addEventListener("click", () => busy_wait()); 22 document.body.append(button); 23 t.add_cleanup(() => button.remove()); 24 await test_driver.click(button); 25 }, (script) => script.invoker === "BUTTON.onclick", t); 26 assert_greater_than(entry.duration, 50); 27 assert_greater_than_equal(entry.blockingDuration, 300); 28 }, "LoAF generated by events should generate correct blockingDuration"); 29 </script> 30 </body>