| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/testharness.js"></script> | |
| 3 <script src="../../resources/testharnessreport.js"></script> | |
| 4 <style> | |
| 5 #frame { | |
| 6 position: absolute; | |
| 7 top: -1000px; | |
| 8 } | |
| 9 </style> | |
| 10 | |
| 11 <iframe id="frame" sandbox="allow-scripts" src="resources/raf-throttling-frame.h
tml"></iframe> | |
| 12 | |
| 13 <script> | |
| 14 if (window.testRunner) | |
| 15 testRunner.dumpAsText(); | |
| 16 let throttlingTest = async_test("Test requestAnimationFrame() throttling in out-
of-view cross origin frames"); | |
| 17 | |
| 18 addEventListener('load', () => { | |
| 19 // Check how many animation frames have been served to the frame after 1 | |
| 20 // second. | |
| 21 setTimeout(() => { | |
| 22 var frame = document.querySelector('#frame'); | |
| 23 frame.contentWindow.postMessage(null, '*'); | |
| 24 }, 1000); | |
| 25 }); | |
| 26 | |
| 27 addEventListener('message', (e) => { | |
| 28 let rafCount = e.data; | |
| 29 // TODO(skyostil): Chrome always runs one animation frame while the layout | |
| 30 // test harness does none. Find out where the difference is coming from. | |
| 31 assert_less_than_equal(rafCount, 1, "requestAnimationFrame() callback count") | |
| 32 throttlingTest.done(); | |
| 33 }); | |
| 34 </script> | |
| OLD | NEW |