Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-release.html

Issue 1586863002: Devtools Animation: Deflake animation test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 getWidth()
19 { 19 {
20 function frameCallback() 20 return node.offsetWidth;
21 {
22 resolve(node.offsetWidth);
23 }
24
25 if (window.testRunner)
26 testRunner.layoutAndPaintAsyncThen(frameCallback);
27 } 21 }
28 22
29 window.debugTest = true;
30 function test() 23 function test()
31 { 24 {
32 InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; 25 InspectorTest.eventHandler["Animation.animationStarted"] = onStarted;
33 InspectorTest.sendCommand("Animation.enable", {}); 26 InspectorTest.sendCommand("Animation.enable", {});
34 InspectorTest.evaluateInPage("startAnimation()", function() {}); 27 InspectorTest.evaluateInPage("startAnimation()", function() {});
35 var pausedWidth;
36 28
37 function onStarted(response) 29 function onStarted(response)
38 { 30 {
39 InspectorTest.log("Animation started"); 31 InspectorTest.log("Animation started");
40 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(pause.bind( null, response.params.animation.id)); 32 InspectorTest.evaluateInPage("getWidth()", pause.bind(null, response.par ams.animation.id));
41 } 33 }
42 34
43 function pause(id, width) 35 function pause(id, width)
44 { 36 {
45 InspectorTest.log("Box is animating: " + (width != 100).toString()); 37 InspectorTest.log("Box is animating: " + (width != 100).toString());
46 InspectorTest.sendCommand("Animation.setPaused", { animations: [ id ], p aused: true }); 38 InspectorTest.sendCommand("Animation.setPaused", { animations: [ id ], p aused: true });
47 InspectorTest.evaluateInPage("cancelAnimation()", function() {}); 39 InspectorTest.evaluateInPage("cancelAnimation()", function() {});
48 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(release.bin d(null, id)); 40 InspectorTest.evaluateInPage("getWidth()", release.bind(null, id));
49 } 41 }
50 42
51 function release(id, width) 43 function release(id, width)
52 { 44 {
53 InspectorTest.log("Animation paused"); 45 InspectorTest.log("Animation paused");
54 InspectorTest.log("Box is animating: " + (width != 100).toString()); 46 InspectorTest.log("Box is animating: " + (width != 100).toString());
55 InspectorTest.sendCommand("Animation.releaseAnimations", { animations: [ id ] }); 47 InspectorTest.sendCommand("Animation.releaseAnimations", { animations: [ id ] });
56 InspectorTest.invokePageFunctionPromise("rafWidth", []).then(released); 48 InspectorTest.evaluateInPage("getWidth()", released);
57 } 49 }
58 50
59 function released(width) 51 function released(width)
60 { 52 {
61 InspectorTest.log("Animation released"); 53 InspectorTest.log("Animation released");
62 InspectorTest.log("Box is animating: " + (width != 100).toString()); 54 InspectorTest.log("Box is animating: " + (width != 100).toString());
63 InspectorTest.completeTest(); 55 InspectorTest.completeTest();
64 } 56 }
65 } 57 }
66 58
67 </script> 59 </script>
68 </head> 60 </head>
69 <body onload="runTest()"> 61 <body onload="runTest()">
70 Tests that the animation is correctly paused. 62 Tests that the animation is correctly paused.
71 <div id="node" style="background-color: red; width: 100px"></div> 63 <div id="node" style="background-color: red; width: 100px"></div>
72 </body> 64 </body>
73 </html> 65 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698