Index: third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js b/third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js |
index e375a0f8741788984f9c7be658a3b88c7396c0ff..31ebdfaf279deca00ef5384fd7d347e1cf00e8e1 100644 |
--- a/third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js |
@@ -158,3 +158,19 @@ function waitForAnimationFrames(frameCount) { |
window.requestAnimationFrame(handleFrame); |
}); |
} |
+ |
+// Continually calls requestAnimationFrame until |minDelay| has elapsed |
+// as recorded using document.timeline.currentTime (i.e. frame time not |
+// wall-clock time). |
+function waitForAnimationFramesWithDelay(minDelay) { |
+ var startTime = document.timeline.currentTime; |
+ return new Promise(function(resolve) { |
+ (function handleFrame() { |
+ if (document.timeline.currentTime - startTime >= minDelay) { |
+ resolve(); |
+ } else { |
+ window.requestAnimationFrame(handleFrame); |
+ } |
+ }()); |
+ }); |
+} |