| 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 // WindowServerDelegate: | 590 // WindowServerDelegate: |
| 591 void StartDisplayInit() override; | 591 void StartDisplayInit() override; |
| 592 void OnNoMoreDisplays() override; | 592 void OnNoMoreDisplays() override; |
| 593 std::unique_ptr<WindowTreeBinding> CreateWindowTreeBinding( | 593 std::unique_ptr<WindowTreeBinding> CreateWindowTreeBinding( |
| 594 BindingType type, | 594 BindingType type, |
| 595 ws::WindowServer* window_server, | 595 ws::WindowServer* window_server, |
| 596 ws::WindowTree* tree, | 596 ws::WindowTree* tree, |
| 597 mojom::WindowTreeRequest* tree_request, | 597 mojom::WindowTreeRequest* tree_request, |
| 598 mojom::WindowTreeClientPtr* client) override; | 598 mojom::WindowTreeClientPtr* client) override; |
| 599 bool IsTestConfig() const override; | 599 bool IsTestConfig() const override; |
| 600 void OnWillCreateTreeForWindowManager( |
| 601 bool automatically_create_display_roots) override; |
| 600 | 602 |
| 601 private: | 603 private: |
| 602 WindowServer* window_server_ = nullptr; | 604 WindowServer* window_server_ = nullptr; |
| 603 bool got_on_no_more_displays_ = false; | 605 bool got_on_no_more_displays_ = false; |
| 604 // All TestWindowTreeBinding objects created via CreateWindowTreeBinding. | 606 // All TestWindowTreeBinding objects created via CreateWindowTreeBinding. |
| 605 // These are owned by the corresponding WindowTree. | 607 // These are owned by the corresponding WindowTree. |
| 606 std::vector<TestWindowTreeBinding*> bindings_; | 608 std::vector<TestWindowTreeBinding*> bindings_; |
| 607 | 609 |
| 608 DISALLOW_COPY_AND_ASSIGN(TestWindowServerDelegate); | 610 DISALLOW_COPY_AND_ASSIGN(TestWindowServerDelegate); |
| 609 }; | 611 }; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 TestDisplayBinding* display_binding_ = nullptr; | 685 TestDisplayBinding* display_binding_ = nullptr; |
| 684 // Owned by WindowServer's DisplayManager. | 686 // Owned by WindowServer's DisplayManager. |
| 685 Display* display_ = nullptr; | 687 Display* display_ = nullptr; |
| 686 ClientSpecificId next_primary_tree_window_id_ = 1; | 688 ClientSpecificId next_primary_tree_window_id_ = 1; |
| 687 | 689 |
| 688 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper); | 690 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper); |
| 689 }; | 691 }; |
| 690 | 692 |
| 691 // ----------------------------------------------------------------------------- | 693 // ----------------------------------------------------------------------------- |
| 692 | 694 |
| 695 class TestDisplayManagerObserver : public mojom::DisplayManagerObserver { |
| 696 public: |
| 697 TestDisplayManagerObserver(); |
| 698 ~TestDisplayManagerObserver() override; |
| 699 |
| 700 mojom::DisplayManagerObserverPtr GetPtr(); |
| 701 |
| 702 std::string GetAndClearObserverCalls(); |
| 703 |
| 704 private: |
| 705 std::string DisplayIdsToString( |
| 706 const std::vector<mojom::WsDisplayPtr>& wm_displays); |
| 707 |
| 708 // mojom::DisplayManagerObserver: |
| 709 void OnDisplaysChanged(std::vector<mojom::WsDisplayPtr> displays, |
| 710 int64_t primary_display_id, |
| 711 int64_t internal_display_id) override; |
| 712 |
| 713 mojo::Binding<mojom::DisplayManagerObserver> binding_; |
| 714 std::string observer_calls_; |
| 715 |
| 716 DISALLOW_COPY_AND_ASSIGN(TestDisplayManagerObserver); |
| 717 }; |
| 718 |
| 719 // ----------------------------------------------------------------------------- |
| 720 |
| 693 // Adds a new WM to |window_server| for |user_id|. Creates | 721 // Adds a new WM to |window_server| for |user_id|. Creates |
| 694 // WindowManagerWindowTreeFactory and associated WindowTree for the WM. | 722 // WindowManagerWindowTreeFactory and associated WindowTree for the WM. |
| 695 void AddWindowManager(WindowServer* window_server, | 723 void AddWindowManager(WindowServer* window_server, |
| 696 const UserId& user_id, | 724 const UserId& user_id, |
| 697 bool automatically_create_display_roots = true); | 725 bool automatically_create_display_roots = true); |
| 698 | 726 |
| 699 // Create a new Display object with specified origin, pixel size and device | 727 // Create a new Display object with specified origin, pixel size and device |
| 700 // scale factor. The bounds size is computed based on the pixel size and device | 728 // scale factor. The bounds size is computed based on the pixel size and device |
| 701 // scale factor. | 729 // scale factor. |
| 702 display::Display MakeDisplay(int origin_x, | 730 display::Display MakeDisplay(int origin_x, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 723 ClientWindowId* client_id = nullptr); | 751 ClientWindowId* client_id = nullptr); |
| 724 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 752 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
| 725 ServerWindow* parent, | 753 ServerWindow* parent, |
| 726 ClientWindowId* client_id = nullptr); | 754 ClientWindowId* client_id = nullptr); |
| 727 | 755 |
| 728 } // namespace test | 756 } // namespace test |
| 729 } // namespace ws | 757 } // namespace ws |
| 730 } // namespace ui | 758 } // namespace ui |
| 731 | 759 |
| 732 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 760 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
| OLD | NEW |