OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef ASH_TEST_ASH_TEST_HELPER_H_ | 5 #ifndef ASH_TEST_ASH_TEST_HELPER_H_ |
6 #define ASH_TEST_ASH_TEST_HELPER_H_ | 6 #define ASH_TEST_ASH_TEST_HELPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "ash/common/test/test_session_controller_client.h" | 14 #include "ash/common/test/test_session_controller_client.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "ui/aura/test/mus/test_window_tree_client_setup.h" | 17 #include "ui/aura/test/mus/test_window_tree_client_setup.h" |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 class Window; | 20 class Window; |
21 class WindowTreeClientPrivate; | 21 class WindowTreeClientPrivate; |
22 } // namespace aura | 22 } // namespace aura |
23 | 23 |
24 namespace display { | 24 namespace display { |
25 class Display; | 25 class Display; |
26 } | 26 } |
27 | 27 |
| 28 namespace mash { |
| 29 namespace test { |
| 30 class MashTestSuite; |
| 31 } |
| 32 } |
| 33 |
28 namespace ui { | 34 namespace ui { |
29 class ScopedAnimationDurationScaleMode; | 35 class ScopedAnimationDurationScaleMode; |
30 } // namespace ui | 36 } // namespace ui |
31 | 37 |
32 namespace wm { | 38 namespace wm { |
33 class WMState; | 39 class WMState; |
34 } | 40 } |
35 | 41 |
36 namespace ash { | 42 namespace ash { |
37 | 43 |
38 class RootWindowController; | 44 class RootWindowController; |
39 | 45 |
| 46 enum class Config; |
| 47 |
40 namespace mus { | 48 namespace mus { |
41 class WindowManagerApplication; | 49 class WindowManagerApplication; |
42 } | 50 } |
43 | 51 |
44 namespace test { | 52 namespace test { |
45 | 53 |
46 class AshTestEnvironment; | 54 class AshTestEnvironment; |
47 class AshTestViewsDelegate; | 55 class AshTestViewsDelegate; |
48 class TestScreenshotDelegate; | 56 class TestScreenshotDelegate; |
49 class TestShellDelegate; | 57 class TestShellDelegate; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 104 |
97 TestSessionControllerClient* test_session_controller_client() { | 105 TestSessionControllerClient* test_session_controller_client() { |
98 return session_controller_client_.get(); | 106 return session_controller_client_.get(); |
99 } | 107 } |
100 void set_test_session_controller_client( | 108 void set_test_session_controller_client( |
101 std::unique_ptr<TestSessionControllerClient> session_controller_client) { | 109 std::unique_ptr<TestSessionControllerClient> session_controller_client) { |
102 session_controller_client_ = std::move(session_controller_client); | 110 session_controller_client_ = std::move(session_controller_client); |
103 } | 111 } |
104 | 112 |
105 private: | 113 private: |
| 114 // These TestSuites need to manipulate |config_|. |
| 115 friend class AshTestSuite; |
| 116 friend class mash::test::MashTestSuite; |
| 117 |
106 // Called when running in mash to create the WindowManager. | 118 // Called when running in mash to create the WindowManager. |
107 void CreateMashWindowManager(); | 119 void CreateMashWindowManager(); |
108 | 120 |
109 // Called when running in ash to create Shell. | 121 // Called when running in ash to create Shell. |
110 void CreateShell(); | 122 void CreateShell(); |
111 | 123 |
112 // Creates a new RootWindowController based on |display_spec|. The origin is | 124 // Creates a new RootWindowController based on |display_spec|. The origin is |
113 // set to |next_x| and on exit |next_x| is set to the origin + the width. | 125 // set to |next_x| and on exit |next_x| is set to the origin + the width. |
114 RootWindowController* CreateRootWindowController( | 126 RootWindowController* CreateRootWindowController( |
115 const std::string& display_spec, | 127 const std::string& display_spec, |
116 int* next_x); | 128 int* next_x); |
117 | 129 |
118 // Updates an existing display based on |display_spec|. | 130 // Updates an existing display based on |display_spec|. |
119 void UpdateDisplay(RootWindowController* root_window_controller, | 131 void UpdateDisplay(RootWindowController* root_window_controller, |
120 const std::string& display_spec, | 132 const std::string& display_spec, |
121 int* next_x); | 133 int* next_x); |
122 | 134 |
123 std::vector<RootWindowController*> GetRootsOrderedByDisplayId(); | 135 std::vector<RootWindowController*> GetRootsOrderedByDisplayId(); |
124 | 136 |
| 137 static Config config_; |
| 138 |
125 AshTestEnvironment* ash_test_environment_; // Not owned. | 139 AshTestEnvironment* ash_test_environment_; // Not owned. |
126 TestShellDelegate* test_shell_delegate_; // Owned by ash::Shell. | 140 TestShellDelegate* test_shell_delegate_; // Owned by ash::Shell. |
127 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; | 141 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; |
128 | 142 |
129 // Owned by ash::AcceleratorController | 143 // Owned by ash::AcceleratorController. |
130 TestScreenshotDelegate* test_screenshot_delegate_; | 144 TestScreenshotDelegate* test_screenshot_delegate_; |
131 | 145 |
132 std::unique_ptr<::wm::WMState> wm_state_; | 146 std::unique_ptr<::wm::WMState> wm_state_; |
133 std::unique_ptr<AshTestViewsDelegate> views_delegate_; | 147 std::unique_ptr<AshTestViewsDelegate> views_delegate_; |
134 | 148 |
135 // Check if DBus Thread Manager was initialized here. | 149 // Check if DBus Thread Manager was initialized here. |
136 bool dbus_thread_manager_initialized_; | 150 bool dbus_thread_manager_initialized_; |
137 // Check if Bluez DBus Manager was initialized here. | 151 // Check if Bluez DBus Manager was initialized here. |
138 bool bluez_dbus_manager_initialized_; | 152 bool bluez_dbus_manager_initialized_; |
139 | 153 |
140 aura::TestWindowTreeClientSetup window_tree_client_setup_; | 154 aura::TestWindowTreeClientSetup window_tree_client_setup_; |
141 std::unique_ptr<mus::WindowManagerApplication> window_manager_app_; | 155 std::unique_ptr<mus::WindowManagerApplication> window_manager_app_; |
142 std::unique_ptr<aura::WindowTreeClientPrivate> window_tree_client_private_; | 156 std::unique_ptr<aura::WindowTreeClientPrivate> window_tree_client_private_; |
143 // Id for the next Display created by CreateRootWindowController(). | 157 // Id for the next Display created by CreateRootWindowController(). |
144 int64_t next_display_id_ = 1; | 158 int64_t next_display_id_ = 1; |
145 | 159 |
146 std::unique_ptr<TestSessionControllerClient> session_controller_client_; | 160 std::unique_ptr<TestSessionControllerClient> session_controller_client_; |
147 | 161 |
148 DISALLOW_COPY_AND_ASSIGN(AshTestHelper); | 162 DISALLOW_COPY_AND_ASSIGN(AshTestHelper); |
149 }; | 163 }; |
150 | 164 |
151 } // namespace test | 165 } // namespace test |
152 } // namespace ash | 166 } // namespace ash |
153 | 167 |
154 #endif // ASH_TEST_ASH_TEST_HELPER_H_ | 168 #endif // ASH_TEST_ASH_TEST_HELPER_H_ |
OLD | NEW |