Chromium Code Reviews| 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_mus_test_suite.h" | 5 #include "views_chrome_test_suite.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/threading/simple_thread.h" | 13 #include "base/threading/simple_thread.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "services/shell/background/background_shell.h" | 15 #include "services/shell/background/background_shell.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 std::unique_ptr<WindowManagerConnection> connection_; | 54 std::unique_ptr<WindowManagerConnection> connection_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); | 56 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper( | 59 std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper( |
| 60 const shell::Identity& identity, | 60 const shell::Identity& identity, |
| 61 const base::Callback<shell::Connector*(void)>& callback) { | 61 const base::Callback<shell::Connector*(void)>& callback) { |
| 62 return base::MakeUnique<PlatformTestHelperMus>(callback.Run(), identity); | 62 return base::MakeUnique<PlatformTestHelperMus>(callback.Run(), identity); |
|
mfomitchev
2016/10/18 23:50:42
Can you add a LOG here so that we can tell if this
thanhph
2016/10/19 00:02:06
I just did. Binary unit_tests ran through this lin
| |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 class ShellConnection { | 67 class ShellConnection { |
| 68 public: | 68 public: |
| 69 ShellConnection() : thread_("Persistent shell connections") { | 69 ShellConnection() : thread_("Persistent shell connections") { |
| 70 base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 70 base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 71 base::WaitableEvent::InitialState::NOT_SIGNALED); | 71 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 72 base::Thread::Options options; | 72 base::Thread::Options options; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 base::Thread thread_; | 146 base::Thread thread_; |
| 147 std::unique_ptr<shell::BackgroundShell> background_shell_; | 147 std::unique_ptr<shell::BackgroundShell> background_shell_; |
| 148 std::unique_ptr<shell::ServiceContext> shell_connection_; | 148 std::unique_ptr<shell::ServiceContext> shell_connection_; |
| 149 std::unique_ptr<DefaultService> service_; | 149 std::unique_ptr<DefaultService> service_; |
| 150 std::unique_ptr<shell::Connector> shell_connector_; | 150 std::unique_ptr<shell::Connector> shell_connector_; |
| 151 shell::Identity shell_identity_; | 151 shell::Identity shell_identity_; |
| 152 | 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(ShellConnection); | 153 DISALLOW_COPY_AND_ASSIGN(ShellConnection); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 ViewsMusTestSuite::ViewsMusTestSuite(int argc, char** argv) | 156 ViewsChromeTestSuite::ViewsChromeTestSuite(int argc, char** argv) |
| 157 : ViewsTestSuite(argc, argv) {} | 157 : ViewsTestSuite(argc, argv) {} |
| 158 | 158 |
| 159 ViewsMusTestSuite::~ViewsMusTestSuite() {} | 159 ViewsChromeTestSuite::~ViewsChromeTestSuite() {} |
| 160 | 160 |
| 161 void ViewsMusTestSuite::Initialize() { | 161 void ViewsChromeTestSuite::Initialize() { |
| 162 PlatformTestHelper::SetIsMus(); | 162 PlatformTestHelper::SetIsMus(); |
| 163 // Let other mojo apps know that we're running in tests. Do this with a | 163 // Let other mojo apps know that we're running in tests. Do this with a |
| 164 // command line flag to avoid making blocking calls to other processes for | 164 // command line flag to avoid making blocking calls to other processes for |
| 165 // setup for tests (e.g. to unlock the screen in the window manager). | 165 // setup for tests (e.g. to unlock the screen in the window manager). |
| 166 EnsureCommandLineSwitch(ui::switches::kUseTestConfig); | 166 EnsureCommandLineSwitch(ui::switches::kUseTestConfig); |
| 167 | 167 |
| 168 ViewsTestSuite::Initialize(); | 168 ViewsTestSuite::Initialize(); |
| 169 shell_connections_.reset(new ShellConnection); | 169 shell_connections_.reset(new ShellConnection); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void ViewsMusTestSuite::Shutdown() { | 172 void ViewsChromeTestSuite::Shutdown() { |
| 173 shell_connections_.reset(); | 173 shell_connections_.reset(); |
| 174 ViewsTestSuite::Shutdown(); | 174 ViewsTestSuite::Shutdown(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace views | 177 } // namespace views |
| OLD | NEW |