| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding); | 254 DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding); |
| 255 }; | 255 }; |
| 256 | 256 |
| 257 // ----------------------------------------------------------------------------- | 257 // ----------------------------------------------------------------------------- |
| 258 | 258 |
| 259 // Factory that dispenses TestPlatformDisplays. | 259 // Factory that dispenses TestPlatformDisplays. |
| 260 class TestPlatformDisplayFactory : public PlatformDisplayFactory { | 260 class TestPlatformDisplayFactory : public PlatformDisplayFactory { |
| 261 public: | 261 public: |
| 262 static const int64_t kFirstDisplayId; | 262 static const int64_t kFirstDisplayId; |
| 263 | 263 |
| 264 explicit TestPlatformDisplayFactory(int32_t* cursor_id_storage); | 264 explicit TestPlatformDisplayFactory(mojom::Cursor* cursor_storage); |
| 265 ~TestPlatformDisplayFactory(); | 265 ~TestPlatformDisplayFactory(); |
| 266 | 266 |
| 267 // PlatformDisplayFactory: | 267 // PlatformDisplayFactory: |
| 268 PlatformDisplay* CreatePlatformDisplay() override; | 268 PlatformDisplay* CreatePlatformDisplay() override; |
| 269 | 269 |
| 270 private: | 270 private: |
| 271 int32_t* cursor_id_storage_; | 271 mojom::Cursor* cursor_storage_; |
| 272 int64_t next_display_id_; | 272 int64_t next_display_id_; |
| 273 | 273 |
| 274 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory); | 274 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory); |
| 275 }; | 275 }; |
| 276 | 276 |
| 277 // ----------------------------------------------------------------------------- | 277 // ----------------------------------------------------------------------------- |
| 278 | 278 |
| 279 // A stub implementation of FrameGeneratorDelegate. | 279 // A stub implementation of FrameGeneratorDelegate. |
| 280 class TestFrameGeneratorDelegate : public FrameGeneratorDelegate { | 280 class TestFrameGeneratorDelegate : public FrameGeneratorDelegate { |
| 281 public: | 281 public: |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 // ----------------------------------------------------------------------------- | 568 // ----------------------------------------------------------------------------- |
| 569 | 569 |
| 570 // Helper class which creates and sets up the necessary objects for tests that | 570 // Helper class which creates and sets up the necessary objects for tests that |
| 571 // use the WindowServer. | 571 // use the WindowServer. |
| 572 class WindowServerTestHelper { | 572 class WindowServerTestHelper { |
| 573 public: | 573 public: |
| 574 WindowServerTestHelper(); | 574 WindowServerTestHelper(); |
| 575 ~WindowServerTestHelper(); | 575 ~WindowServerTestHelper(); |
| 576 | 576 |
| 577 WindowServer* window_server() { return window_server_.get(); } | 577 WindowServer* window_server() { return window_server_.get(); } |
| 578 int32_t cursor_id() const { return cursor_id_; } | 578 mojom::Cursor cursor() const { return cursor_id_; } |
| 579 | 579 |
| 580 TestWindowServerDelegate* window_server_delegate() { | 580 TestWindowServerDelegate* window_server_delegate() { |
| 581 return &window_server_delegate_; | 581 return &window_server_delegate_; |
| 582 } | 582 } |
| 583 base::MessageLoop* message_loop() { return &message_loop_; } | 583 base::MessageLoop* message_loop() { return &message_loop_; } |
| 584 | 584 |
| 585 private: | 585 private: |
| 586 int32_t cursor_id_; | 586 mojom::Cursor cursor_id_; |
| 587 TestPlatformDisplayFactory platform_display_factory_; | 587 TestPlatformDisplayFactory platform_display_factory_; |
| 588 TestWindowServerDelegate window_server_delegate_; | 588 TestWindowServerDelegate window_server_delegate_; |
| 589 std::unique_ptr<WindowServer> window_server_; | 589 std::unique_ptr<WindowServer> window_server_; |
| 590 base::MessageLoop message_loop_; | 590 base::MessageLoop message_loop_; |
| 591 | 591 |
| 592 DISALLOW_COPY_AND_ASSIGN(WindowServerTestHelper); | 592 DISALLOW_COPY_AND_ASSIGN(WindowServerTestHelper); |
| 593 }; | 593 }; |
| 594 | 594 |
| 595 // ----------------------------------------------------------------------------- | 595 // ----------------------------------------------------------------------------- |
| 596 | 596 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 610 // resulting |window| is setup for event targeting, with bounds | 610 // resulting |window| is setup for event targeting, with bounds |
| 611 // |window_bounds|. | 611 // |window_bounds|. |
| 612 void CreateSecondaryTree(ServerWindow* embed_window, | 612 void CreateSecondaryTree(ServerWindow* embed_window, |
| 613 const gfx::Rect& window_bounds, | 613 const gfx::Rect& window_bounds, |
| 614 TestWindowTreeClient** out_client, | 614 TestWindowTreeClient** out_client, |
| 615 WindowTree** window_tree, | 615 WindowTree** window_tree, |
| 616 ServerWindow** window); | 616 ServerWindow** window); |
| 617 // Sets the task runner for |message_loop_| | 617 // Sets the task runner for |message_loop_| |
| 618 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 618 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 619 | 619 |
| 620 int32_t cursor_id() const { return ws_test_helper_.cursor_id(); } | 620 mojom::Cursor cursor() const { return ws_test_helper_.cursor(); } |
| 621 Display* display() { return display_; } | 621 Display* display() { return display_; } |
| 622 TestWindowTreeBinding* last_binding() { | 622 TestWindowTreeBinding* last_binding() { |
| 623 return ws_test_helper_.window_server_delegate()->last_binding(); | 623 return ws_test_helper_.window_server_delegate()->last_binding(); |
| 624 } | 624 } |
| 625 TestWindowTreeClient* last_window_tree_client() { | 625 TestWindowTreeClient* last_window_tree_client() { |
| 626 return ws_test_helper_.window_server_delegate()->last_client(); | 626 return ws_test_helper_.window_server_delegate()->last_client(); |
| 627 } | 627 } |
| 628 TestWindowTreeClient* wm_client() { return wm_client_; } | 628 TestWindowTreeClient* wm_client() { return wm_client_; } |
| 629 WindowServer* window_server() { return ws_test_helper_.window_server(); } | 629 WindowServer* window_server() { return ws_test_helper_.window_server(); } |
| 630 | 630 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 661 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); | 661 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); |
| 662 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 662 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
| 663 ServerWindow* parent, | 663 ServerWindow* parent, |
| 664 ClientWindowId* client_id); | 664 ClientWindowId* client_id); |
| 665 | 665 |
| 666 } // namespace test | 666 } // namespace test |
| 667 } // namespace ws | 667 } // namespace ws |
| 668 } // namespace ui | 668 } // namespace ui |
| 669 | 669 |
| 670 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 670 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
| OLD | NEW |