blob: 137d52dc52d7b3e5a06d5906eb936da334263c7a [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
#frame {
position: absolute;
top: -1000px;
}
</style>
<iframe id="frame" sandbox="allow-scripts" src="resources/timer-throttling-frame.html"></iframe>
<script>
if (window.testRunner)
testRunner.dumpAsText();
let throttlingTest = async_test("Test timer throttling in out-of-view cross origin frames");
addEventListener('load', () => {
// Throttling only happens after the first layout, so start the test after
// that.
requestAnimationFrame(() => {
var frame = document.querySelector('#frame');
frame.contentWindow.postMessage(null, '*');
});
});
addEventListener('message', (e) => {
let timerDelay = e.data;
assert_greater_than(timerDelay, 900, "Timer interval")
throttlingTest.done();
});
</script>