| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/views/mus/views_aura_mus_test_suite.h" | 5 #include "ui/views/mus/views_mus_test_suite.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/threading/simple_thread.h" | 15 #include "base/threading/simple_thread.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 void CloneConnector(base::WaitableEvent* wait) { | 145 void CloneConnector(base::WaitableEvent* wait) { |
| 146 service_manager_connector_ = context_->connector()->Clone(); | 146 service_manager_connector_ = context_->connector()->Clone(); |
| 147 wait->Signal(); | 147 wait->Signal(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void SetUpConnections(base::WaitableEvent* wait) { | 150 void SetUpConnections(base::WaitableEvent* wait) { |
| 151 background_service_manager_ = | 151 background_service_manager_ = |
| 152 base::MakeUnique<service_manager::BackgroundServiceManager>(); | 152 base::MakeUnique<service_manager::BackgroundServiceManager>(); |
| 153 background_service_manager_->Init(nullptr); | 153 background_service_manager_->Init(nullptr); |
| 154 context_ = | 154 context_ = base::MakeUnique<service_manager::ServiceContext>( |
| 155 base::MakeUnique<service_manager::ServiceContext>( | 155 base::MakeUnique<DefaultService>(), |
| 156 base::MakeUnique<DefaultService>(), | 156 background_service_manager_->CreateServiceRequest(GetTestName())); |
| 157 background_service_manager_->CreateServiceRequest(GetTestName())); | |
| 158 | 157 |
| 159 // ui/views/mus requires a WindowManager running, so launch test_wm. | 158 // ui/views/mus requires a WindowManager running, so launch test_wm. |
| 160 service_manager::Connector* connector = context_->connector(); | 159 service_manager::Connector* connector = context_->connector(); |
| 161 connector->Connect("test_wm"); | 160 connector->Connect("test_wm"); |
| 162 service_manager_connector_ = connector->Clone(); | 161 service_manager_connector_ = connector->Clone(); |
| 163 service_manager_identity_ = context_->identity(); | 162 service_manager_identity_ = context_->identity(); |
| 164 wait->Signal(); | 163 wait->Signal(); |
| 165 } | 164 } |
| 166 | 165 |
| 167 void TearDownConnections(base::WaitableEvent* wait) { | 166 void TearDownConnections(base::WaitableEvent* wait) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 182 base::Thread thread_; | 181 base::Thread thread_; |
| 183 std::unique_ptr<service_manager::BackgroundServiceManager> | 182 std::unique_ptr<service_manager::BackgroundServiceManager> |
| 184 background_service_manager_; | 183 background_service_manager_; |
| 185 std::unique_ptr<service_manager::ServiceContext> context_; | 184 std::unique_ptr<service_manager::ServiceContext> context_; |
| 186 std::unique_ptr<service_manager::Connector> service_manager_connector_; | 185 std::unique_ptr<service_manager::Connector> service_manager_connector_; |
| 187 service_manager::Identity service_manager_identity_; | 186 service_manager::Identity service_manager_identity_; |
| 188 | 187 |
| 189 DISALLOW_COPY_AND_ASSIGN(ServiceManagerConnection); | 188 DISALLOW_COPY_AND_ASSIGN(ServiceManagerConnection); |
| 190 }; | 189 }; |
| 191 | 190 |
| 192 ViewsAuraMusTestSuite::ViewsAuraMusTestSuite(int argc, char** argv) | 191 ViewsMusTestSuite::ViewsMusTestSuite(int argc, char** argv) |
| 193 : ViewsTestSuite(argc, argv) {} | 192 : ViewsTestSuite(argc, argv) {} |
| 194 | 193 |
| 195 ViewsAuraMusTestSuite::~ViewsAuraMusTestSuite() {} | 194 ViewsMusTestSuite::~ViewsMusTestSuite() {} |
| 196 | 195 |
| 197 void ViewsAuraMusTestSuite::Initialize() { | 196 void ViewsMusTestSuite::Initialize() { |
| 198 PlatformTestHelper::SetIsMus(); | 197 PlatformTestHelper::SetIsMus(); |
| 199 // Let other services know that we're running in tests. Do this with a | 198 // Let other services know that we're running in tests. Do this with a |
| 200 // command line flag to avoid making blocking calls to other processes for | 199 // command line flag to avoid making blocking calls to other processes for |
| 201 // setup for tests (e.g. to unlock the screen in the window manager). | 200 // setup for tests (e.g. to unlock the screen in the window manager). |
| 202 EnsureCommandLineSwitch(ui::switches::kUseTestConfig); | 201 EnsureCommandLineSwitch(ui::switches::kUseTestConfig); |
| 203 | 202 |
| 204 EnsureCommandLineSwitch(switches::kOverrideUseGLWithOSMesaForTests); | 203 EnsureCommandLineSwitch(switches::kOverrideUseGLWithOSMesaForTests); |
| 205 | 204 |
| 206 ViewsTestSuite::Initialize(); | 205 ViewsTestSuite::Initialize(); |
| 207 service_manager_connections_ = base::MakeUnique<ServiceManagerConnection>(); | 206 service_manager_connections_ = base::MakeUnique<ServiceManagerConnection>(); |
| 208 } | 207 } |
| 209 | 208 |
| 210 void ViewsAuraMusTestSuite::Shutdown() { | 209 void ViewsMusTestSuite::Shutdown() { |
| 211 service_manager_connections_.reset(); | 210 service_manager_connections_.reset(); |
| 212 ViewsTestSuite::Shutdown(); | 211 ViewsTestSuite::Shutdown(); |
| 213 } | 212 } |
| 214 | 213 |
| 215 } // namespace views | 214 } // namespace views |
| OLD | NEW |