| 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() {
|
|
|