blob: a93c69cb4e540e28053752b1aa657672226b2e54 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Test that requestAnimationFrame gets throttled in low power mode.");
window.jsTestIsAsync = true;
if (window.internals)
internals.setLowPowerModeEnabled(true);
var start = null;
var farmesPerSecond = 0;
function doWork(timestamp) {
if (!start)
start = timestamp;
if (timestamp - start < 1000) {
++farmesPerSecond;
window.requestAnimationFrame(doWork);
}
else {
// The LowPowerMode throttling interval = 30_ms. The frame rate ~= 33.3 fps.
shouldBeTrue("farmesPerSecond < 35");
finishJSTest();
}
}
window.requestAnimationFrame(doWork);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>