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

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

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: Protocol -> dp Created 3 years, 6 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
OLDNEW
(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 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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698