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

Side by Side Diff: LayoutTests/animations/play-state.html

Issue 38303003: Try again to deflake animations/play-state.html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Increase delay before testing end state Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/animations/play-state-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <head> 2 <head>
3 <title>Test of -webkit-animation-play-state</title> 3 <title>Test of -webkit-animation-play-state</title>
4 <style> 4 <style>
5 #box1 { 5 .target {
6 height: 100px; 6 height: 100px;
7 width: 100px; 7 width: 100px;
8 -webkit-animation-duration: 40ms;
9 -webkit-animation-timing-function: linear;
10 }
11 #translate {
8 background-color: blue; 12 background-color: blue;
9 margin: 0;
10 -webkit-animation-duration: 2s;
11 -webkit-animation-timing-function: linear;
12 -webkit-animation-name: "move1"; 13 -webkit-animation-name: "move1";
13 -webkit-animation-play-state: running;
14 } 14 }
15 @-webkit-keyframes "move1" { 15 @-webkit-keyframes "move1" {
16 from { -webkit-transform: translateX(0); } 16 from { -webkit-transform: translateX(100px); }
17 to { -webkit-transform: translateX(100px); } 17 to { -webkit-transform: translateX(200px); }
18 } 18 }
19 #box2 { 19 #left {
20 position:absolute; 20 position: relative;
21 top: 260px;
22 height: 100px;
23 width: 100px;
24 background-color: red; 21 background-color: red;
25 -webkit-animation-duration: 2s;
26 -webkit-animation-timing-function: linear;
27 -webkit-animation-name: "move2"; 22 -webkit-animation-name: "move2";
28 } 23 }
29 @-webkit-keyframes "move2" { 24 @-webkit-keyframes "move2" {
30 from { left: 0; } 25 from { left: 100px; }
31 to { left: 100px; } 26 to { left: 200px; }
27 }
28 .paused {
29 -webkit-animation-play-state: paused;
32 } 30 }
33 </style> 31 </style>
34 <script src="resources/animation-test-helpers.js" type="text/javascript"></scr ipt> 32 <script src="resources/animation-test-helpers.js" type="text/javascript"></scr ipt>
35 <script type="text/javascript"> 33 <script type="text/javascript">
36 34 if (window.testRunner) {
37 const expectedValues = [ 35 testRunner.dumpAsText();
38 // [time, element-id, property, expected-value, tolerance] 36 testRunner.waitUntilDone();
39 [0.5, "box1", "webkitTransform", [1,0,0,1,25,0], 24],
40 [1.1, "box1", "webkitTransform", [1,0,0,1,50,0], 5],
41 [1.5, "box1", "webkitTransform", [1,0,0,1,50,0], 5],
42 [2.5, "box1", "webkitTransform", [1,0,0,1,75,0], 24],
43 [0.5, "box2", "left", 25, 24],
44 [1.1, "box2", "left", 50, 5],
45 [1.5, "box2", "left", 50, 5],
46 [2.5, "box2", "left", 75, 24],
47 ];
48
49 function stop()
50 {
51 document.getElementById("box1").style.webkitAnimationPlayState = "paused ";
52 document.getElementById("box2").style.webkitAnimationPlayState = "paused ";
53 } 37 }
54 38
55 function start() 39 function log(message) {
56 { 40 var div = document.createElement('div');
57 document.getElementById("box1").style.webkitAnimationPlayState = "runnin g"; 41 div.textContent = message;
58 document.getElementById("box2").style.webkitAnimationPlayState = "runnin g"; 42 document.body.appendChild(div);
59 } 43 }
60 44
61 setTimeout(stop, 1000); 45 function logPassFail(expected, actual, id, description) {
62 setTimeout(start, 2000); 46 var didPass = expected === actual;
63 runAnimationTest(expectedValues, null, null, true); 47 log((didPass ? 'PASS' : 'FAIL') + ': Element \'' + id + '\' had ' + (didPa ss ? 'correct' : 'incorrect') + ' style ' + description);
48 }
49
50 function togglePaused() {
51 var targets = document.getElementsByClassName('target');
52 for (var i = 0; i < targets.length; ++i) {
53 targets[i].classList.toggle('paused');
54 }
55 }
56
57 var start = function() {
58 document.removeEventListener('webkitAnimationStart', start, false);
59 setTimeout(pause, 20);
60 }
61
62 var transform;
63 var left;
64 function pause() {
65 togglePaused();
66 transform = getComputedStyle(document.getElementById('translate')).webkitT ransform;
67 left = getComputedStyle(document.getElementById('left')).left;
68 setTimeout(resume, 20);
69 }
70
71 function resume() {
72 logPassFail(transform, getComputedStyle(document.getElementById('translate ')).webkitTransform, 'translate', 'when paused');
73 logPassFail(left, getComputedStyle(document.getElementById('left')).left, 'left', 'when paused');
74 togglePaused();
75 setTimeout(end, 100);
76 }
77
78 function end() {
79 logPassFail('none', getComputedStyle(document.getElementById('translate')) .webkitTransform, 'translate', 'at end');
80 logPassFail('auto', getComputedStyle(document.getElementById('left')).left , 'left', 'at end');
81 if (window.testRunner) {
82 testRunner.notifyDone();
83 }
84 }
85
86 document.addEventListener('webkitAnimationStart', start, false);
64 </script> 87 </script>
65 </head> 88 </head>
66 <body> 89 <body>
67 <p> 90 <p>
68 This tests the operation of -webkit-animation-play-state. After 2 second the box should stop and after one 91 This tests the operation of -webkit-animation-play-state. We test style
69 more second it should start again. We test it both while in motion and when stop ped. 92 while the animations are paused and once unpaused.
70 <div id="box1"> 93 </p>
71 </div> 94 <div class="target" id="translate">transform</div>
72 <div id="box2"> 95 <div class="target" id="left">left</div>
73 </div>
74 <div id="result">
75 </div>
76 </body> 96 </body>
77 </html> 97 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/animations/play-state-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698