blob: aaf7e6a553fbab79d871783cce5f3242ddf84246 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<style>
@keyframes my-animation {
from {
left : 0px;
}
to {
left : 100px;
}
}
.run-animation {
position: relative;
animation: my-animation 0.5s infinite;
animation-direction: alternate;
}
</style>
</head>
<body>
<p id="testElement" class="run-animation">Test text</p>
<script>
description("Tests that CSS animations are throttled in low power mode.");
jsTestIsAsync = true;
const element = document.getElementById("testElement");
element.onanimationstart = function() {
element.onanimationstart = null;
window.unthrottled = internals.animationsInterval;
window.throttled = unthrottled * 2;
evalAndLog("internals.setLowPowerModeEnabled(true)");
shouldBe("internals.animationsInterval", "throttled");
evalAndLog("internals.setLowPowerModeEnabled(false)");
shouldBe("internals.animationsInterval", "unthrottled");
finishJSTest();
};
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>