Chromium Code Reviews| 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 test() | |
| 19 { | |
| 20 InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; | |
| 21 InspectorTest.sendCommand("Animation.enable", {}); | |
| 22 InspectorTest.evaluateInPage("startAnimation()", function() {}); | |
| 23 | |
| 24 function onStarted(response) | |
| 25 { | |
| 26 InspectorTest.log("Animation started"); | |
| 27 InspectorTest.evaluateInPage("logPaused()"); | |
| 28 InspectorTest.sendCommand("Animation.setPaused", { animations: [ respons e.params.animation.id ], paused: true }, animPaused); | |
| 29 } | |
| 30 | |
| 31 function animPaused() | |
| 32 { | |
| 33 InspectorTest.evaluateInPage("getWidth()", saveWidth); | |
| 34 } | |
| 35 | |
| 36 var width; | |
| 37 function saveWidth(result) | |
| 38 { | |
| 39 width = result; | |
| 40 // Allow some frames to be painted to ensure it stays paused. | |
| 41 setTimeout(InspectorTest.evaluateInPage.bind(InspectorTest, "getWidth()" , checkWidth), 50); | |
|
pfeldman
2015/10/21 22:53:10
timeout is in most cases a source of the flake. th
samli
2015/10/21 22:54:21
That it is indeed truly paused.
pfeldman
2015/10/26 18:20:50
But 50 gives you nothing, it could result in 0 or
samli
2015/10/26 18:30:49
If its correctly paused, it doesn't matter if I me
| |
| 42 } | |
| 43 | |
| 44 function checkWidth(result) | |
| 45 { | |
| 46 InspectorTest.log(result == width); | |
| 47 InspectorTest.completeTest(); | |
| 48 } | |
| 49 | |
| 50 } | |
| 51 | |
| 52 </script> | |
| 53 </head> | |
| 54 <body onload="runTest()"> | |
| 55 Tests that the animation is correctly paused. | |
| 56 <div id="node" style="background-color: red; height: 100px"></div> | |
| 57 </body> | |
| 58 </html> | |
| OLD | NEW |