| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_ | 5 #ifndef SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_ |
| 6 #define SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_ | 6 #define SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "services/service_manager/public/cpp/interface_factory.h" | 12 #include "services/service_manager/public/cpp/interface_factory.h" |
| 13 #include "services/ui/public/interfaces/window_tree.mojom.h" | 13 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 14 #include "services/ui/ws/window_server_service_test_base.h" | 14 #include "services/ui/ws/window_server_service_test_base.h" |
| 15 #include "ui/aura/mus/property_converter.h" | 15 #include "ui/aura/mus/property_converter.h" |
| 16 #include "ui/aura/mus/window_manager_delegate.h" | 16 #include "ui/aura/mus/window_manager_delegate.h" |
| 17 #include "ui/aura/mus/window_tree_client_delegate.h" | 17 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 18 #include "ui/display/screen_base.h" | 18 #include "ui/display/screen_base.h" |
| 19 #include "ui/wm/core/wm_state.h" | 19 #include "ui/wm/core/wm_state.h" |
| 20 | 20 |
| 21 namespace aura { | 21 namespace aura { |
| 22 class Env; | 22 class Env; |
| 23 class MusContextFactory; | |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace ui { | 25 namespace ui { |
| 27 class Gpu; | |
| 28 | 26 |
| 29 // WindowServerTestBase is a base class for use with shell tests that use | 27 // WindowServerTestBase is a base class for use with shell tests that use |
| 30 // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed() | 28 // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed() |
| 31 // has been invoked. window_manager() can be used to access the WindowServer | 29 // has been invoked. window_manager() can be used to access the WindowServer |
| 32 // established as part of SetUp(). | 30 // established as part of SetUp(). |
| 33 class WindowServerTestBase | 31 class WindowServerTestBase |
| 34 : public WindowServerServiceTestBase, | 32 : public WindowServerServiceTestBase, |
| 35 public aura::WindowTreeClientDelegate, | 33 public aura::WindowTreeClientDelegate, |
| 36 public aura::WindowManagerDelegate, | 34 public aura::WindowManagerDelegate, |
| 37 public service_manager::InterfaceFactory<mojom::WindowTreeClient> { | 35 public service_manager::InterfaceFactory<mojom::WindowTreeClient> { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Removes |window_tree_host| from |window_tree_hosts_| and deletes it. | 126 // Removes |window_tree_host| from |window_tree_hosts_| and deletes it. |
| 129 // Returns true on success, and false if not found, in which case | 127 // Returns true on success, and false if not found, in which case |
| 130 // |window_tree_host| is not deleted. | 128 // |window_tree_host| is not deleted. |
| 131 bool DeleteWindowTreeHost(aura::WindowTreeHostMus* window_tree_host); | 129 bool DeleteWindowTreeHost(aura::WindowTreeHostMus* window_tree_host); |
| 132 | 130 |
| 133 std::unique_ptr<aura::Env> env_; | 131 std::unique_ptr<aura::Env> env_; |
| 134 ::wm::WMState wm_state_; | 132 ::wm::WMState wm_state_; |
| 135 display::ScreenBase screen_; | 133 display::ScreenBase screen_; |
| 136 aura::PropertyConverter property_converter_; | 134 aura::PropertyConverter property_converter_; |
| 137 | 135 |
| 138 std::unique_ptr<Gpu> gpu_; | |
| 139 std::unique_ptr<aura::MusContextFactory> compositor_context_factory_; | |
| 140 | |
| 141 std::vector<std::unique_ptr<aura::WindowTreeClient>> window_tree_clients_; | 136 std::vector<std::unique_ptr<aura::WindowTreeClient>> window_tree_clients_; |
| 142 | 137 |
| 143 std::vector<std::unique_ptr<aura::WindowTreeHostMus>> window_tree_hosts_; | 138 std::vector<std::unique_ptr<aura::WindowTreeHostMus>> window_tree_hosts_; |
| 144 | 139 |
| 145 // The window server connection held by the window manager (app running at | 140 // The window server connection held by the window manager (app running at |
| 146 // the root window). | 141 // the root window). |
| 147 aura::WindowTreeClient* window_manager_ = nullptr; | 142 aura::WindowTreeClient* window_manager_ = nullptr; |
| 148 | 143 |
| 149 // A test can override the WM-related behaviour by installing its own | 144 // A test can override the WM-related behaviour by installing its own |
| 150 // WindowManagerDelegate during the test. | 145 // WindowManagerDelegate during the test. |
| 151 aura::WindowManagerDelegate* window_manager_delegate_ = nullptr; | 146 aura::WindowManagerDelegate* window_manager_delegate_ = nullptr; |
| 152 | 147 |
| 153 aura::WindowManagerClient* window_manager_client_ = nullptr; | 148 aura::WindowManagerClient* window_manager_client_ = nullptr; |
| 154 | 149 |
| 155 bool window_tree_client_lost_connection_ = false; | 150 bool window_tree_client_lost_connection_ = false; |
| 156 | 151 |
| 157 DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase); | 152 DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase); |
| 158 }; | 153 }; |
| 159 | 154 |
| 160 } // namespace ui | 155 } // namespace ui |
| 161 | 156 |
| 162 #endif // SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_ | 157 #endif // SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_ |
| OLD | NEW |