Index: third_party/WebKit/LayoutTests/resources/js-test.js |
diff --git a/third_party/WebKit/LayoutTests/resources/js-test.js b/third_party/WebKit/LayoutTests/resources/js-test.js |
index ba1d8acddd5a9f64898389d1ea286d6425746baf..1b44e23b8a03300cce30fba4ccda91ba2a7ca012 100644 |
--- a/third_party/WebKit/LayoutTests/resources/js-test.js |
+++ b/third_party/WebKit/LayoutTests/resources/js-test.js |
@@ -269,7 +269,7 @@ function shouldBe(_a, _b, quiet, opt_tolerance) |
testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ")."); |
} |
-// Execute condition every 5 milliseconds until it succeed or failureTime is reached. |
+// Execute condition every animation frame until it succeed or failureTime is reached. |
skobes
2015/11/06 22:30:23
"succeeds"
ymalik
2015/11/07 04:22:27
Done.
|
// completionHandler is executed on success, failureHandler is executed on timeout. |
function _waitForCondition(condition, failureTime, completionHandler, failureHandler) |
{ |
@@ -278,7 +278,9 @@ function _waitForCondition(condition, failureTime, completionHandler, failureHan |
} else if (Date.now() > failureTime) { |
failureHandler(); |
} else { |
- setTimeout(_waitForCondition, 5, condition, failureTime, completionHandler, failureHandler); |
+ window.requestAnimationFrame(function() { |
skobes
2015/11/06 22:30:23
"window." is not needed
ymalik
2015/11/07 04:22:27
Done.
|
+ _waitForCondition(condition, failureTime, completionHandler, failureHandler); |
+ }); |
} |
} |