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 "ui/views/mus/views_mus_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 "components/mus/common/gpu_service.h" |
15 #include "components/mus/common/switches.h" | 16 #include "components/mus/common/switches.h" |
16 #include "services/shell/background/background_shell.h" | 17 #include "services/shell/background/background_shell.h" |
17 #include "services/shell/public/cpp/connector.h" | 18 #include "services/shell/public/cpp/connector.h" |
18 #include "services/shell/public/cpp/shell_client.h" | 19 #include "services/shell/public/cpp/shell_client.h" |
19 #include "services/shell/public/cpp/shell_connection.h" | 20 #include "services/shell/public/cpp/shell_connection.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "ui/views/mus/window_manager_connection.h" | 22 #include "ui/views/mus/window_manager_connection.h" |
22 #include "ui/views/test/platform_test_helper.h" | 23 #include "ui/views/test/platform_test_helper.h" |
23 #include "ui/views/views_delegate.h" | 24 #include "ui/views/views_delegate.h" |
24 | 25 |
(...skipping 12 matching lines...) Expand all Loading... |
37 ~DefaultShellClient() override {} | 38 ~DefaultShellClient() override {} |
38 | 39 |
39 private: | 40 private: |
40 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); | 41 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); |
41 }; | 42 }; |
42 | 43 |
43 class PlatformTestHelperMus : public PlatformTestHelper { | 44 class PlatformTestHelperMus : public PlatformTestHelper { |
44 public: | 45 public: |
45 PlatformTestHelperMus(shell::Connector* connector, | 46 PlatformTestHelperMus(shell::Connector* connector, |
46 const shell::Identity& identity) { | 47 const shell::Identity& identity) { |
| 48 mus::GpuService::Initialize(connector); |
47 // It is necessary to recreate the WindowManagerConnection for each test, | 49 // It is necessary to recreate the WindowManagerConnection for each test, |
48 // since a new MessageLoop is created for each test. | 50 // since a new MessageLoop is created for each test. |
49 connection_ = WindowManagerConnection::Create(connector, identity); | 51 connection_ = WindowManagerConnection::Create(connector, identity); |
50 } | 52 } |
51 ~PlatformTestHelperMus() override {} | 53 ~PlatformTestHelperMus() override { |
| 54 mus::GpuService::Terminate(); |
| 55 } |
52 | 56 |
53 private: | 57 private: |
54 std::unique_ptr<WindowManagerConnection> connection_; | 58 std::unique_ptr<WindowManagerConnection> connection_; |
55 | 59 |
56 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); | 60 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); |
57 }; | 61 }; |
58 | 62 |
59 std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper( | 63 std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper( |
60 const shell::Identity& identity, | 64 const shell::Identity& identity, |
61 const base::Callback<shell::Connector*(void)>& callback) { | 65 const base::Callback<shell::Connector*(void)>& callback) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ViewsTestSuite::Initialize(); | 172 ViewsTestSuite::Initialize(); |
169 shell_connections_.reset(new ShellConnection); | 173 shell_connections_.reset(new ShellConnection); |
170 } | 174 } |
171 | 175 |
172 void ViewsMusTestSuite::Shutdown() { | 176 void ViewsMusTestSuite::Shutdown() { |
173 shell_connections_.reset(); | 177 shell_connections_.reset(); |
174 ViewsTestSuite::Shutdown(); | 178 ViewsTestSuite::Shutdown(); |
175 } | 179 } |
176 | 180 |
177 } // namespace views | 181 } // namespace views |
OLD | NEW |