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

Unified Diff: content/test/test_navigation_observer.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win_shared build Created 8 years, 6 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: content/test/test_navigation_observer.cc
diff --git a/content/test/test_navigation_observer.cc b/content/test/test_navigation_observer.cc
index 89ff36fd575feb8ec98c98463596d8c7442c5a2e..fa572708e6ff1d09534e75d7a79bbb2d3122c51b 100644
--- a/content/test/test_navigation_observer.cc
+++ b/content/test/test_navigation_observer.cc
@@ -84,11 +84,13 @@ void TestNavigationObserver::WaitForObservation(
}
void TestNavigationObserver::Wait() {
+ MessageLoop::RunID run_id = MessageLoop::current()->GetRunID();
WaitForObservation(
- base::Bind(&MessageLoop::Run,
- base::Unretained(MessageLoop::current())),
- base::Bind(&MessageLoop::Quit,
- base::Unretained(MessageLoop::current())));
+ base::Bind(&MessageLoop::RunWithID,
+ base::Unretained(MessageLoop::current()), run_id),
+ base::Bind(&MessageLoop::PostTask,
+ base::Unretained(MessageLoop::current()),
+ FROM_HERE, MessageLoop::QuitNowWithIDClosure(run_id)));
}
TestNavigationObserver::TestNavigationObserver(
@@ -131,8 +133,10 @@ void TestNavigationObserver::Observe(
++navigations_completed_ == number_of_navigations_) {
navigation_started_ = false;
done_ = true;
- if (running_)
+ if (running_) {
+ running_ = false;
done_callback_.Run();
+ }
}
break;
case NOTIFICATION_RENDER_VIEW_HOST_CREATED:
« chrome/test/base/bookmark_load_observer.h ('K') | « chrome/test/perf/rendering/throughput_tests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698