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

Side by Side 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 5 years, 12 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script>
4 if (window.internals)
5 internals.settings.setImageAnimationPolicy("once");
6 if (window.testRunner) {
7 testRunner.dumpAsText();
8 testRunner.waitUntilDone();
9 }
10 window.jsTestIsAsync = true;
11
12 var rootSVGElement;
13
14 function iframeLoaded() {
15 rootSVGElement = document.getElementById("iframe").contentDocument.documentE lement;
16 }
17
18 function timerFired()
19 {
20 // True because animation is frozen by animation policy.
21 shouldBeTrue("rootSVGElement.animationsPaused()");
22
23 // pauseAnimations after animation is frozen.
24 rootSVGElement.pauseAnimations();
25 shouldBeTrue("rootSVGElement.animationsPaused()");
26
27 // unpauseAnimations after animation is frozen.
28 rootSVGElement.unpauseAnimations();
29 shouldBeFalse("rootSVGElement.animationsPaused()");
30
31 // setCurrentTime after animation is frozen.
32 rootSVGElement.setCurrentTime(5.0);
33 shouldBe("rootSVGElement.getCurrentTime()", "5.0");
34 shouldBe("rect.y.animVal.value", "100");
35
36 finishJSTest();
37 }
38
39 function runTest() {
40 // SVG is not suspended.
41 // Check setCurrentTime before animation is frozen.
42 shouldBeFalse("rootSVGElement.animationsPaused()");
43 rootSVGElement.setCurrentTime(2.5);
44 shouldBe("rootSVGElement.getCurrentTime()", "2.5");
45 shouldBe("rect.y.animVal.value", "100");
46
47 // Check pauseAnimations before animation is frozen.
48 rootSVGElement.pauseAnimations();
49 shouldBeTrue("rootSVGElement.animationsPaused()");
50
51 // Check unpauseAnimations before animation is frozen.
52 rootSVGElement.unpauseAnimations();
53 shouldBeFalse("rootSVGElement.animationsPaused()");
54
55 // Check setCurrentTime over duration before animation is frozen.
56 rootSVGElement.setCurrentTime(5.0);
57 shouldBe("rootSVGElement.getCurrentTime()", "5.0");
58 shouldBe("rect.y.animVal.value", "100");
59 shouldBeFalse("rootSVGElement.animationsPaused()");
60
61 // It will be fired after animation is frozen.
62 // It's to check working after animation policy timer is fired.
63 // animation policy timer is 3 secs.
64 setTimeout(timerFired, 3000);
65 }
66
67 function prepareTest() {
68 rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0];
69 description("This tests svg animation with animation policy once");
70
71 // Check SVG is not paused.
72 shouldBeFalse("rootSVGElement.animationsPaused()");
73 setTimeout(runTest, 0);
74 }
75 </script>
76 <body onload="prepareTest()">
77 <h1>SVG with animation policy, once</h1>
78 <iframe id="iframe" src="resources/animation-policy.svg" style="width: 300px; he ight: 300px;" onload="iframeLoaded()"></iframe>
79 <p id="description"></p>
80 <div id="console"></div>
81 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698