| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 4 <script> |
| 5 |
| 6 var animation; |
| 7 |
| 8 function startAnimation() |
| 9 { |
| 10 animation = node.animate([{ width: "100px" }, { width: "200px" }], 2000); |
| 11 } |
| 12 |
| 13 function getWidth() |
| 14 { |
| 15 return node.offsetWidth; |
| 16 } |
| 17 |
| 18 function rafWidth(resolve, reject) |
| 19 { |
| 20 function frameCallback() |
| 21 { |
| 22 resolve(node.offsetWidth); |
| 23 } |
| 24 |
| 25 requestAnimationFrame(frameCallback); |
| 26 } |
| 27 |
| 28 window.debugTest = true; |
| 29 function test() |
| 30 { |
| 31 InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; |
| 32 InspectorTest.sendCommand("Animation.enable", {}); |
| 33 InspectorTest.evaluateInPage("startAnimation()", function() {}); |
| 34 |
| 35 function onStarted(response) |
| 36 { |
| 37 InspectorTest.log("Animation started"); |
| 38 InspectorTest.evaluateInPage("logPaused()"); |
| 39 InspectorTest.sendCommand("Animation.setPaused", { animations: [ respons
e.params.animation.id ], paused: true }, animPaused); |
| 40 } |
| 41 |
| 42 function animPaused() |
| 43 { |
| 44 InspectorTest.evaluateInPage("getWidth()", saveWidth); |
| 45 } |
| 46 |
| 47 function saveWidth(nodeWidth) |
| 48 { |
| 49 var width = nodeWidth; |
| 50 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(function(re
sult) { |
| 51 InspectorTest.log(result === width); |
| 52 InspectorTest.completeTest(); |
| 53 }); |
| 54 } |
| 55 } |
| 56 |
| 57 </script> |
| 58 </head> |
| 59 <body onload="runTest()"> |
| 60 Tests that the animation is correctly paused. |
| 61 <div id="node" style="background-color: red; height: 100px"></div> |
| 62 </body> |
| 63 </html> |
| OLD | NEW |