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

Unified Diff: chrome/test/base/ui_test_utils.cc

Issue 1412963003: Plugin Power Saver: Implement pixel tests for plugin placeholders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix behavior on slow cros bots Created 5 years, 2 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
Index: chrome/test/base/ui_test_utils.cc
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index cfa65023b18a41a1567aad26b6d5e500621cb714..53cbd29787484bb547695eb4d5b0d8e6c76f3b83 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -405,6 +405,23 @@ void GetCookies(const GURL& url,
}
}
+bool RunLoopUntil(const base::Callback<bool()>& condition) {
+ const base::TimeTicks start_time = base::TimeTicks::Now();
+ while (!condition.Run()) {
+ const base::TimeTicks current_time = base::TimeTicks::Now();
+ if (current_time - start_time > base::TimeDelta::FromSeconds(5)) {
Lei Zhang 2015/10/21 07:24:52 Didn't some other test have a 10 second timeout? D
tommycli 2015/10/21 18:16:04 Yeah, one of them did. The ConstrainedDialog* test
+ ADD_FAILURE() << "Condition not met within five seconds.";
+ return false;
+ }
+
+ base::MessageLoop::current()->task_runner()->PostDelayedTask(
+ FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
+ base::TimeDelta::FromMilliseconds(20));
+ content::RunMessageLoop();
+ }
+ return true;
+}
+
WindowedTabAddedNotificationObserver::WindowedTabAddedNotificationObserver(
const content::NotificationSource& source)
: WindowedNotificationObserver(chrome::NOTIFICATION_TAB_ADDED, source),

Powered by Google App Engine
This is Rietveld 408576698