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

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: Update code 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..587655b423d4e18097431a1d348b9360b128d2ba
--- /dev/null
+++ b/LayoutTests/svg/animations/svg-animation-policy-once.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<script src="../../resources/js-test.js"></script>
+<script src="resources/SVGTestCase.js"></script>
fs 2014/12/25 17:32:07 Are these really needed except for the "embedSVGTe
je_julie(Not used) 2014/12/27 07:08:53 I removed that script external link and I added AP
+<script src="resources/SVGAnimationTestCase.js"></script>
+<script>
+if (window.internals)
+ internals.settings.setImageAnimationPolicy("once");
+
+embedSVGTestCase("resources/animation-policy.svg");
+function timerFiredSecond()
+{
+ // It should be true because animation is freezed by animation policy.
fs 2014/12/25 17:32:07 Nit: s/freezed/frozen/ You could probably also s/
je_julie(Not used) 2014/12/27 07:08:53 Done.
+ shouldBeTrue("rootSVGElement.animationsPaused()");
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+function timerFiredFirst()
+{
+ // It should be true because animation is freezed by animation policy.
+ shouldBeTrue("rootSVGElement.animationsPaused()");
+
+ rootSVGElement.pauseAnimations();
+ shouldBeTrue("rootSVGElement.animationsPaused()");
+
+ // It should be animated after SVG is resumed.
+ rootSVGElement.unpauseAnimations();
+ shouldBeFalse("rootSVGElement.animationsPaused()");
+ rootSVGElement.setCurrentTime(5.0);
+ shouldBe("rootSVGElement.getCurrentTime()", "5.0");
+ shouldBeCloseEnough("rect.y.animVal.value", "100");
+ shouldBeFalse("rootSVGElement.animationsPaused()");
+
+ setTimeout(timerFiredSecond, 3000);
+}
+
+function runTest() {
+ // SVG is not suspened.
+ rootSVGElement.setCurrentTime(2.5);
+ shouldBeFalse("rootSVGElement.animationsPaused()");
+ shouldBe("rootSVGElement.getCurrentTime()", "2.5");
+ shouldBeCloseEnough("rect.y.animVal.value", "100");
+
+ // setTimeout. It will be fired after animation is freezed.
+ // It's to check working after animation policy timer is fired.
+ // animation policy timer is 3 secs.
+ setTimeout(timerFiredFirst, 3000);
fs 2014/12/25 17:32:07 A 6+ seconds test - ouch =/ Could we at the very l
je_julie(Not used) 2014/12/27 07:08:53 I updated test flow a little bit. I rearranged tes
+}
+
+function prepareTest() {
+ rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0];
+ description("This tests svg animation with animation policy once");
+
+ if (window.testRunner) {
fs 2014/12/25 17:32:07 Might as well do this just after the setImageAnima
je_julie(Not used) 2014/12/27 07:08:53 Done.
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ // Check SVG is not paused.
+ shouldBeFalse("rootSVGElement.animationsPaused()");
+ setTimeout(runTest(), 0);
fs 2014/12/25 17:32:07 Drop the () - or the setTimeout?
je_julie(Not used) 2014/12/27 07:08:53 Done.
+}
+</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