test_input_vsync_alignment_lower_than_normal.html (1485B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <script src="/tests/SimpleTest/EventUtils.js"></script> 6 <link rel="stylesheet" href="/tests/SimpleTest/test.css"> 7 </head> 8 <body > 9 <script type="text/javascript"> 10 SimpleTest.waitForExplicitFinish(); 11 12 let runOrder = []; 13 function checkResult() { 14 if (runOrder.length == 3) { 15 info(`Checking run: ${JSON.stringify(runOrder)}`); 16 if (runOrder[0] === "Normal") { 17 isDeeply( 18 runOrder, 19 ["Normal", "InputHigh", "Vsync"], 20 "Input priority tasks should let normal tasks to run first when there's no pending vsync" 21 ); 22 SimpleTest.finish(); 23 } else { 24 runOrder = []; 25 runTest(); 26 } 27 } 28 } 29 30 function runTest() { 31 window.requestAnimationFrame(() => { 32 window.requestAnimationFrame(() => { 33 runOrder.push("Vsync"); 34 checkResult(); 35 }); 36 SpecialPowers.Services.tm.dispatchToMainThread(function() { 37 runOrder.push("InputHigh"); 38 checkResult(); 39 }, SpecialPowers.Ci.nsIRunnablePriority.PRIORITY_INPUT_HIGH); 40 SpecialPowers.Services.tm.dispatchToMainThread(function() { 41 runOrder.push("Normal"); 42 checkResult(); 43 }, SpecialPowers.Ci.nsIRunnablePriority.PRIORITY_NORMAL); 44 }); 45 } 46 47 SpecialPowers.pushPrefEnv({ 48 set: [["dom.input_events.strict_input_vsync_alignment", true]] 49 }).then(runTest); 50 </script> 51 </body> 52 </html>