| 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 ~WindowEventTargetingHelper(); | 605 ~WindowEventTargetingHelper(); |
| 606 | 606 |
| 607 // Creates |window| as an embeded window of the primary tree. This window is a | 607 // Creates |window| as an embeded window of the primary tree. This window is a |
| 608 // root window of its own tree, with bounds |window_bounds|. The bounds of the | 608 // root window of its own tree, with bounds |window_bounds|. The bounds of the |
| 609 // root window of |display_| are defined by |root_window_bounds|. | 609 // root window of |display_| are defined by |root_window_bounds|. |
| 610 ServerWindow* CreatePrimaryTree(const gfx::Rect& root_window_bounds, | 610 ServerWindow* CreatePrimaryTree(const gfx::Rect& root_window_bounds, |
| 611 const gfx::Rect& window_bounds); | 611 const gfx::Rect& window_bounds); |
| 612 // Creates a secondary tree, embedded as a child of |embed_window|. The | 612 // Creates a secondary tree, embedded as a child of |embed_window|. The |
| 613 // resulting |window| is setup for event targeting, with bounds | 613 // resulting |window| is setup for event targeting, with bounds |
| 614 // |window_bounds|. | 614 // |window_bounds|. |
| 615 // TODO(sky): rename and cleanup. This doesn't really create a new tree. |
| 615 void CreateSecondaryTree(ServerWindow* embed_window, | 616 void CreateSecondaryTree(ServerWindow* embed_window, |
| 616 const gfx::Rect& window_bounds, | 617 const gfx::Rect& window_bounds, |
| 617 TestWindowTreeClient** out_client, | 618 TestWindowTreeClient** out_client, |
| 618 WindowTree** window_tree, | 619 WindowTree** window_tree, |
| 619 ServerWindow** window); | 620 ServerWindow** window); |
| 620 // Sets the task runner for |message_loop_| | 621 // Sets the task runner for |message_loop_| |
| 621 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 622 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 622 | 623 |
| 623 mojom::Cursor cursor() const { return ws_test_helper_.cursor(); } | 624 mojom::Cursor cursor() const { return ws_test_helper_.cursor(); } |
| 624 Display* display() { return display_; } | 625 Display* display() { return display_; } |
| 625 TestWindowTreeBinding* last_binding() { | 626 TestWindowTreeBinding* last_binding() { |
| 626 return ws_test_helper_.window_server_delegate()->last_binding(); | 627 return ws_test_helper_.window_server_delegate()->last_binding(); |
| 627 } | 628 } |
| 628 TestWindowTreeClient* last_window_tree_client() { | 629 TestWindowTreeClient* last_window_tree_client() { |
| 629 return ws_test_helper_.window_server_delegate()->last_client(); | 630 return ws_test_helper_.window_server_delegate()->last_client(); |
| 630 } | 631 } |
| 631 TestWindowTreeClient* wm_client() { return wm_client_; } | 632 TestWindowTreeClient* wm_client() { return wm_client_; } |
| 632 WindowServer* window_server() { return ws_test_helper_.window_server(); } | 633 WindowServer* window_server() { return ws_test_helper_.window_server(); } |
| 633 | 634 |
| 634 private: | 635 private: |
| 635 WindowServerTestHelper ws_test_helper_; | 636 WindowServerTestHelper ws_test_helper_; |
| 636 // TestWindowTreeClient that is used for the WM client. Owned by | 637 // TestWindowTreeClient that is used for the WM client. Owned by |
| 637 // |window_server_delegate_| | 638 // |window_server_delegate_| |
| 638 TestWindowTreeClient* wm_client_ = nullptr; | 639 TestWindowTreeClient* wm_client_ = nullptr; |
| 639 // Owned by WindowServer | 640 // Owned by WindowServer |
| 640 TestDisplayBinding* display_binding_ = nullptr; | 641 TestDisplayBinding* display_binding_ = nullptr; |
| 641 // Owned by WindowServer's DisplayManager. | 642 // Owned by WindowServer's DisplayManager. |
| 642 Display* display_ = nullptr; | 643 Display* display_ = nullptr; |
| 644 ClientSpecificId next_primary_tree_window_id_ = 1; |
| 643 | 645 |
| 644 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper); | 646 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper); |
| 645 }; | 647 }; |
| 646 | 648 |
| 647 // ----------------------------------------------------------------------------- | 649 // ----------------------------------------------------------------------------- |
| 648 | 650 |
| 649 // Adds a new WM to |window_server| for |user_id|. Creates | 651 // Adds a new WM to |window_server| for |user_id|. Creates |
| 650 // WindowManagerWindowTreeFactory and associated WindowTree for the WM. | 652 // WindowManagerWindowTreeFactory and associated WindowTree for the WM. |
| 651 void AddWindowManager(WindowServer* window_server, const UserId& user_id); | 653 void AddWindowManager(WindowServer* window_server, const UserId& user_id); |
| 652 | 654 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 669 | 671 |
| 670 // Returns |tree|s ClientWindowId for |window|. | 672 // Returns |tree|s ClientWindowId for |window|. |
| 671 ClientWindowId ClientWindowIdForWindow(WindowTree* tree, | 673 ClientWindowId ClientWindowIdForWindow(WindowTree* tree, |
| 672 const ServerWindow* window); | 674 const ServerWindow* window); |
| 673 | 675 |
| 674 // Creates a new visible window as a child of the single root of |tree|. | 676 // Creates a new visible window as a child of the single root of |tree|. |
| 675 // |client_id| is set to the ClientWindowId of the new window. | 677 // |client_id| is set to the ClientWindowId of the new window. |
| 676 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); | 678 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); |
| 677 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 679 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
| 678 ServerWindow* parent, | 680 ServerWindow* parent, |
| 679 ClientWindowId* client_id); | 681 ClientWindowId* client_id = nullptr); |
| 680 | 682 |
| 681 } // namespace test | 683 } // namespace test |
| 682 } // namespace ws | 684 } // namespace ws |
| 683 } // namespace ui | 685 } // namespace ui |
| 684 | 686 |
| 685 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 687 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
| OLD | NEW |