Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 var animation; | 6 var animation; |
| 7 | 7 |
| 8 function startAnimation() | 8 function startAnimation() |
| 9 { | 9 { |
| 10 animation = node.animate([{ width: "100px" }, { width: "2000px" }], { durati on: 20, fill: "forwards" }); | 10 animation = node.animate([{ width: "100px" }, { width: "2000px" }], { durati on: 0, fill: "forwards" }); |
| 11 } | 11 } |
| 12 | 12 |
| 13 function cancelAnimation() | 13 function cancelAnimation() |
| 14 { | 14 { |
| 15 animation.cancel(); | 15 animation.cancel(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 function rafWidth(resolve, reject) | 18 function rafWidth(resolve, reject) |
|
caseq
2016/01/14 00:29:11
is this still relevant for this test?
samli
2016/01/14 00:51:15
Yes.
caseq
2016/01/14 00:59:10
My point was that with duration == 0 the animation
| |
| 19 { | 19 { |
| 20 function frameCallback() | 20 function frameCallback() |
| 21 { | 21 { |
| 22 resolve(node.offsetWidth); | 22 resolve(node.offsetWidth); |
| 23 } | 23 } |
| 24 | 24 |
| 25 if (window.testRunner) | 25 if (window.testRunner) |
| 26 testRunner.layoutAndPaintAsyncThen(frameCallback); | 26 testRunner.layoutAndPaintAsyncThen(frameCallback); |
| 27 } | 27 } |
| 28 | 28 |
| 29 window.debugTest = true; | 29 window.debugTest = true; |
|
caseq
2016/01/14 00:29:11
drop this?
samli
2016/01/14 00:51:15
Done.
| |
| 30 function test() | 30 function test() |
| 31 { | 31 { |
| 32 InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; | 32 InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; |
| 33 InspectorTest.sendCommand("Animation.enable", {}); | 33 InspectorTest.sendCommand("Animation.enable", {}); |
| 34 InspectorTest.evaluateInPage("startAnimation()", function() {}); | 34 InspectorTest.evaluateInPage("startAnimation()", function() {}); |
| 35 var pausedWidth; | 35 var pausedWidth; |
| 36 | 36 |
| 37 function onStarted(response) | 37 function onStarted(response) |
| 38 { | 38 { |
| 39 InspectorTest.log("Animation started"); | 39 InspectorTest.log("Animation started"); |
| 40 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(pause.bind( null, response.params.animation.id)); | 40 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(pause.bind( null, response.params.animation.id)); |
|
caseq
2016/01/14 00:29:11
is pausing relevant for this test?
samli
2016/01/14 00:51:15
Yep. I'd like to isolate that release is working a
| |
| 41 } | 41 } |
| 42 | 42 |
| 43 function pause(id, width) | 43 function pause(id, width) |
| 44 { | 44 { |
| 45 InspectorTest.log("Box is animating: " + (width != 100).toString()); | 45 InspectorTest.log("Box is animating: " + (width != 100).toString()); |
|
caseq
2016/01/14 00:29:11
not sure if these are still meaningful.
samli
2016/01/14 00:51:15
This is, yes.
| |
| 46 InspectorTest.sendCommand("Animation.setPaused", { animations: [ id ], p aused: true }); | 46 InspectorTest.sendCommand("Animation.setPaused", { animations: [ id ], p aused: true }); |
| 47 InspectorTest.evaluateInPage("cancelAnimation()", function() {}); | 47 InspectorTest.evaluateInPage("cancelAnimation()", function() {}); |
| 48 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(release.bin d(null, id)); | 48 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(release.bin d(null, id)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 function release(id, width) | 51 function release(id, width) |
| 52 { | 52 { |
| 53 InspectorTest.log("Animation paused"); | 53 InspectorTest.log("Animation paused"); |
| 54 InspectorTest.log("Box is animating: " + (width != 100).toString()); | 54 InspectorTest.log("Box is animating: " + (width != 100).toString()); |
| 55 InspectorTest.sendCommand("Animation.releaseAnimations", { animations: [ id ] }); | 55 InspectorTest.sendCommand("Animation.releaseAnimations", { animations: [ id ] }); |
| 56 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(released); | 56 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(released); |
| 57 } | 57 } |
| 58 | 58 |
| 59 function released(width) | 59 function released(width) |
| 60 { | 60 { |
| 61 InspectorTest.log("Animation released"); | 61 InspectorTest.log("Animation released"); |
| 62 InspectorTest.log("Box is animating: " + (width != 100).toString()); | 62 InspectorTest.log("Box is animating: " + (width != 100).toString()); |
| 63 InspectorTest.completeTest(); | 63 InspectorTest.completeTest(); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 </script> | 67 </script> |
| 68 </head> | 68 </head> |
| 69 <body onload="runTest()"> | 69 <body onload="runTest()"> |
| 70 Tests that the animation is correctly paused. | 70 Tests that the animation is correctly paused. |
| 71 <div id="node" style="background-color: red; width: 100px"></div> | 71 <div id="node" style="background-color: red; width: 100px"></div> |
| 72 </body> | 72 </body> |
| 73 </html> | 73 </html> |
| OLD | NEW |