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

Unified Diff: content/test/data/media/mediarecorder_test_utils.js

Issue 2868933003: Make waitFor check predicate before logging slowness. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/mediarecorder_test_utils.js
diff --git a/content/test/data/media/mediarecorder_test_utils.js b/content/test/data/media/mediarecorder_test_utils.js
index 400b19e6cc7c72b6e00f5585dbb50ad1fe9f2792..1cec7a7df6b363100e3ef174e85e16f3cf0f1f36 100644
--- a/content/test/data/media/mediarecorder_test_utils.js
+++ b/content/test/data/media/mediarecorder_test_utils.js
@@ -22,13 +22,13 @@ function waitFor(description, predicate) {
console.log('Waiting for', description.toString());
var check = setInterval(function() {
var elapsed = new Date() - startTime;
- if (elapsed > 3000) {
+ if (predicate()) {
+ clearInterval(check);
+ resolve();
+ } else if (elapsed > 3000) {
startTime = new Date();
console.log('Still waiting for satisfaction of ' +
predicate.toString());
- } else if (predicate()) {
- clearInterval(check);
- resolve();
}
}, 50);
});
« 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