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> |
| 9 |
8 #include <memory> | 10 #include <memory> |
| 11 #include <vector> |
9 | 12 |
10 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "ui/aura/test/mus/test_window_tree_client_setup.h" |
12 | 16 |
13 namespace aura { | 17 namespace aura { |
14 class Window; | 18 class Window; |
| 19 class WindowTreeClientPrivate; |
15 } // namespace aura | 20 } // namespace aura |
16 | 21 |
| 22 namespace display { |
| 23 class Display; |
| 24 } |
| 25 |
17 namespace ui { | 26 namespace ui { |
18 class ScopedAnimationDurationScaleMode; | 27 class ScopedAnimationDurationScaleMode; |
19 } // namespace ui | 28 } // namespace ui |
20 | 29 |
21 namespace wm { | 30 namespace wm { |
22 class WMState; | 31 class WMState; |
23 } | 32 } |
24 | 33 |
25 namespace ash { | 34 namespace ash { |
| 35 |
| 36 class RootWindowController; |
| 37 |
| 38 namespace mus { |
| 39 class WindowManagerApplication; |
| 40 } |
| 41 |
26 namespace test { | 42 namespace test { |
27 | 43 |
28 class AshTestEnvironment; | 44 class AshTestEnvironment; |
29 class AshTestViewsDelegate; | 45 class AshTestViewsDelegate; |
30 class TestScreenshotDelegate; | 46 class TestScreenshotDelegate; |
31 class TestShellDelegate; | 47 class TestShellDelegate; |
32 class TestSessionStateDelegate; | 48 class TestSessionStateDelegate; |
33 | 49 |
34 // A helper class that does common initialization required for Ash. Creates a | 50 // A helper class that does common initialization required for Ash. Creates a |
35 // root window and an ash::Shell instance with a test delegate. | 51 // root window and an ash::Shell instance with a test delegate. |
(...skipping 22 matching lines...) Expand all Loading... |
58 void set_test_shell_delegate(TestShellDelegate* test_shell_delegate) { | 74 void set_test_shell_delegate(TestShellDelegate* test_shell_delegate) { |
59 test_shell_delegate_ = test_shell_delegate; | 75 test_shell_delegate_ = test_shell_delegate; |
60 } | 76 } |
61 TestScreenshotDelegate* test_screenshot_delegate() { | 77 TestScreenshotDelegate* test_screenshot_delegate() { |
62 return test_screenshot_delegate_; | 78 return test_screenshot_delegate_; |
63 } | 79 } |
64 AshTestViewsDelegate* views_delegate() { return views_delegate_.get(); } | 80 AshTestViewsDelegate* views_delegate() { return views_delegate_.get(); } |
65 | 81 |
66 AshTestEnvironment* ash_test_environment() { return ash_test_environment_; } | 82 AshTestEnvironment* ash_test_environment() { return ash_test_environment_; } |
67 | 83 |
| 84 // Version of DisplayManagerTestApi::UpdateDisplay() for mash. |
| 85 void UpdateDisplayForMash(const std::string& display_spec); |
| 86 |
| 87 display::Display GetSecondaryDisplay(); |
| 88 |
68 private: | 89 private: |
| 90 // Called when running in mash to create the WindowManager. |
| 91 void CreateMashWindowManager(); |
| 92 |
| 93 // Called when running in ash to create Shell. |
| 94 void CreateShell(); |
| 95 |
| 96 // Creates a new RootWindowController based on |display_spec|. The origin is |
| 97 // set to |next_x| and on exit |next_x| is set to the origin + the width. |
| 98 RootWindowController* CreateRootWindowController( |
| 99 const std::string& display_spec, |
| 100 int* next_x); |
| 101 |
| 102 // Updates an existing display based on |display_spec|. |
| 103 void UpdateDisplay(RootWindowController* root_window_controller, |
| 104 const std::string& display_spec, |
| 105 int* next_x); |
| 106 |
| 107 std::vector<RootWindowController*> GetRootsOrderedByDisplayId(); |
| 108 |
69 AshTestEnvironment* ash_test_environment_; // Not owned. | 109 AshTestEnvironment* ash_test_environment_; // Not owned. |
70 TestShellDelegate* test_shell_delegate_; // Owned by ash::Shell. | 110 TestShellDelegate* test_shell_delegate_; // Owned by ash::Shell. |
71 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; | 111 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; |
72 | 112 |
73 // Owned by ash::AcceleratorController | 113 // Owned by ash::AcceleratorController |
74 TestScreenshotDelegate* test_screenshot_delegate_; | 114 TestScreenshotDelegate* test_screenshot_delegate_; |
75 | 115 |
76 std::unique_ptr<::wm::WMState> wm_state_; | 116 std::unique_ptr<::wm::WMState> wm_state_; |
77 std::unique_ptr<AshTestViewsDelegate> views_delegate_; | 117 std::unique_ptr<AshTestViewsDelegate> views_delegate_; |
78 | 118 |
79 // Check if DBus Thread Manager was initialized here. | 119 // Check if DBus Thread Manager was initialized here. |
80 bool dbus_thread_manager_initialized_; | 120 bool dbus_thread_manager_initialized_; |
81 // Check if Bluez DBus Manager was initialized here. | 121 // Check if Bluez DBus Manager was initialized here. |
82 bool bluez_dbus_manager_initialized_; | 122 bool bluez_dbus_manager_initialized_; |
83 | 123 |
| 124 aura::TestWindowTreeClientSetup window_tree_client_setup_; |
| 125 std::unique_ptr<mus::WindowManagerApplication> window_manager_app_; |
| 126 std::unique_ptr<aura::WindowTreeClientPrivate> window_tree_client_private_; |
| 127 // Id for the next Display created by CreateRootWindowController(). |
| 128 int64_t next_display_id_ = 1; |
| 129 |
84 DISALLOW_COPY_AND_ASSIGN(AshTestHelper); | 130 DISALLOW_COPY_AND_ASSIGN(AshTestHelper); |
85 }; | 131 }; |
86 | 132 |
87 } // namespace test | 133 } // namespace test |
88 } // namespace ash | 134 } // namespace ash |
89 | 135 |
90 #endif // ASH_TEST_ASH_TEST_HELPER_H_ | 136 #endif // ASH_TEST_ASH_TEST_HELPER_H_ |
OLD | NEW |