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

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: Use enum 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..47e7e937c5acada3f7ef3621f54b453ffd0cdd0b
--- /dev/null
+++ b/LayoutTests/svg/animations/svg-animation-policy-once.html
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
fs 2014/12/27 15:36:35 <!DOCTYPE html>
je_julie(Not used) 2014/12/28 05:50:26 Done.
+<script src="../../resources/js-test.js"></script>
+<script src="resources/SVGAnimationTestCase.js"></script>
+<script>
+if (window.internals)
+ internals.settings.setImageAnimationPolicy("once");
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ window.jsTestIsAsync = true;
fs 2014/12/27 15:36:35 Probably better to just set this(once) outside of
je_julie(Not used) 2014/12/28 05:50:26 Done.
+}
+
+var rootSVGElement;
+var iframeElement;
+
+function embedSVGTestCase(uri) {
+ window.jsTestIsAsync = true;
fs 2014/12/27 15:36:35 No need to set this here (again).
je_julie(Not used) 2014/12/28 05:50:26 Done.
+ iframeElement = document.createElement("iframe");
+ iframeElement.setAttribute("style", "width: 300px; height: 300px;");
+ iframeElement.setAttribute("src", uri);
+ iframeElement.setAttribute("onload", "iframeLoaded()");
+
+ var bodyElement = document.documentElement.lastChild;
+ bodyElement.insertBefore(iframeElement, document.getElementById("description"));
fs 2014/12/27 15:36:35 This could be: <iframe src="resources/animation-p
je_julie(Not used) 2014/12/28 05:50:26 Done.
+}
+
+function iframeLoaded() {
+ rootSVGElement = iframeElement.getSVGDocument().rootElement;
fs 2014/12/27 15:36:35 Use contentDocument.documentElement here instead o
je_julie(Not used) 2014/12/28 05:50:26 Done.
+}
+
+embedSVGTestCase("resources/animation-policy.svg");
+
+function timerFired()
+{
+ // It should be True because animation is frozen by animation policy.
fs 2014/12/27 15:36:35 Drop the the "It should be" part (it doesn't reall
je_julie(Not used) 2014/12/28 05:50:26 Done.
+ 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");
+ shouldBeCloseEnough("rect.y.animVal.value", "100");
fs 2014/12/27 15:36:35 It should be possible to make all the shouldBeClos
je_julie(Not used) 2014/12/28 05:50:26 Done.
+
+ finishJSTest();
+}
+
+function runTest() {
+ // SVG is not suspened.
fs 2014/12/27 15:36:35 Nit: suspended (missing 'd')
je_julie(Not used) 2014/12/28 05:50:26 Done.
+ // Check setCurrentTime before animation is frozen.
+ shouldBeFalse("rootSVGElement.animationsPaused()");
+ rootSVGElement.setCurrentTime(2.5);
+ shouldBe("rootSVGElement.getCurrentTime()", "2.5");
+ shouldBeCloseEnough("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");
+ shouldBeCloseEnough("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>
+<p id="description"></p>
+<div id="console"></div>
+</body>

Powered by Google App Engine
This is Rietveld 408576698