| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
| 4 <script> | |
| 5 | |
| 6 var animation; | |
| 7 | |
| 8 function startAnimation() | |
| 9 { | |
| 10 animation = node.animate([{ width: "100px" }, { width: "2000px" }], { durati
on: 0, fill: "forwards" }); | |
| 11 } | |
| 12 | |
| 13 function cancelAnimation() | |
| 14 { | |
| 15 animation.cancel(); | |
| 16 } | |
| 17 | |
| 18 function getWidth() | |
| 19 { | |
| 20 return node.offsetWidth; | |
| 21 } | |
| 22 | |
| 23 function test() | |
| 24 { | |
| 25 InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; | |
| 26 InspectorTest.sendCommand("Animation.enable", {}); | |
| 27 InspectorTest.evaluateInPage("startAnimation()", function() {}); | |
| 28 | |
| 29 function onStarted(response) | |
| 30 { | |
| 31 InspectorTest.log("Animation started"); | |
| 32 InspectorTest.evaluateInPage("getWidth()", pause.bind(null, response.par
ams.animation.id)); | |
| 33 } | |
| 34 | |
| 35 function pause(id, width) | |
| 36 { | |
| 37 InspectorTest.log("Box is animating: " + (width != 100).toString()); | |
| 38 InspectorTest.sendCommand("Animation.setPaused", { animations: [ id ], p
aused: true }); | |
| 39 InspectorTest.evaluateInPage("cancelAnimation()", function() {}); | |
| 40 InspectorTest.evaluateInPage("getWidth()", release.bind(null, id)); | |
| 41 } | |
| 42 | |
| 43 function release(id, width) | |
| 44 { | |
| 45 InspectorTest.log("Animation paused"); | |
| 46 InspectorTest.log("Box is animating: " + (width != 100).toString()); | |
| 47 InspectorTest.sendCommand("Animation.releaseAnimations", { animations: [
id ] }); | |
| 48 InspectorTest.evaluateInPage("getWidth()", released); | |
| 49 } | |
| 50 | |
| 51 function released(width) | |
| 52 { | |
| 53 InspectorTest.log("Animation released"); | |
| 54 InspectorTest.log("Box is animating: " + (width != 100).toString()); | |
| 55 InspectorTest.completeTest(); | |
| 56 } | |
| 57 } | |
| 58 | |
| 59 </script> | |
| 60 </head> | |
| 61 <body onload="runTest()"> | |
| 62 Tests that the animation is correctly paused. | |
| 63 <div id="node" style="background-color: red; width: 100px"></div> | |
| 64 </body> | |
| 65 </html> | |
| OLD | NEW |