blob: 706d3a8e4a109e181549df3c971ea90c4d85038a [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 framesPerSecond = 0;
function doWork(timestamp) {
if (!start)
start = timestamp;
if (timestamp - start < 1000) {
++framesPerSecond;
window.requestAnimationFrame(doWork);
}
else {
// The LowPowerMode throttling interval = 30_ms. The frame rate ~= 33.3 fps.
shouldBeTrue("framesPerSecond < 36");
if (framesPerSecond >= 36) { alert("actual framesPerSecond " + framesPerSecond) }
finishJSTest();
}
}
window.requestAnimationFrame(doWork);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>