<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<svg width="300px" height="100px">
    <rect x="0" y="0" width="300" height="100" stroke="black" stroke-width="1" />
    <circle cx="0" cy="50" r="15" fill="blue" stroke="black" stroke-width="1">
        <animate attributeName="cx" from="0" to="100" dur="5s" repeatCount="indefinite" />
    </circle>
</svg>
<script>
description("Tests that SVG animations are properly throttled in low power mode.");
jsTestIsAsync = true;

const svgElement = document.getElementsByTagName("svg")[0];

window.onload = function() {
    shouldBe("internals.svgAnimationsInterval(svgElement)", "1/60.");
    evalAndLog("internals.setLowPowerModeEnabled(true)");
    shouldBe("internals.svgAnimationsInterval(svgElement)", "1/30.");
    evalAndLog("internals.setLowPowerModeEnabled(false)");
    shouldBe("internals.svgAnimationsInterval(svgElement)", "1/60.");
    finishJSTest();
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
