Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-pause.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-pause.html b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-pause.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..42e2db02a04bcf7343cda4cdcb5643019358f058 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-pause.html |
| @@ -0,0 +1,58 @@ |
| +<html> |
| +<head> |
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script> |
| +<script> |
| + |
| +var animation; |
| + |
| +function startAnimation() |
| +{ |
| + animation = node.animate([{ width: "100px" }, { width: "200px" }], 2000); |
| +} |
| + |
| +function getWidth() |
| +{ |
| + return node.offsetWidth; |
| +} |
| + |
| +function test() |
| +{ |
| + InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; |
| + InspectorTest.sendCommand("Animation.enable", {}); |
| + InspectorTest.evaluateInPage("startAnimation()", function() {}); |
| + |
| + function onStarted(response) |
| + { |
| + InspectorTest.log("Animation started"); |
| + InspectorTest.evaluateInPage("logPaused()"); |
| + InspectorTest.sendCommand("Animation.setPaused", { animations: [ response.params.animation.id ], paused: true }, animPaused); |
| + } |
| + |
| + function animPaused() |
| + { |
| + InspectorTest.evaluateInPage("getWidth()", saveWidth); |
| + } |
| + |
| + var width; |
| + function saveWidth(result) |
| + { |
| + width = result; |
| + // Allow some frames to be painted to ensure it stays paused. |
| + 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
|
| + } |
| + |
| + function checkWidth(result) |
| + { |
| + InspectorTest.log(result == width); |
| + InspectorTest.completeTest(); |
| + } |
| + |
| +} |
| + |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| + Tests that the animation is correctly paused. |
| + <div id="node" style="background-color: red; height: 100px"></div> |
| +</body> |
| +</html> |