| 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 18 matching lines...) Expand all Loading... |
| 29 #include "services/ui/ws/window_server_delegate.h" | 29 #include "services/ui/ws/window_server_delegate.h" |
| 30 #include "services/ui/ws/window_tree.h" | 30 #include "services/ui/ws/window_tree.h" |
| 31 #include "services/ui/ws/window_tree_binding.h" | 31 #include "services/ui/ws/window_tree_binding.h" |
| 32 | 32 |
| 33 namespace ui { | 33 namespace ui { |
| 34 namespace ws { | 34 namespace ws { |
| 35 namespace test { | 35 namespace test { |
| 36 | 36 |
| 37 // Collection of utilities useful in creating mus tests. | 37 // Collection of utilities useful in creating mus tests. |
| 38 | 38 |
| 39 class WindowManagerWindowTreeFactorySetTestApi { | |
| 40 public: | |
| 41 explicit WindowManagerWindowTreeFactorySetTestApi( | |
| 42 WindowManagerWindowTreeFactorySet* | |
| 43 window_manager_window_tree_factory_set); | |
| 44 ~WindowManagerWindowTreeFactorySetTestApi(); | |
| 45 | |
| 46 void Add(const UserId& user_id); | |
| 47 | |
| 48 private: | |
| 49 WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowTreeFactorySetTestApi); | |
| 52 }; | |
| 53 | |
| 54 // ----------------------------------------------------------------------------- | |
| 55 | |
| 56 class UserDisplayManagerTestApi { | 39 class UserDisplayManagerTestApi { |
| 57 public: | 40 public: |
| 58 explicit UserDisplayManagerTestApi(UserDisplayManager* udm) : udm_(udm) {} | 41 explicit UserDisplayManagerTestApi(UserDisplayManager* udm) : udm_(udm) {} |
| 59 ~UserDisplayManagerTestApi() {} | 42 ~UserDisplayManagerTestApi() {} |
| 60 | 43 |
| 61 void SetTestObserver(mojom::DisplayManagerObserver* observer) { | 44 void SetTestObserver(mojom::DisplayManagerObserver* observer) { |
| 62 udm_->test_observer_ = observer; | 45 udm_->test_observer_ = observer; |
| 63 if (observer) | 46 if (observer) |
| 64 udm_->OnObserverAdded(observer); | 47 udm_->OnObserverAdded(observer); |
| 65 } | 48 } |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 TestDisplayBinding* display_binding_; | 614 TestDisplayBinding* display_binding_; |
| 632 // Owned by WindowServer's DisplayManager. | 615 // Owned by WindowServer's DisplayManager. |
| 633 Display* display_; | 616 Display* display_; |
| 634 scoped_refptr<DisplayCompositor> display_compositor_; | 617 scoped_refptr<DisplayCompositor> display_compositor_; |
| 635 | 618 |
| 636 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper); | 619 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper); |
| 637 }; | 620 }; |
| 638 | 621 |
| 639 // ----------------------------------------------------------------------------- | 622 // ----------------------------------------------------------------------------- |
| 640 | 623 |
| 624 // Adds a new WM to |window_server| for |user_id|. Creates |
| 625 // WindowManagerWindowTreeFactory and associated WindowTree for the WM. |
| 626 void AddWindowManager(WindowServer* window_server, const UserId& user_id); |
| 627 |
| 641 // Returns the first and only root of |tree|. If |tree| has zero or more than | 628 // Returns the first and only root of |tree|. If |tree| has zero or more than |
| 642 // one root returns null. | 629 // one root returns null. |
| 643 ServerWindow* FirstRoot(WindowTree* tree); | 630 ServerWindow* FirstRoot(WindowTree* tree); |
| 644 | 631 |
| 645 // Returns the ClientWindowId of the first root of |tree|, or an empty | 632 // Returns the ClientWindowId of the first root of |tree|, or an empty |
| 646 // ClientWindowId if |tree| has zero or more than one root. | 633 // ClientWindowId if |tree| has zero or more than one root. |
| 647 ClientWindowId FirstRootId(WindowTree* tree); | 634 ClientWindowId FirstRootId(WindowTree* tree); |
| 648 | 635 |
| 649 // Returns |tree|s ClientWindowId for |window|. | 636 // Returns |tree|s ClientWindowId for |window|. |
| 650 ClientWindowId ClientWindowIdForWindow(WindowTree* tree, | 637 ClientWindowId ClientWindowIdForWindow(WindowTree* tree, |
| 651 const ServerWindow* window); | 638 const ServerWindow* window); |
| 652 | 639 |
| 653 // Creates a new visible window as a child of the single root of |tree|. | 640 // Creates a new visible window as a child of the single root of |tree|. |
| 654 // |client_id| is set to the ClientWindowId of the new window. | 641 // |client_id| is set to the ClientWindowId of the new window. |
| 655 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); | 642 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); |
| 656 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 643 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
| 657 ServerWindow* parent, | 644 ServerWindow* parent, |
| 658 ClientWindowId* client_id); | 645 ClientWindowId* client_id); |
| 659 | 646 |
| 660 } // namespace test | 647 } // namespace test |
| 661 } // namespace ws | 648 } // namespace ws |
| 662 } // namespace ui | 649 } // namespace ui |
| 663 | 650 |
| 664 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 651 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
| OLD | NEW |