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

Unified Diff: chromeos/dbus/services/service_provider_test_helper.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 8 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: chromeos/dbus/services/service_provider_test_helper.cc
diff --git a/chromeos/dbus/services/service_provider_test_helper.cc b/chromeos/dbus/services/service_provider_test_helper.cc
index c4c5c654d51b4c7c105e03ab91dc5f0bc0abc4a4..9b701728e8879cef51ee2210289557d5f1589257 100644
--- a/chromeos/dbus/services/service_provider_test_helper.cc
+++ b/chromeos/dbus/services/service_provider_test_helper.cc
@@ -20,6 +20,8 @@ namespace chromeos {
ServiceProviderTestHelper::ServiceProviderTestHelper()
: response_received_(false) {
+ if (!base::MessageLoop::current())
+ message_loop_.reset(new base::MessageLoop());
}
ServiceProviderTestHelper::~ServiceProviderTestHelper() {
@@ -129,7 +131,7 @@ dbus::Response* ServiceProviderTestHelper::MockCallMethodAndBlock(
base::Unretained(this)));
// Check for a response.
if (!response_received_)
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
// Return response.
return response_.release();
}
@@ -155,8 +157,8 @@ void ServiceProviderTestHelper::OnResponse(
scoped_ptr<dbus::Response> response) {
response_ = response.Pass();
response_received_ = true;
- if (message_loop_.is_running())
- message_loop_.Quit();
+ if (base::MessageLoop::current()->is_running())
+ base::MessageLoop::current()->Quit();
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698