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

Unified Diff: mojo/public/cpp/application/lib/application_test_base.cc

Issue 792463007: Allow ApplicationTestBase clients to avoid a default MessageLoop. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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: mojo/public/cpp/application/lib/application_test_base.cc
diff --git a/mojo/public/cpp/application/lib/application_test_base.cc b/mojo/public/cpp/application/lib/application_test_base.cc
index 93eb3d0e5cf99239103c4719dad22eb191ca8edf..4ace9f566d38e5017f8ebb6225c7d14481fafa64 100644
--- a/mojo/public/cpp/application/lib/application_test_base.cc
+++ b/mojo/public/cpp/application/lib/application_test_base.cc
@@ -57,8 +57,10 @@ ApplicationDelegate* ApplicationTestBase::GetApplicationDelegate() {
}
void ApplicationTestBase::SetUpWithArgs(const Array<String>& args) {
- // A run loop is needed for ApplicationImpl initialization and communication.
- Environment::InstantiateDefaultRunLoop();
+ // A run loop is recommended for ApplicationImpl initialization and
+ // communication.
+ if (IsDefaultLoopEnabled())
msw 2014/12/16 15:40:32 Hmm, I think all the current apptests would fail w
+ Environment::InstantiateDefaultRunLoop();
// New applications are constructed for each test to avoid persisting state.
application_impl_ = new ApplicationImpl(GetApplicationDelegate(),
@@ -75,7 +77,12 @@ void ApplicationTestBase::SetUp() {
void ApplicationTestBase::TearDown() {
SetShellHandle(application_impl_->UnbindShell());
delete application_impl_;
- Environment::DestroyDefaultRunLoop();
+ if (IsDefaultLoopEnabled())
+ Environment::DestroyDefaultRunLoop();
+}
+
+bool ApplicationTestBase::IsDefaultLoopEnabled() {
+ return true;
}
} // namespace test

Powered by Google App Engine
This is Rietveld 408576698