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

Side by Side Diff: third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html

Issue 2108093002: Animations: Reduce flakiness of transitions/cancel-and-start-new.html (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2
3 <html> 2 <html>
4 <head> 3 <head>
5 <style> 4 <style>
6 #target { 5 #target {
7 position: relative; 6 position: absolute;
8 background-color: #933; 7 background-color: #933;
9 width: 50px; 8 width: 50px;
10 height: 50px; 9 height: 50px;
11 top: 0px; 10 top: 0px;
12 left: 0px; 11 left: 0px;
13 } 12 }
14 #target.transition-top { 13 #target.transition-top {
15 top: 400px; 14 top: 400px;
16 -webkit-transition: top 100ms linear; 15 transition: top 200ms linear;
17 transition: top 100ms linear;
18 } 16 }
19 #target.transition-left { 17 #target.transition-left {
20 left: 400px; 18 left: 400px;
21 -webkit-transition: left 100ms linear; 19 transition: left 200ms linear;
22 transition: left 100ms linear;
23 } 20 }
24 </style> 21 </style>
25 <script> 22 <script>
26 if (window.testRunner) { 23 if (window.testRunner) {
27 testRunner.dumpAsText(); 24 testRunner.dumpAsText();
28 testRunner.waitUntilDone(); 25 testRunner.waitUntilDone();
29 } 26 }
30 27
31 function isEqual(actual, desired, tolerance) 28 function isEqual(actual, desired, tolerance)
32 { 29 {
33 var diff = Math.abs(actual - desired); 30 var diff = Math.abs(actual - desired);
34 return diff < tolerance; 31 return diff < tolerance;
35 } 32 }
36 33
37 function cancelTransition() 34 function cancelTransition()
38 { 35 {
39 document.getElementById("target").classList.remove('transition-top') ; 36 document.getElementById("target").classList.remove('transition-top') ;
37 setTimeout(startNewTransition, 100);
40 } 38 }
41 39
42 function startNewTransition() 40 function startNewTransition()
43 { 41 {
44 document.getElementById("target").classList.add('transition-left'); 42 document.getElementById("target").classList.add('transition-left');
45 setTimeout(check, 50); 43 setTimeout(check, 100);
46 } 44 }
47 45
48 function check() 46 function check()
49 { 47 {
50 var left = parseFloat(window.getComputedStyle(document.getElementByI d('target')).left); 48 var left = parseFloat(window.getComputedStyle(document.getElementByI d('target')).left);
51 if (isEqual(left, 200, 50)) 49 if (isEqual(left, 200, 80))
52 var result = "<span style='color:green'>PASS</span>"; 50 var result = "<span style='color:green'>PASS</span>";
53 else 51 else
54 var result = "<span style='color:red'>FAIL(was: " + left + ", ex pected: 200)</span>"; 52 var result = "<span style='color:red'>FAIL(was: " + left + ", ex pected: 200)</span>";
55 document.getElementById('result').innerHTML = result; 53 document.getElementById('result').innerHTML = result;
56 if (window.testRunner) 54 if (window.testRunner)
57 testRunner.notifyDone(); 55 testRunner.notifyDone();
58 } 56 }
59 57
60 function start() 58 function start()
61 { 59 {
62 document.getElementById("target").classList.add('transition-top'); 60 document.getElementById("target").classList.add('transition-top');
63 setTimeout("cancelTransition()", 50); 61 setTimeout(cancelTransition, 100);
alancutter (OOO until 2018) 2016/06/30 04:36:20 Use internals.pauseAnimations() instead of setTime
Eric Willigers 2016/07/01 03:15:46 Done
64 setTimeout("startNewTransition()", 100);
65 } 62 }
63
64 window.onload = start;
66 </script> 65 </script>
67 </head> 66 </head>
68 <body onload="start()"> 67 <body>
69 <p> 68 <p>
70 Tests that having stopped a transition before it completes, a subsequent 69 Tests that having stopped a transition before it completes, a subsequent
71 transition starts correctly. 70 transition starts correctly.
72 </p> 71 </p>
73 <div id="target"></div> 72 <div id="target"></div>
74 <div id="result"></div> 73 <div id="result"></div>
75 </body> 74 </body>
76 </html> 75 </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