| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TEST_UTILS_H_ | 5 #ifndef SERVICES_UI_WS_TEST_UTILS_H_ |
| 6 #define SERVICES_UI_WS_TEST_UTILS_H_ | 6 #define SERVICES_UI_WS_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 315 } |
| 316 | 316 |
| 317 void ClearAcceleratorCalled() { | 317 void ClearAcceleratorCalled() { |
| 318 on_accelerator_id_ = 0u; | 318 on_accelerator_id_ = 0u; |
| 319 on_accelerator_called_ = false; | 319 on_accelerator_called_ = false; |
| 320 } | 320 } |
| 321 | 321 |
| 322 bool on_perform_move_loop_called() { return on_perform_move_loop_called_; } | 322 bool on_perform_move_loop_called() { return on_perform_move_loop_called_; } |
| 323 bool on_accelerator_called() { return on_accelerator_called_; } | 323 bool on_accelerator_called() { return on_accelerator_called_; } |
| 324 uint32_t on_accelerator_id() { return on_accelerator_id_; } | 324 uint32_t on_accelerator_id() { return on_accelerator_id_; } |
| 325 bool got_display_removed() const { return got_display_removed_; } |
| 326 int64_t display_removed_id() const { return display_removed_id_; } |
| 325 | 327 |
| 326 private: | 328 private: |
| 327 // WindowManager: | 329 // WindowManager: |
| 328 void OnConnect(uint16_t client_id) override {} | 330 void OnConnect(uint16_t client_id) override {} |
| 329 void WmNewDisplayAdded(const display::Display& display, | 331 void WmNewDisplayAdded(const display::Display& display, |
| 330 ui::mojom::WindowDataPtr root, | 332 ui::mojom::WindowDataPtr root, |
| 331 bool drawn) override {} | 333 bool drawn) override {} |
| 334 void WmDisplayRemoved(int64_t display_id) override; |
| 332 void WmSetBounds(uint32_t change_id, | 335 void WmSetBounds(uint32_t change_id, |
| 333 uint32_t window_id, | 336 uint32_t window_id, |
| 334 const gfx::Rect& bounds) override {} | 337 const gfx::Rect& bounds) override {} |
| 335 void WmSetProperty(uint32_t change_id, | 338 void WmSetProperty(uint32_t change_id, |
| 336 uint32_t window_id, | 339 uint32_t window_id, |
| 337 const mojo::String& name, | 340 const mojo::String& name, |
| 338 mojo::Array<uint8_t> value) override {} | 341 mojo::Array<uint8_t> value) override {} |
| 339 void WmCreateTopLevelWindow( | 342 void WmCreateTopLevelWindow( |
| 340 uint32_t change_id, | 343 uint32_t change_id, |
| 341 ClientSpecificId requesting_client_id, | 344 ClientSpecificId requesting_client_id, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 352 std::unique_ptr<ui::Event> event) override; | 355 std::unique_ptr<ui::Event> event) override; |
| 353 | 356 |
| 354 bool on_perform_move_loop_called_ = false; | 357 bool on_perform_move_loop_called_ = false; |
| 355 | 358 |
| 356 bool got_create_top_level_window_; | 359 bool got_create_top_level_window_; |
| 357 uint32_t change_id_; | 360 uint32_t change_id_; |
| 358 | 361 |
| 359 bool on_accelerator_called_; | 362 bool on_accelerator_called_; |
| 360 uint32_t on_accelerator_id_; | 363 uint32_t on_accelerator_id_; |
| 361 | 364 |
| 365 bool got_display_removed_ = false; |
| 366 int64_t display_removed_id_ = 0; |
| 367 |
| 362 DISALLOW_COPY_AND_ASSIGN(TestWindowManager); | 368 DISALLOW_COPY_AND_ASSIGN(TestWindowManager); |
| 363 }; | 369 }; |
| 364 | 370 |
| 365 // ----------------------------------------------------------------------------- | 371 // ----------------------------------------------------------------------------- |
| 366 | 372 |
| 367 // WindowTreeClient implementation that logs all calls to a TestChangeTracker. | 373 // WindowTreeClient implementation that logs all calls to a TestChangeTracker. |
| 368 class TestWindowTreeClient : public ui::mojom::WindowTreeClient { | 374 class TestWindowTreeClient : public ui::mojom::WindowTreeClient { |
| 369 public: | 375 public: |
| 370 TestWindowTreeClient(); | 376 TestWindowTreeClient(); |
| 371 ~TestWindowTreeClient() override; | 377 ~TestWindowTreeClient() override; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // ----------------------------------------------------------------------------- | 471 // ----------------------------------------------------------------------------- |
| 466 | 472 |
| 467 // WindowTreeBinding implementation that vends TestWindowTreeBinding. | 473 // WindowTreeBinding implementation that vends TestWindowTreeBinding. |
| 468 class TestWindowTreeBinding : public WindowTreeBinding { | 474 class TestWindowTreeBinding : public WindowTreeBinding { |
| 469 public: | 475 public: |
| 470 explicit TestWindowTreeBinding(WindowTree* tree); | 476 explicit TestWindowTreeBinding(WindowTree* tree); |
| 471 ~TestWindowTreeBinding() override; | 477 ~TestWindowTreeBinding() override; |
| 472 | 478 |
| 473 WindowTree* tree() { return tree_; } | 479 WindowTree* tree() { return tree_; } |
| 474 TestWindowTreeClient* client() { return &client_; } | 480 TestWindowTreeClient* client() { return &client_; } |
| 481 TestWindowManager* window_manager() { return window_manager_.get(); } |
| 475 | 482 |
| 476 bool is_paused() const { return is_paused_; } | 483 bool is_paused() const { return is_paused_; } |
| 477 | 484 |
| 478 // WindowTreeBinding: | 485 // WindowTreeBinding: |
| 479 mojom::WindowManager* GetWindowManager() override; | 486 mojom::WindowManager* GetWindowManager() override; |
| 480 void SetIncomingMethodCallProcessingPaused(bool paused) override; | 487 void SetIncomingMethodCallProcessingPaused(bool paused) override; |
| 481 | 488 |
| 482 private: | 489 private: |
| 483 WindowTree* tree_; | 490 WindowTree* tree_; |
| 484 TestWindowTreeClient client_; | 491 TestWindowTreeClient client_; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 634 |
| 628 // Returns the ClientWindowId of the first root of |tree|, or an empty | 635 // Returns the ClientWindowId of the first root of |tree|, or an empty |
| 629 // ClientWindowId if |tree| has zero or more than one root. | 636 // ClientWindowId if |tree| has zero or more than one root. |
| 630 ClientWindowId FirstRootId(WindowTree* tree); | 637 ClientWindowId FirstRootId(WindowTree* tree); |
| 631 | 638 |
| 632 // Returns |tree|s ClientWindowId for |window|. | 639 // Returns |tree|s ClientWindowId for |window|. |
| 633 ClientWindowId ClientWindowIdForWindow(WindowTree* tree, | 640 ClientWindowId ClientWindowIdForWindow(WindowTree* tree, |
| 634 const ServerWindow* window); | 641 const ServerWindow* window); |
| 635 | 642 |
| 636 // Creates a new visible window as a child of the single root of |tree|. | 643 // Creates a new visible window as a child of the single root of |tree|. |
| 637 // |client_id| set to the ClientWindowId of the new window. | 644 // |client_id| is set to the ClientWindowId of the new window. |
| 638 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); | 645 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); |
| 639 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 646 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
| 640 ServerWindow* parent, | 647 ServerWindow* parent, |
| 641 ClientWindowId* client_id); | 648 ClientWindowId* client_id); |
| 642 | 649 |
| 643 } // namespace test | 650 } // namespace test |
| 644 } // namespace ws | 651 } // namespace ws |
| 645 } // namespace ui | 652 } // namespace ui |
| 646 | 653 |
| 647 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 654 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
| OLD | NEW |