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; | |
msw
2017/03/30 23:06:05
optional nit: order before RootWindowController?
sky
2017/03/30 23:35:46
I actually prefer separating them out and there do
| |
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; |
55 class AshTestSuite; | |
msw
2017/03/30 23:06:05
optional nit: technically, I don't think this fwd
| |
47 class AshTestViewsDelegate; | 56 class AshTestViewsDelegate; |
48 class TestScreenshotDelegate; | 57 class TestScreenshotDelegate; |
49 class TestShellDelegate; | 58 class TestShellDelegate; |
50 class TestSessionControllerClient; | 59 class TestSessionControllerClient; |
51 class TestSessionStateDelegate; | 60 class TestSessionStateDelegate; |
52 | 61 |
53 // A helper class that does common initialization required for Ash. Creates a | 62 // A helper class that does common initialization required for Ash. Creates a |
54 // root window and an ash::Shell instance with a test delegate. | 63 // root window and an ash::Shell instance with a test delegate. |
55 class AshTestHelper { | 64 class AshTestHelper { |
56 public: | 65 public: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 105 |
97 TestSessionControllerClient* test_session_controller_client() { | 106 TestSessionControllerClient* test_session_controller_client() { |
98 return session_controller_client_.get(); | 107 return session_controller_client_.get(); |
99 } | 108 } |
100 void set_test_session_controller_client( | 109 void set_test_session_controller_client( |
101 std::unique_ptr<TestSessionControllerClient> session_controller_client) { | 110 std::unique_ptr<TestSessionControllerClient> session_controller_client) { |
102 session_controller_client_ = std::move(session_controller_client); | 111 session_controller_client_ = std::move(session_controller_client); |
103 } | 112 } |
104 | 113 |
105 private: | 114 private: |
115 // The two TestSuites need to manipulate |config_|. | |
msw
2017/03/30 23:06:05
nit: These? optionally expose |config_for_testing(
sky
2017/03/30 23:35:46
They need to set config_, which I would like to re
| |
116 friend class AshTestSuite; | |
117 friend class mash::test::MashTestSuite; | |
118 | |
106 // Called when running in mash to create the WindowManager. | 119 // Called when running in mash to create the WindowManager. |
107 void CreateMashWindowManager(); | 120 void CreateMashWindowManager(); |
108 | 121 |
109 // Called when running in ash to create Shell. | 122 // Called when running in ash to create Shell. |
110 void CreateShell(); | 123 void CreateShell(); |
111 | 124 |
112 // Creates a new RootWindowController based on |display_spec|. The origin is | 125 // 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. | 126 // set to |next_x| and on exit |next_x| is set to the origin + the width. |
114 RootWindowController* CreateRootWindowController( | 127 RootWindowController* CreateRootWindowController( |
115 const std::string& display_spec, | 128 const std::string& display_spec, |
116 int* next_x); | 129 int* next_x); |
117 | 130 |
118 // Updates an existing display based on |display_spec|. | 131 // Updates an existing display based on |display_spec|. |
119 void UpdateDisplay(RootWindowController* root_window_controller, | 132 void UpdateDisplay(RootWindowController* root_window_controller, |
120 const std::string& display_spec, | 133 const std::string& display_spec, |
121 int* next_x); | 134 int* next_x); |
122 | 135 |
123 std::vector<RootWindowController*> GetRootsOrderedByDisplayId(); | 136 std::vector<RootWindowController*> GetRootsOrderedByDisplayId(); |
124 | 137 |
138 static Config config_; | |
139 | |
125 AshTestEnvironment* ash_test_environment_; // Not owned. | 140 AshTestEnvironment* ash_test_environment_; // Not owned. |
126 TestShellDelegate* test_shell_delegate_; // Owned by ash::Shell. | 141 TestShellDelegate* test_shell_delegate_; // Owned by ash::Shell. |
127 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; | 142 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; |
128 | 143 |
129 // Owned by ash::AcceleratorController | 144 // Owned by ash::AcceleratorController. |
130 TestScreenshotDelegate* test_screenshot_delegate_; | 145 TestScreenshotDelegate* test_screenshot_delegate_; |
131 | 146 |
132 std::unique_ptr<::wm::WMState> wm_state_; | 147 std::unique_ptr<::wm::WMState> wm_state_; |
133 std::unique_ptr<AshTestViewsDelegate> views_delegate_; | 148 std::unique_ptr<AshTestViewsDelegate> views_delegate_; |
134 | 149 |
135 // Check if DBus Thread Manager was initialized here. | 150 // Check if DBus Thread Manager was initialized here. |
136 bool dbus_thread_manager_initialized_; | 151 bool dbus_thread_manager_initialized_; |
137 // Check if Bluez DBus Manager was initialized here. | 152 // Check if Bluez DBus Manager was initialized here. |
138 bool bluez_dbus_manager_initialized_; | 153 bool bluez_dbus_manager_initialized_; |
139 | 154 |
140 aura::TestWindowTreeClientSetup window_tree_client_setup_; | 155 aura::TestWindowTreeClientSetup window_tree_client_setup_; |
141 std::unique_ptr<mus::WindowManagerApplication> window_manager_app_; | 156 std::unique_ptr<mus::WindowManagerApplication> window_manager_app_; |
142 std::unique_ptr<aura::WindowTreeClientPrivate> window_tree_client_private_; | 157 std::unique_ptr<aura::WindowTreeClientPrivate> window_tree_client_private_; |
143 // Id for the next Display created by CreateRootWindowController(). | 158 // Id for the next Display created by CreateRootWindowController(). |
144 int64_t next_display_id_ = 1; | 159 int64_t next_display_id_ = 1; |
145 | 160 |
146 std::unique_ptr<TestSessionControllerClient> session_controller_client_; | 161 std::unique_ptr<TestSessionControllerClient> session_controller_client_; |
147 | 162 |
148 DISALLOW_COPY_AND_ASSIGN(AshTestHelper); | 163 DISALLOW_COPY_AND_ASSIGN(AshTestHelper); |
149 }; | 164 }; |
150 | 165 |
151 } // namespace test | 166 } // namespace test |
152 } // namespace ash | 167 } // namespace ash |
153 | 168 |
154 #endif // ASH_TEST_ASH_TEST_HELPER_H_ | 169 #endif // ASH_TEST_ASH_TEST_HELPER_H_ |
OLD | NEW |