Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1030)

Side by Side Diff: services/ui/ws/test_utils.h

Issue 2736943003: Start to decouple display::Display from ws::PlatformDisplay. (Closed)
Patch Set: Fix comments. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/ui/ws/platform_display_init_params.cc ('k') | services/ui/ws/test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // reset when Init() is called. 48 // reset when Init() is called.
49 class TestScreenManager : public display::ScreenManager { 49 class TestScreenManager : public display::ScreenManager {
50 public: 50 public:
51 TestScreenManager(); 51 TestScreenManager();
52 ~TestScreenManager() override; 52 ~TestScreenManager() override;
53 53
54 // Adds a new display with default metrics, generates a unique display id and 54 // Adds a new display with default metrics, generates a unique display id and
55 // returns it. Calls OnDisplayAdded() on delegate. 55 // returns it. Calls OnDisplayAdded() on delegate.
56 int64_t AddDisplay(); 56 int64_t AddDisplay();
57 57
58 // Adds a new display with provided |metrics|, generates a unique display id 58 // Adds a new display with provided |display|, generates a unique display id
59 // and returns it. Calls OnDisplayAdded() on delegate. 59 // and returns it. Calls OnDisplayAdded() on delegate.
60 int64_t AddDisplay(const display::ViewportMetrics& metrics); 60 int64_t AddDisplay(const display::Display& display);
61 61
62 // Calls OnDisplayModified() on delegate. 62 // Calls OnDisplayModified() on delegate.
63 void ModifyDisplay(int64_t id, const display::ViewportMetrics& metrics); 63 void ModifyDisplay(const display::Display& display);
64 64
65 // Calls OnDisplayRemoved() on delegate. 65 // Calls OnDisplayRemoved() on delegate.
66 void RemoveDisplay(int64_t id); 66 void RemoveDisplay(int64_t id);
67 67
68 // display::ScreenManager: 68 // display::ScreenManager:
69 void AddInterfaces(service_manager::InterfaceRegistry* registry) override {} 69 void AddInterfaces(service_manager::InterfaceRegistry* registry) override {}
70 void Init(display::ScreenManagerDelegate* delegate) override; 70 void Init(display::ScreenManagerDelegate* delegate) override;
71 void RequestCloseDisplay(int64_t display_id) override {} 71 void RequestCloseDisplay(int64_t display_id) override {}
72 72
73 private: 73 private:
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // ----------------------------------------------------------------------------- 271 // -----------------------------------------------------------------------------
272 272
273 // Factory that dispenses TestPlatformDisplays. 273 // Factory that dispenses TestPlatformDisplays.
274 class TestPlatformDisplayFactory : public PlatformDisplayFactory { 274 class TestPlatformDisplayFactory : public PlatformDisplayFactory {
275 public: 275 public:
276 explicit TestPlatformDisplayFactory(mojom::Cursor* cursor_storage); 276 explicit TestPlatformDisplayFactory(mojom::Cursor* cursor_storage);
277 ~TestPlatformDisplayFactory(); 277 ~TestPlatformDisplayFactory();
278 278
279 // PlatformDisplayFactory: 279 // PlatformDisplayFactory:
280 std::unique_ptr<PlatformDisplay> CreatePlatformDisplay( 280 std::unique_ptr<PlatformDisplay> CreatePlatformDisplay(
281 const PlatformDisplayInitParams& init_params) override; 281 ServerWindow* root_window,
282 const display::ViewportMetrics& metrics) override;
282 283
283 private: 284 private:
284 mojom::Cursor* cursor_storage_; 285 mojom::Cursor* cursor_storage_;
285 286
286 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory); 287 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory);
287 }; 288 };
288 289
289 // ----------------------------------------------------------------------------- 290 // -----------------------------------------------------------------------------
290 291
291 // A stub implementation of FrameGeneratorDelegate. 292 // A stub implementation of FrameGeneratorDelegate.
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 653
653 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper); 654 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper);
654 }; 655 };
655 656
656 // ----------------------------------------------------------------------------- 657 // -----------------------------------------------------------------------------
657 658
658 // Adds a new WM to |window_server| for |user_id|. Creates 659 // Adds a new WM to |window_server| for |user_id|. Creates
659 // WindowManagerWindowTreeFactory and associated WindowTree for the WM. 660 // WindowManagerWindowTreeFactory and associated WindowTree for the WM.
660 void AddWindowManager(WindowServer* window_server, const UserId& user_id); 661 void AddWindowManager(WindowServer* window_server, const UserId& user_id);
661 662
662 // Create a new ViewportMetrics object with specified bounds, size and 663 // Create a new Display object with specified origin, pixel size and device
663 // scale factor. Bounds origin, |origin_x| and |origin_y|, are in DIP and bounds 664 // scale factor. The bounds size is computed based on the pixel size and device
664 // size is computed. 665 // scale factor.
665 display::ViewportMetrics MakeViewportMetrics(int origin_x, 666 display::Display MakeDisplay(int origin_x,
666 int origin_y, 667 int origin_y,
667 int width_pixels, 668 int width_pixels,
668 int height_pixels, 669 int height_pixels,
669 float scale_factor); 670 float scale_factor);
670 671
671 // Returns the first and only root of |tree|. If |tree| has zero or more than 672 // Returns the first and only root of |tree|. If |tree| has zero or more than
672 // one root returns null. 673 // one root returns null.
673 ServerWindow* FirstRoot(WindowTree* tree); 674 ServerWindow* FirstRoot(WindowTree* tree);
674 675
675 // Returns the ClientWindowId of the first root of |tree|, or an empty 676 // Returns the ClientWindowId of the first root of |tree|, or an empty
676 // ClientWindowId if |tree| has zero or more than one root. 677 // ClientWindowId if |tree| has zero or more than one root.
677 ClientWindowId FirstRootId(WindowTree* tree); 678 ClientWindowId FirstRootId(WindowTree* tree);
678 679
679 // Returns |tree|s ClientWindowId for |window|. 680 // Returns |tree|s ClientWindowId for |window|.
680 ClientWindowId ClientWindowIdForWindow(WindowTree* tree, 681 ClientWindowId ClientWindowIdForWindow(WindowTree* tree,
681 const ServerWindow* window); 682 const ServerWindow* window);
682 683
683 // Creates a new visible window as a child of the single root of |tree|. 684 // Creates a new visible window as a child of the single root of |tree|.
684 // |client_id| is set to the ClientWindowId of the new window. 685 // |client_id| is set to the ClientWindowId of the new window.
685 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); 686 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
686 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, 687 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
687 ServerWindow* parent, 688 ServerWindow* parent,
688 ClientWindowId* client_id = nullptr); 689 ClientWindowId* client_id = nullptr);
689 690
690 } // namespace test 691 } // namespace test
691 } // namespace ws 692 } // namespace ws
692 } // namespace ui 693 } // namespace ui
693 694
694 #endif // SERVICES_UI_WS_TEST_UTILS_H_ 695 #endif // SERVICES_UI_WS_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « services/ui/ws/platform_display_init_params.cc ('k') | services/ui/ws/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698