Index: LayoutTests/svg/animations/svg-animation-policy-once.html |
diff --git a/LayoutTests/svg/animations/svg-animation-policy-once.html b/LayoutTests/svg/animations/svg-animation-policy-once.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3824a00b5151bd159632422c322a7e8a6ef72811 |
--- /dev/null |
+++ b/LayoutTests/svg/animations/svg-animation-policy-once.html |
@@ -0,0 +1,81 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+if (window.internals) |
+ internals.settings.setImageAnimationPolicy("once"); |
+if (window.testRunner) { |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+} |
+window.jsTestIsAsync = true; |
+ |
+var rootSVGElement; |
+ |
+function iframeLoaded() { |
+ rootSVGElement = document.getElementById("iframe").contentDocument.documentElement; |
+} |
+ |
+function timerFired() |
+{ |
+ // True because animation is frozen by animation policy. |
+ shouldBeTrue("rootSVGElement.animationsPaused()"); |
+ |
+ // pauseAnimations after animation is frozen. |
+ rootSVGElement.pauseAnimations(); |
+ shouldBeTrue("rootSVGElement.animationsPaused()"); |
+ |
+ // unpauseAnimations after animation is frozen. |
+ rootSVGElement.unpauseAnimations(); |
+ shouldBeFalse("rootSVGElement.animationsPaused()"); |
+ |
+ // setCurrentTime after animation is frozen. |
+ rootSVGElement.setCurrentTime(5.0); |
+ shouldBe("rootSVGElement.getCurrentTime()", "5.0"); |
+ shouldBe("rect.y.animVal.value", "100"); |
+ |
+ finishJSTest(); |
+} |
+ |
+function runTest() { |
+ // SVG is not suspended. |
+ // Check setCurrentTime before animation is frozen. |
+ shouldBeFalse("rootSVGElement.animationsPaused()"); |
+ rootSVGElement.setCurrentTime(2.5); |
+ shouldBe("rootSVGElement.getCurrentTime()", "2.5"); |
+ shouldBe("rect.y.animVal.value", "100"); |
+ |
+ // Check pauseAnimations before animation is frozen. |
+ rootSVGElement.pauseAnimations(); |
+ shouldBeTrue("rootSVGElement.animationsPaused()"); |
+ |
+ // Check unpauseAnimations before animation is frozen. |
+ rootSVGElement.unpauseAnimations(); |
+ shouldBeFalse("rootSVGElement.animationsPaused()"); |
+ |
+ // Check setCurrentTime over duration before animation is frozen. |
+ rootSVGElement.setCurrentTime(5.0); |
+ shouldBe("rootSVGElement.getCurrentTime()", "5.0"); |
+ shouldBe("rect.y.animVal.value", "100"); |
+ shouldBeFalse("rootSVGElement.animationsPaused()"); |
+ |
+ // It will be fired after animation is frozen. |
+ // It's to check working after animation policy timer is fired. |
+ // animation policy timer is 3 secs. |
+ setTimeout(timerFired, 3000); |
+} |
+ |
+function prepareTest() { |
+ rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0]; |
+ description("This tests svg animation with animation policy once"); |
+ |
+ // Check SVG is not paused. |
+ shouldBeFalse("rootSVGElement.animationsPaused()"); |
+ setTimeout(runTest, 0); |
+} |
+</script> |
+<body onload="prepareTest()"> |
+<h1>SVG with animation policy, once</h1> |
+<iframe id="iframe" src="resources/animation-policy.svg" style="width: 300px; height: 300px;" onload="iframeLoaded()"></iframe> |
+<p id="description"></p> |
+<div id="console"></div> |
+</body> |