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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js

Issue 1999243002: Import wpt@5df9b57edb3307a87d5187804b29c8ddd2aa14e1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add expectations files (using run-webkit-tests --new-baseline) Created 4 years, 7 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
1 /* 1 /*
2 Distributed under both the W3C Test Suite License [1] and the W3C 2 Distributed under both the W3C Test Suite License [1] and the W3C
3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
4 policies and contribution forms [3]. 4 policies and contribution forms [3].
5 5
6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
8 [3] http://www.w3.org/2004/10/27-testcases 8 [3] http://www.w3.org/2004/10/27-testcases
9 */ 9 */
10 10
11 "use strict"; 11 'use strict';
12
12 var MS_PER_SEC = 1000; 13 var MS_PER_SEC = 1000;
13 14
15 // The recommended minimum precision to use for time values[1].
16 //
17 // [1] https://w3c.github.io/web-animations/#precision-of-time-values
18 var TIME_PRECISION = 0.0005; // ms
19
20 // Allow implementations to substitute an alternative method for comparing
21 // times based on their precision requirements.
22 if (!window.assert_times_equal) {
23 window.assert_times_equal = function(actual, expected, description) {
24 assert_approx_equals(actual, expected, TIME_PRECISION, description);
25 }
26 }
27
14 // creates div element, appends it to the document body and 28 // creates div element, appends it to the document body and
15 // removes the created element during test cleanup 29 // removes the created element during test cleanup
16 function createDiv(test, doc) { 30 function createDiv(test, doc) {
17 if (!doc) { 31 if (!doc) {
18 doc = document; 32 doc = document;
19 } 33 }
20 var div = doc.createElement('div'); 34 var div = doc.createElement('div');
21 doc.body.appendChild(div); 35 doc.body.appendChild(div);
22 test.add_cleanup(function() { 36 test.add_cleanup(function() {
23 div.remove(); 37 div.remove();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 function handleFrame() { 144 function handleFrame() {
131 if (--frameCount <= 0) { 145 if (--frameCount <= 0) {
132 resolve(); 146 resolve();
133 } else { 147 } else {
134 window.requestAnimationFrame(handleFrame); // wait another frame 148 window.requestAnimationFrame(handleFrame); // wait another frame
135 } 149 }
136 } 150 }
137 window.requestAnimationFrame(handleFrame); 151 window.requestAnimationFrame(handleFrame);
138 }); 152 });
139 } 153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698