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

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

Issue 1728063002: Revert of mojo: Delay ApplicationTestBase shell disconnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « mojo/shell/public/cpp/application_test_base.h ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/public/cpp/lib/application_test_base.cc
diff --git a/mojo/shell/public/cpp/lib/application_test_base.cc b/mojo/shell/public/cpp/lib/application_test_base.cc
index a6d253df908cbc5335d103d7db8e39347168774f..f9a726dbf2c752e033d1e331ba1d9d8d0ac06338 100644
--- a/mojo/shell/public/cpp/lib/application_test_base.cc
+++ b/mojo/shell/public/cpp/lib/application_test_base.cc
@@ -135,16 +135,9 @@
shell_connection_.reset();
}
-ApplicationTestBase::ApplicationTestBase() {}
+ApplicationTestBase::ApplicationTestBase() : test_helper_(nullptr) {}
ApplicationTestBase::~ApplicationTestBase() {
- CHECK(!g_shell_client_request.is_pending());
- CHECK(!g_shell);
-
- test_helper_.reset();
-
- if (use_default_run_loop_)
- Environment::DestroyDefaultRunLoop();
}
ShellClient* ApplicationTestBase::GetShellClient() {
@@ -154,12 +147,8 @@
void ApplicationTestBase::SetUp() {
// A run loop is recommended for ShellConnection initialization and
// communication.
- // Check this in SetUp() instead of in the constructor because we cannot call
- // virtual methods in the constructor.
- if (ShouldCreateDefaultRunLoop()) {
- use_default_run_loop_ = true;
+ if (ShouldCreateDefaultRunLoop())
Environment::InstantiateDefaultRunLoop();
- }
CHECK(g_shell_client_request.is_pending());
CHECK(g_shell);
@@ -169,6 +158,13 @@
}
void ApplicationTestBase::TearDown() {
+ CHECK(!g_shell_client_request.is_pending());
+ CHECK(!g_shell);
+
+ test_helper_.reset();
+
+ if (ShouldCreateDefaultRunLoop())
+ Environment::DestroyDefaultRunLoop();
}
bool ApplicationTestBase::ShouldCreateDefaultRunLoop() {
« no previous file with comments | « mojo/shell/public/cpp/application_test_base.h ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698