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

Side by Side Diff: third_party/WebKit/LayoutTests/animations/resources/animation-test-helpers.js

Issue 2675913003: Fix flaky compositing/reflections/nested-reflection-transition.html (Closed)
Patch Set: rebase Created 3 years, 10 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 | « third_party/WebKit/LayoutTests/TestExpectations ('k') | 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 /* This is the helper script for animation tests: 1 /* This is the helper script for animation tests:
2 2
3 Test page requirements: 3 Test page requirements:
4 - The body must contain an empty div with id "result" 4 - The body must contain an empty div with id "result"
5 - Call this function directly from the <script> inside the test page 5 - Call this function directly from the <script> inside the test page
6 6
7 runAnimationTest and runTransitionTest parameters: 7 runAnimationTest and runTransitionTest parameters:
8 expected [required]: an array of arrays defining a set of CSS properties tha t must have given values at specific times (see below) 8 expected [required]: an array of arrays defining a set of CSS properties tha t must have given values at specific times (see below)
9 callbacks [optional]: a function to be executed immediately after animation starts; 9 callbacks [optional]: a function to be executed immediately after animation starts;
10 or, an object in the form {time: function} containing functions to be 10 or, an object in the form {time: function} containing functions to be
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 if (computedNumbers.length !== expectedNumbers.length) 161 if (computedNumbers.length !== expectedNumbers.length)
162 return false; 162 return false;
163 for (var i = 0; i < expectedNumbers.length; i++) 163 for (var i = 0; i < expectedNumbers.length; i++)
164 if (!isCloseEnough(computedNumbers[i], expectedNumbers[i], tolerance)) 164 if (!isCloseEnough(computedNumbers[i], expectedNumbers[i], tolerance))
165 return false; 165 return false;
166 166
167 return true; 167 return true;
168 } 168 }
169 169
170 function waitForCompositor() {
171 return document.body.animate({opacity: [1, 1]}, 1).finished;
172 }
173
170 function endTest() 174 function endTest()
171 { 175 {
172 log('Ending test'); 176 log('Ending test');
173 var resultElement = useResultElement ? document.getElementById('result') : d ocument.documentElement; 177 var resultElement = useResultElement ? document.getElementById('result') : d ocument.documentElement;
174 if (ENABLE_ERROR_LOGGING && result.indexOf('FAIL') >= 0) 178 if (ENABLE_ERROR_LOGGING && result.indexOf('FAIL') >= 0)
175 result += '<br>Log:<br>' + logMessages.join('<br>'); 179 result += '<br>Log:<br>' + logMessages.join('<br>');
176 resultElement.innerHTML = result; 180 resultElement.innerHTML = result;
177 181
178 if (window.testRunner) 182 if (window.testRunner) {
179 testRunner.notifyDone(); 183 waitForCompositor().then(() => {
184 testRunner.notifyDone();
185 });
186 }
180 } 187 }
181 188
182 function runChecksWithRAF(checks) 189 function runChecksWithRAF(checks)
183 { 190 {
184 var finished = true; 191 var finished = true;
185 var time = performance.now() - animStartTime; 192 var time = performance.now() - animStartTime;
186 193
187 log('RAF callback, animation time: ' + time); 194 log('RAF callback, animation time: ' + time);
188 for (var k in checks) { 195 for (var k in checks) {
189 var checkTime = Number(k); 196 var checkTime = Number(k);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 var target = isTransitionsTest ? window : document; 315 var target = isTransitionsTest ? window : document;
309 var event = isTransitionsTest ? 'load' : 'webkitAnimationStart'; 316 var event = isTransitionsTest ? 'load' : 'webkitAnimationStart';
310 target.addEventListener(event, begin, false); 317 target.addEventListener(event, begin, false);
311 } 318 }
312 } 319 }
313 320
314 function runTransitionTest(expected, trigger, callbacks, doPixelTest, disablePau seAnimationAPI) { 321 function runTransitionTest(expected, trigger, callbacks, doPixelTest, disablePau seAnimationAPI) {
315 isTransitionsTest = true; 322 isTransitionsTest = true;
316 runAnimationTest(expected, callbacks, trigger, disablePauseAnimationAPI, doP ixelTest); 323 runAnimationTest(expected, callbacks, trigger, disablePauseAnimationAPI, doP ixelTest);
317 } 324 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698