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