Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: components/mus/public/cpp/tests/window_server_test_base.h

Issue 1675083002: Rename ApplicationDelegate to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/mus_app.cc ('k') | components/mus/public/cpp/tests/window_server_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/window_manager_delegate.h" 10 #include "components/mus/public/cpp/window_manager_delegate.h"
11 #include "components/mus/public/cpp/window_tree_delegate.h" 11 #include "components/mus/public/cpp/window_tree_delegate.h"
12 #include "components/mus/public/interfaces/window_tree.mojom.h" 12 #include "components/mus/public/interfaces/window_tree.mojom.h"
13 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 13 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
14 #include "mojo/shell/public/cpp/application_delegate.h"
15 #include "mojo/shell/public/cpp/application_test_base.h" 14 #include "mojo/shell/public/cpp/application_test_base.h"
16 #include "mojo/shell/public/cpp/interface_factory.h" 15 #include "mojo/shell/public/cpp/interface_factory.h"
17 16
18 namespace mus { 17 namespace mus {
19 18
20 // WindowServerTestBase is a base class for use with app tests that use 19 // WindowServerTestBase is a base class for use with app tests that use
21 // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed() 20 // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed()
22 // 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
23 // established as part of SetUp(). 22 // established as part of SetUp().
24 class WindowServerTestBase 23 class WindowServerTestBase
25 : public mojo::test::ApplicationTestBase, 24 : public mojo::test::ApplicationTestBase,
26 public mojo::ApplicationDelegate, 25 public mojo::ShellClient,
27 public WindowTreeDelegate, 26 public WindowTreeDelegate,
28 public WindowManagerDelegate, 27 public WindowManagerDelegate,
29 public mojo::InterfaceFactory<mojom::WindowTreeClient> { 28 public mojo::InterfaceFactory<mojom::WindowTreeClient> {
30 public: 29 public:
31 WindowServerTestBase(); 30 WindowServerTestBase();
32 ~WindowServerTestBase() override; 31 ~WindowServerTestBase() override;
33 32
34 // True if WindowTreeDelegate::OnConnectionLost() was called. 33 // True if WindowTreeDelegate::OnConnectionLost() was called.
35 bool window_tree_connection_destroyed() const { 34 bool window_tree_connection_destroyed() const {
36 return window_tree_connection_destroyed_; 35 return window_tree_connection_destroyed_;
(...skipping 20 matching lines...) Expand all
57 } 56 }
58 57
59 void set_window_manager_delegate(WindowManagerDelegate* delegate) { 58 void set_window_manager_delegate(WindowManagerDelegate* delegate) {
60 window_manager_delegate_ = delegate; 59 window_manager_delegate_ = delegate;
61 } 60 }
62 61
63 // testing::Test: 62 // testing::Test:
64 void SetUp() override; 63 void SetUp() override;
65 64
66 // test::ApplicationTestBase: 65 // test::ApplicationTestBase:
67 mojo::ApplicationDelegate* GetApplicationDelegate() override; 66 mojo::ShellClient* GetShellClient() override;
68 67
69 // ApplicationDelegate: 68 // mojo::ShellClient:
70 bool AcceptConnection( 69 bool AcceptConnection(mojo::Connection* connection) override;
71 mojo::ApplicationConnection* connection) override;
72 70
73 // WindowTreeDelegate: 71 // WindowTreeDelegate:
74 void OnEmbed(Window* root) override; 72 void OnEmbed(Window* root) override;
75 void OnConnectionLost(WindowTreeConnection* connection) override; 73 void OnConnectionLost(WindowTreeConnection* connection) override;
76 74
77 // WindowManagerDelegate: 75 // WindowManagerDelegate:
78 void SetWindowManagerClient(WindowManagerClient* client) override; 76 void SetWindowManagerClient(WindowManagerClient* client) override;
79 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; 77 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override;
80 bool OnWmSetProperty(Window* window, 78 bool OnWmSetProperty(Window* window,
81 const std::string& name, 79 const std::string& name,
82 scoped_ptr<std::vector<uint8_t>>* new_data) override; 80 scoped_ptr<std::vector<uint8_t>>* new_data) override;
83 Window* OnWmCreateTopLevelWindow( 81 Window* OnWmCreateTopLevelWindow(
84 std::map<std::string, std::vector<uint8_t>>* properties) override; 82 std::map<std::string, std::vector<uint8_t>>* properties) override;
85 void OnAccelerator(uint32_t id, mojom::EventPtr event) override; 83 void OnAccelerator(uint32_t id, mojom::EventPtr event) override;
86 84
87 // InterfaceFactory<WindowTreeClient>: 85 // InterfaceFactory<WindowTreeClient>:
88 void Create(mojo::ApplicationConnection* connection, 86 void Create(mojo::Connection* connection,
89 mojo::InterfaceRequest<mojom::WindowTreeClient> request) override; 87 mojo::InterfaceRequest<mojom::WindowTreeClient> request) override;
90 88
91 // Used to receive the most recent window tree connection loaded by an embed 89 // Used to receive the most recent window tree connection loaded by an embed
92 // action. 90 // action.
93 WindowTreeConnection* most_recent_connection_; 91 WindowTreeConnection* most_recent_connection_;
94 92
95 private: 93 private:
96 mojom::WindowTreeHostPtr host_; 94 mojom::WindowTreeHostPtr host_;
97 95
98 // The window server connection held by the window manager (app running at 96 // The window server connection held by the window manager (app running at
99 // the root window). 97 // the root window).
100 WindowTreeConnection* window_manager_; 98 WindowTreeConnection* window_manager_;
101 99
102 // A test can override the WM-related behaviour by installing its own 100 // A test can override the WM-related behaviour by installing its own
103 // WindowManagerDelegate during the test. 101 // WindowManagerDelegate during the test.
104 WindowManagerDelegate* window_manager_delegate_; 102 WindowManagerDelegate* window_manager_delegate_;
105 103
106 WindowManagerClient* window_manager_client_; 104 WindowManagerClient* window_manager_client_;
107 105
108 bool window_tree_connection_destroyed_; 106 bool window_tree_connection_destroyed_;
109 107
110 MOJO_DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase); 108 MOJO_DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase);
111 }; 109 };
112 110
113 } // namespace mus 111 } // namespace mus
114 112
115 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_ 113 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_
OLDNEW
« no previous file with comments | « components/mus/mus_app.cc ('k') | components/mus/public/cpp/tests/window_server_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698