OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/application/public/cpp/application_test_base.h" | 5 #include "mojo/application/public/cpp/application_test_base.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "mojo/application/public/cpp/application_impl.h" | 9 #include "mojo/application/public/cpp/application_impl.h" |
10 #include "mojo/application/public/interfaces/application.mojom.h" | 10 #include "mojo/application/public/interfaces/application.mojom.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 Environment::InstantiateDefaultRunLoop(); | 123 Environment::InstantiateDefaultRunLoop(); |
124 | 124 |
125 MOJO_CHECK(g_application_request.is_pending()); | 125 MOJO_CHECK(g_application_request.is_pending()); |
126 MOJO_CHECK(g_shell); | 126 MOJO_CHECK(g_shell); |
127 | 127 |
128 // New applications are constructed for each test to avoid persisting state. | 128 // New applications are constructed for each test to avoid persisting state. |
129 application_impl_ = new ApplicationImpl(GetApplicationDelegate(), | 129 application_impl_ = new ApplicationImpl(GetApplicationDelegate(), |
130 g_application_request.Pass()); | 130 g_application_request.Pass()); |
131 | 131 |
132 // Fake application initialization. | 132 // Fake application initialization. |
133 application_impl_->Initialize(g_shell.Pass(), g_url); | 133 Application* application = application_impl_; |
| 134 application->Initialize(g_shell.Pass(), g_url); |
134 } | 135 } |
135 | 136 |
136 void ApplicationTestBase::TearDown() { | 137 void ApplicationTestBase::TearDown() { |
137 MOJO_CHECK(!g_application_request.is_pending()); | 138 MOJO_CHECK(!g_application_request.is_pending()); |
138 MOJO_CHECK(!g_shell); | 139 MOJO_CHECK(!g_shell); |
139 | 140 |
140 application_impl_->UnbindConnections(&g_application_request, &g_shell); | 141 { |
| 142 ApplicationImpl::TestApi test_api(application_impl_); |
| 143 test_api.UnbindConnections(&g_application_request, &g_shell); |
| 144 } |
141 delete application_impl_; | 145 delete application_impl_; |
142 if (ShouldCreateDefaultRunLoop()) | 146 if (ShouldCreateDefaultRunLoop()) |
143 Environment::DestroyDefaultRunLoop(); | 147 Environment::DestroyDefaultRunLoop(); |
144 } | 148 } |
145 | 149 |
146 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { | 150 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { |
147 return true; | 151 return true; |
148 } | 152 } |
149 | 153 |
150 | 154 |
151 } // namespace test | 155 } // namespace test |
152 } // namespace mojo | 156 } // namespace mojo |
OLD | NEW |