33 lines
1.0 KiB
HTML
33 lines
1.0 KiB
HTML
<!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>
|