Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: LayoutTests/svg/animations/svg-animation-policy-once.html

Issue 802143002: AnimationPolicy setting is applied to SVG animation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698