| 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: "2000px" }], { durati
on: 10000, iterations: Infinity }); | |
| 11 } | |
| 12 | |
| 13 function getWidth() | |
| 14 { | |
| 15 return node.offsetWidth; | |
| 16 } | |
| 17 | |
| 18 function rafWidth() | |
| 19 { | |
| 20 var callback; | |
| 21 var promise = new Promise((fulfill) => callback = fulfill); | |
| 22 if (window.testRunner) | |
| 23 testRunner.layoutAndPaintAsyncThen(() => callback(node.offsetWidth)); | |
| 24 return promise; | |
| 25 } | |
| 26 | |
| 27 function test() | |
| 28 { | |
| 29 InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; | |
| 30 InspectorTest.sendCommand("Animation.enable", {}); | |
| 31 InspectorTest.evaluateInPage("startAnimation()", function() {}); | |
| 32 | |
| 33 function onStarted(response) | |
| 34 { | |
| 35 InspectorTest.log("Animation started"); | |
| 36 InspectorTest.sendCommand("Animation.setPaused", { animations: [ respons
e.params.animation.id ], paused: true }, animPaused); | |
| 37 } | |
| 38 | |
| 39 function animPaused() | |
| 40 { | |
| 41 InspectorTest.evaluateInPage("getWidth()", saveWidth); | |
| 42 } | |
| 43 | |
| 44 function saveWidth(nodeWidth) | |
| 45 { | |
| 46 InspectorTest.evaluateInPageAsync("rafWidth()") | |
| 47 .then(function(result) { | |
| 48 InspectorTest.log(result === nodeWidth); | |
| 49 InspectorTest.completeTest(); | |
| 50 }); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 </script> | |
| 55 </head> | |
| 56 <body onload="runTest()"> | |
| 57 Tests that the animation is correctly paused. | |
| 58 <div id="node" style="background-color: red; height: 100px"></div> | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |