Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!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.
| |
| 2 <script src="../../resources/js-test.js"></script> | |
| 3 <script src="resources/SVGAnimationTestCase.js"></script> | |
| 4 <script> | |
| 5 if (window.internals) | |
| 6 internals.settings.setImageAnimationPolicy("once"); | |
| 7 if (window.testRunner) { | |
| 8 testRunner.dumpAsText(); | |
| 9 testRunner.waitUntilDone(); | |
| 10 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.
| |
| 11 } | |
| 12 | |
| 13 var rootSVGElement; | |
| 14 var iframeElement; | |
| 15 | |
| 16 function embedSVGTestCase(uri) { | |
| 17 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.
| |
| 18 iframeElement = document.createElement("iframe"); | |
| 19 iframeElement.setAttribute("style", "width: 300px; height: 300px;"); | |
| 20 iframeElement.setAttribute("src", uri); | |
| 21 iframeElement.setAttribute("onload", "iframeLoaded()"); | |
| 22 | |
| 23 var bodyElement = document.documentElement.lastChild; | |
| 24 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.
| |
| 25 } | |
| 26 | |
| 27 function iframeLoaded() { | |
| 28 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.
| |
| 29 } | |
| 30 | |
| 31 embedSVGTestCase("resources/animation-policy.svg"); | |
| 32 | |
| 33 function timerFired() | |
| 34 { | |
| 35 // 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.
| |
| 36 shouldBeTrue("rootSVGElement.animationsPaused()"); | |
| 37 | |
| 38 // pauseAnimations after animation is frozen. | |
| 39 rootSVGElement.pauseAnimations(); | |
| 40 shouldBeTrue("rootSVGElement.animationsPaused()"); | |
| 41 | |
| 42 // unpauseAnimations after animation is frozen. | |
| 43 rootSVGElement.unpauseAnimations(); | |
| 44 shouldBeFalse("rootSVGElement.animationsPaused()"); | |
| 45 | |
| 46 // setCurrentTime after animation is frozen. | |
| 47 rootSVGElement.setCurrentTime(5.0); | |
| 48 shouldBe("rootSVGElement.getCurrentTime()", "5.0"); | |
| 49 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.
| |
| 50 | |
| 51 finishJSTest(); | |
| 52 } | |
| 53 | |
| 54 function runTest() { | |
| 55 // 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.
| |
| 56 // Check setCurrentTime before animation is frozen. | |
| 57 shouldBeFalse("rootSVGElement.animationsPaused()"); | |
| 58 rootSVGElement.setCurrentTime(2.5); | |
| 59 shouldBe("rootSVGElement.getCurrentTime()", "2.5"); | |
| 60 shouldBeCloseEnough("rect.y.animVal.value", "100"); | |
| 61 | |
| 62 // Check pauseAnimations before animation is frozen. | |
| 63 rootSVGElement.pauseAnimations(); | |
| 64 shouldBeTrue("rootSVGElement.animationsPaused()"); | |
| 65 | |
| 66 // Check unpauseAnimations before animation is frozen. | |
| 67 rootSVGElement.unpauseAnimations(); | |
| 68 shouldBeFalse("rootSVGElement.animationsPaused()"); | |
| 69 | |
| 70 // Check setCurrentTime over duration before animation is frozen. | |
| 71 rootSVGElement.setCurrentTime(5.0); | |
| 72 shouldBe("rootSVGElement.getCurrentTime()", "5.0"); | |
| 73 shouldBeCloseEnough("rect.y.animVal.value", "100"); | |
| 74 shouldBeFalse("rootSVGElement.animationsPaused()"); | |
| 75 | |
| 76 // It will be fired after animation is frozen. | |
| 77 // It's to check working after animation policy timer is fired. | |
| 78 // animation policy timer is 3 secs. | |
| 79 setTimeout(timerFired, 3000); | |
| 80 } | |
| 81 | |
| 82 function prepareTest() { | |
| 83 rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0]; | |
| 84 description("This tests svg animation with animation policy once"); | |
| 85 | |
| 86 // Check SVG is not paused. | |
| 87 shouldBeFalse("rootSVGElement.animationsPaused()"); | |
| 88 setTimeout(runTest, 0); | |
| 89 } | |
| 90 </script> | |
| 91 <body onload="prepareTest()"> | |
| 92 <h1>SVG with animation policy, once</h1> | |
| 93 <p id="description"></p> | |
| 94 <div id="console"></div> | |
| 95 </body> | |
| OLD | NEW |