| <!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> |