| 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_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "services/shell/public/cpp/interface_factory.h" | 11 #include "services/shell/public/cpp/interface_factory.h" |
| 12 #include "services/ui/public/cpp/tests/window_server_shelltest_base.h" | 12 #include "services/ui/public/cpp/tests/window_server_shelltest_base.h" |
| 13 #include "services/ui/public/cpp/window_manager_delegate.h" | 13 #include "services/ui/public/cpp/window_manager_delegate.h" |
| 14 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 14 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
| 15 #include "services/ui/public/interfaces/window_tree.mojom.h" | 15 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 16 #include "services/ui/public/interfaces/window_tree_host.mojom.h" | 16 #include "services/ui/public/interfaces/window_tree_host.mojom.h" |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 // WindowServerTestBase is a base class for use with shell tests that use | 20 // WindowServerTestBase is a base class for use with shell tests that use |
| 21 // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed() | 21 // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed() |
| 22 // has been invoked. window_manager() can be used to access the WindowServer | 22 // has been invoked. window_manager() can be used to access the WindowServer |
| 23 // established as part of SetUp(). | 23 // established as part of SetUp(). |
| 24 class WindowServerTestBase | 24 class WindowServerTestBase |
| 25 : public WindowServerShellTestBase, | 25 : public WindowServerServiceTestBase, |
| 26 public WindowTreeClientDelegate, | 26 public WindowTreeClientDelegate, |
| 27 public WindowManagerDelegate, | 27 public WindowManagerDelegate, |
| 28 public shell::InterfaceFactory<mojom::WindowTreeClient> { | 28 public shell::InterfaceFactory<mojom::WindowTreeClient> { |
| 29 public: | 29 public: |
| 30 WindowServerTestBase(); | 30 WindowServerTestBase(); |
| 31 ~WindowServerTestBase() override; | 31 ~WindowServerTestBase() override; |
| 32 | 32 |
| 33 // True if WindowTreeClientDelegate::OnDidDestroyClient() was called. | 33 // True if WindowTreeClientDelegate::OnDidDestroyClient() was called. |
| 34 bool window_tree_client_destroyed() const { | 34 bool window_tree_client_destroyed() const { |
| 35 return window_tree_client_destroyed_; | 35 return window_tree_client_destroyed_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 55 return most_recent_client_; | 55 return most_recent_client_; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void set_window_manager_delegate(WindowManagerDelegate* delegate) { | 58 void set_window_manager_delegate(WindowManagerDelegate* delegate) { |
| 59 window_manager_delegate_ = delegate; | 59 window_manager_delegate_ = delegate; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // testing::Test: | 62 // testing::Test: |
| 63 void SetUp() override; | 63 void SetUp() override; |
| 64 | 64 |
| 65 // WindowServerShellTestBase: | 65 // WindowServerServiceTestBase: |
| 66 bool OnConnect(shell::Connection* connection) override; | 66 bool OnConnect(shell::Connection* connection) override; |
| 67 | 67 |
| 68 // WindowTreeClientDelegate: | 68 // WindowTreeClientDelegate: |
| 69 void OnEmbed(Window* root) override; | 69 void OnEmbed(Window* root) override; |
| 70 void OnDidDestroyClient(WindowTreeClient* client) override; | 70 void OnDidDestroyClient(WindowTreeClient* client) override; |
| 71 void OnEventObserved(const ui::Event& event, Window* target) override; | 71 void OnEventObserved(const ui::Event& event, Window* target) override; |
| 72 | 72 |
| 73 // WindowManagerDelegate: | 73 // WindowManagerDelegate: |
| 74 void SetWindowManagerClient(WindowManagerClient* client) override; | 74 void SetWindowManagerClient(WindowManagerClient* client) override; |
| 75 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; | 75 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 106 WindowManagerClient* window_manager_client_; | 106 WindowManagerClient* window_manager_client_; |
| 107 | 107 |
| 108 bool window_tree_client_destroyed_; | 108 bool window_tree_client_destroyed_; |
| 109 | 109 |
| 110 DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase); | 110 DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace ui | 113 } // namespace ui |
| 114 | 114 |
| 115 #endif // SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ | 115 #endif // SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ |
| OLD | NEW |