| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 bool record_on_change_completed_; | 211 bool record_on_change_completed_; |
| 212 | 212 |
| 213 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient); | 213 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient); |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 // ----------------------------------------------------------------------------- | 216 // ----------------------------------------------------------------------------- |
| 217 | 217 |
| 218 // ClientConnection implementation that vends TestWindowTreeClient. | 218 // ClientConnection implementation that vends TestWindowTreeClient. |
| 219 class TestClientConnection : public ClientConnection { | 219 class TestClientConnection : public ClientConnection { |
| 220 public: | 220 public: |
| 221 explicit TestClientConnection(scoped_ptr<WindowTreeImpl> service_impl) | 221 TestClientConnection() : ClientConnection(&client_), is_paused_(false) {} |
| 222 : ClientConnection(std::move(service_impl), &client_), | 222 ~TestClientConnection() override {} |
| 223 is_paused_(false) {} | |
| 224 | 223 |
| 225 TestWindowTreeClient* client() { return &client_; } | 224 TestWindowTreeClient* client() { return &client_; } |
| 226 | 225 |
| 227 bool is_paused() const { return is_paused_; } | 226 bool is_paused() const { return is_paused_; } |
| 228 | 227 |
| 229 // ClientConnection: | 228 // ClientConnection: |
| 230 mojom::WindowManager* GetWindowManager() override { | 229 mojom::WindowManager* GetWindowManager() override { |
| 231 NOTREACHED(); | 230 NOTREACHED(); |
| 232 return nullptr; | 231 return nullptr; |
| 233 } | 232 } |
| 234 void SetIncomingMethodCallProcessingPaused(bool paused) override { | 233 void SetIncomingMethodCallProcessingPaused(bool paused) override { |
| 235 is_paused_ = paused; | 234 is_paused_ = paused; |
| 236 } | 235 } |
| 237 | 236 |
| 238 private: | 237 private: |
| 239 ~TestClientConnection() override {} | |
| 240 | |
| 241 TestWindowTreeClient client_; | 238 TestWindowTreeClient client_; |
| 242 bool is_paused_; | 239 bool is_paused_; |
| 243 | 240 |
| 244 DISALLOW_COPY_AND_ASSIGN(TestClientConnection); | 241 DISALLOW_COPY_AND_ASSIGN(TestClientConnection); |
| 245 }; | 242 }; |
| 246 | 243 |
| 247 // ----------------------------------------------------------------------------- | 244 // ----------------------------------------------------------------------------- |
| 248 | 245 |
| 249 // Empty implementation of ConnectionManagerDelegate. | 246 // Empty implementation of ConnectionManagerDelegate. |
| 250 class TestConnectionManagerDelegate : public ConnectionManagerDelegate { | 247 class TestConnectionManagerDelegate : public ConnectionManagerDelegate { |
| 251 public: | 248 public: |
| 252 TestConnectionManagerDelegate() : last_connection_(nullptr) {} | 249 TestConnectionManagerDelegate() : last_connection_(nullptr) {} |
| 253 ~TestConnectionManagerDelegate() override {} | 250 ~TestConnectionManagerDelegate() override {} |
| 254 | 251 |
| 255 TestWindowTreeClient* last_client() { | 252 TestWindowTreeClient* last_client() { |
| 256 return last_connection_ ? last_connection_->client() : nullptr; | 253 return last_connection_ ? last_connection_->client() : nullptr; |
| 257 } | 254 } |
| 258 | 255 |
| 259 TestClientConnection* last_connection() { return last_connection_; } | 256 TestClientConnection* last_connection() { return last_connection_; } |
| 260 | 257 |
| 261 private: | 258 private: |
| 262 // ConnectionManagerDelegate: | 259 // ConnectionManagerDelegate: |
| 263 void OnNoMoreRootConnections() override {} | 260 void OnNoMoreRootConnections() override {} |
| 264 ClientConnection* CreateClientConnectionForEmbedAtWindow( | 261 scoped_ptr<ClientConnection> CreateClientConnectionForEmbedAtWindow( |
| 265 ConnectionManager* connection_manager, | 262 ws::ConnectionManager* connection_manager, |
| 266 mojo::InterfaceRequest<mus::mojom::WindowTree> service_request, | 263 ws::WindowTreeImpl* tree, |
| 267 ServerWindow* root, | 264 mojom::WindowTreeRequest tree_request, |
| 268 uint32_t policy_bitmask, | 265 mojom::WindowTreeClientPtr client) override { |
| 269 mus::mojom::WindowTreeClientPtr client) override { | 266 scoped_ptr<TestClientConnection> connection(new TestClientConnection); |
| 270 scoped_ptr<WindowTreeImpl> service( | 267 last_connection_ = connection.get(); |
| 271 new WindowTreeImpl(connection_manager, root, policy_bitmask)); | 268 return std::move(connection); |
| 272 last_connection_ = new TestClientConnection(std::move(service)); | |
| 273 return last_connection_; | |
| 274 } | |
| 275 ClientConnection* CreateClientConnectionForWindowManager( | |
| 276 WindowTreeHostImpl* tree_host, | |
| 277 ServerWindow* window, | |
| 278 const mojom::Display& display, | |
| 279 uint32_t user_id, | |
| 280 mojom::WindowManagerFactory* factory) override { | |
| 281 NOTREACHED(); | |
| 282 return nullptr; | |
| 283 } | 269 } |
| 284 void CreateDefaultWindowTreeHosts() override { NOTREACHED(); } | 270 void CreateDefaultWindowTreeHosts() override { NOTREACHED(); } |
| 285 | 271 |
| 286 TestClientConnection* last_connection_; | 272 TestClientConnection* last_connection_; |
| 287 WindowTreeHostImpl* window_tree_host_; | 273 WindowTreeHostImpl* window_tree_host_; |
| 288 | 274 |
| 289 DISALLOW_COPY_AND_ASSIGN(TestConnectionManagerDelegate); | 275 DISALLOW_COPY_AND_ASSIGN(TestConnectionManagerDelegate); |
| 290 }; | 276 }; |
| 291 | 277 |
| 292 // ----------------------------------------------------------------------------- | 278 // ----------------------------------------------------------------------------- |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 mojom_window_tree->ReleaseCapture(++change_id, | 934 mojom_window_tree->ReleaseCapture(++change_id, |
| 949 WindowIdToTransportId(root_window->id())); | 935 WindowIdToTransportId(root_window->id())); |
| 950 EXPECT_EQ(window, host->GetCaptureWindow()); | 936 EXPECT_EQ(window, host->GetCaptureWindow()); |
| 951 mojom_window_tree->ReleaseCapture(++change_id, | 937 mojom_window_tree->ReleaseCapture(++change_id, |
| 952 WindowIdToTransportId(window->id())); | 938 WindowIdToTransportId(window->id())); |
| 953 EXPECT_EQ(nullptr, host->GetCaptureWindow()); | 939 EXPECT_EQ(nullptr, host->GetCaptureWindow()); |
| 954 } | 940 } |
| 955 | 941 |
| 956 } // namespace ws | 942 } // namespace ws |
| 957 } // namespace mus | 943 } // namespace mus |
| OLD | NEW |