| 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 COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/mus/public/cpp/tests/window_server_shelltest_base.h" |
| 10 #include "components/mus/public/cpp/window_manager_delegate.h" | 11 #include "components/mus/public/cpp/window_manager_delegate.h" |
| 11 #include "components/mus/public/cpp/window_tree_delegate.h" | 12 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 12 #include "components/mus/public/interfaces/window_tree.mojom.h" | 13 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 13 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 14 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
| 14 #include "mojo/shell/public/cpp/application_test_base.h" | |
| 15 #include "mojo/shell/public/cpp/interface_factory.h" | 15 #include "mojo/shell/public/cpp/interface_factory.h" |
| 16 | 16 |
| 17 namespace mus { | 17 namespace mus { |
| 18 | 18 |
| 19 // WindowServerTestBase is a base class for use with app tests that use | 19 // WindowServerTestBase is a base class for use with shell tests that use |
| 20 // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed() | 20 // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed() |
| 21 // has been invoked. window_manager() can be used to access the WindowServer | 21 // has been invoked. window_manager() can be used to access the WindowServer |
| 22 // established as part of SetUp(). | 22 // established as part of SetUp(). |
| 23 class WindowServerTestBase | 23 class WindowServerTestBase |
| 24 : public mojo::test::ApplicationTestBase, | 24 : public WindowServerShellTestBase, |
| 25 public mojo::ShellClient, | |
| 26 public WindowTreeDelegate, | 25 public WindowTreeDelegate, |
| 27 public WindowManagerDelegate, | 26 public WindowManagerDelegate, |
| 28 public mojo::InterfaceFactory<mojom::WindowTreeClient> { | 27 public mojo::InterfaceFactory<mojom::WindowTreeClient> { |
| 29 public: | 28 public: |
| 30 WindowServerTestBase(); | 29 WindowServerTestBase(); |
| 31 ~WindowServerTestBase() override; | 30 ~WindowServerTestBase() override; |
| 32 | 31 |
| 33 // True if WindowTreeDelegate::OnConnectionLost() was called. | 32 // True if WindowTreeDelegate::OnConnectionLost() was called. |
| 34 bool window_tree_connection_destroyed() const { | 33 bool window_tree_connection_destroyed() const { |
| 35 return window_tree_connection_destroyed_; | 34 return window_tree_connection_destroyed_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 55 return most_recent_connection_; | 54 return most_recent_connection_; |
| 56 } | 55 } |
| 57 | 56 |
| 58 void set_window_manager_delegate(WindowManagerDelegate* delegate) { | 57 void set_window_manager_delegate(WindowManagerDelegate* delegate) { |
| 59 window_manager_delegate_ = delegate; | 58 window_manager_delegate_ = delegate; |
| 60 } | 59 } |
| 61 | 60 |
| 62 // testing::Test: | 61 // testing::Test: |
| 63 void SetUp() override; | 62 void SetUp() override; |
| 64 | 63 |
| 65 // test::ApplicationTestBase: | 64 // WindowServerShellTestBase: |
| 66 mojo::ShellClient* GetShellClient() override; | |
| 67 | |
| 68 // mojo::ShellClient: | |
| 69 bool AcceptConnection(mojo::Connection* connection) override; | 65 bool AcceptConnection(mojo::Connection* connection) override; |
| 70 | 66 |
| 71 // WindowTreeDelegate: | 67 // WindowTreeDelegate: |
| 72 void OnEmbed(Window* root) override; | 68 void OnEmbed(Window* root) override; |
| 73 void OnConnectionLost(WindowTreeConnection* connection) override; | 69 void OnConnectionLost(WindowTreeConnection* connection) override; |
| 74 | 70 |
| 75 // WindowManagerDelegate: | 71 // WindowManagerDelegate: |
| 76 void SetWindowManagerClient(WindowManagerClient* client) override; | 72 void SetWindowManagerClient(WindowManagerClient* client) override; |
| 77 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; | 73 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; |
| 78 bool OnWmSetProperty(Window* window, | 74 bool OnWmSetProperty(Window* window, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 WindowManagerClient* window_manager_client_; | 100 WindowManagerClient* window_manager_client_; |
| 105 | 101 |
| 106 bool window_tree_connection_destroyed_; | 102 bool window_tree_connection_destroyed_; |
| 107 | 103 |
| 108 DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase); | 104 DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase); |
| 109 }; | 105 }; |
| 110 | 106 |
| 111 } // namespace mus | 107 } // namespace mus |
| 112 | 108 |
| 113 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ | 109 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ |
| OLD | NEW |