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> |
11 #include <set> | 11 #include <set> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "services/ui/display/platform_screen.h" | 16 #include "services/ui/display/screen_manager.h" |
17 #include "services/ui/display/viewport_metrics.h" | 17 #include "services/ui/display/viewport_metrics.h" |
18 #include "services/ui/public/interfaces/display_manager.mojom.h" | 18 #include "services/ui/public/interfaces/display_manager.mojom.h" |
19 #include "services/ui/public/interfaces/window_tree.mojom.h" | 19 #include "services/ui/public/interfaces/window_tree.mojom.h" |
20 #include "services/ui/ws/display.h" | 20 #include "services/ui/ws/display.h" |
21 #include "services/ui/ws/display_binding.h" | 21 #include "services/ui/ws/display_binding.h" |
22 #include "services/ui/ws/drag_controller.h" | 22 #include "services/ui/ws/drag_controller.h" |
23 #include "services/ui/ws/event_dispatcher.h" | 23 #include "services/ui/ws/event_dispatcher.h" |
24 #include "services/ui/ws/frame_generator_delegate.h" | 24 #include "services/ui/ws/frame_generator_delegate.h" |
25 #include "services/ui/ws/platform_display.h" | 25 #include "services/ui/ws/platform_display.h" |
26 #include "services/ui/ws/platform_display_factory.h" | 26 #include "services/ui/ws/platform_display_factory.h" |
27 #include "services/ui/ws/test_change_tracker.h" | 27 #include "services/ui/ws/test_change_tracker.h" |
28 #include "services/ui/ws/user_activity_monitor.h" | 28 #include "services/ui/ws/user_activity_monitor.h" |
29 #include "services/ui/ws/user_id.h" | 29 #include "services/ui/ws/user_id.h" |
30 #include "services/ui/ws/window_manager_state.h" | 30 #include "services/ui/ws/window_manager_state.h" |
31 #include "services/ui/ws/window_manager_window_tree_factory_set.h" | 31 #include "services/ui/ws/window_manager_window_tree_factory_set.h" |
32 #include "services/ui/ws/window_server_delegate.h" | 32 #include "services/ui/ws/window_server_delegate.h" |
33 #include "services/ui/ws/window_tree.h" | 33 #include "services/ui/ws/window_tree.h" |
34 #include "services/ui/ws/window_tree_binding.h" | 34 #include "services/ui/ws/window_tree_binding.h" |
35 #include "ui/display/display.h" | 35 #include "ui/display/display.h" |
36 #include "ui/display/types/display_constants.h" | 36 #include "ui/display/types/display_constants.h" |
37 | 37 |
38 namespace ui { | 38 namespace ui { |
39 namespace ws { | 39 namespace ws { |
40 namespace test { | 40 namespace test { |
41 | 41 |
42 // Collection of utilities useful in creating mus tests. | 42 // Collection of utilities useful in creating mus tests. |
43 | 43 |
44 // Test PlatformDisplay instance that allows adding/modifying/removing displays. | 44 // Test ScreenManager instance that allows adding/modifying/removing displays. |
45 // Tracks display ids to perform some basic verification that no duplicates are | 45 // Tracks display ids to perform some basic verification that no duplicates are |
46 // added and display was added before being modified or removed. Display ids | 46 // added and display was added before being modified or removed. Display ids |
47 // reset when Init() is called. | 47 // reset when Init() is called. |
48 class TestPlatformScreen : public display::PlatformScreen { | 48 class TestScreenManager : public display::ScreenManager { |
49 public: | 49 public: |
50 TestPlatformScreen(); | 50 TestScreenManager(); |
51 ~TestPlatformScreen() override; | 51 ~TestScreenManager() override; |
52 | 52 |
53 // Adds a new display with default metrics, generates a unique display id and | 53 // Adds a new display with default metrics, generates a unique display id and |
54 // returns it. Calls OnDisplayAdded() on delegate. | 54 // returns it. Calls OnDisplayAdded() on delegate. |
55 int64_t AddDisplay(); | 55 int64_t AddDisplay(); |
56 | 56 |
57 // Adds a new display with provided |metrics|, generates a unique display id | 57 // Adds a new display with provided |metrics|, generates a unique display id |
58 // and returns it. Calls OnDisplayAdded() on delegate. | 58 // and returns it. Calls OnDisplayAdded() on delegate. |
59 int64_t AddDisplay(const display::ViewportMetrics& metrics); | 59 int64_t AddDisplay(const display::ViewportMetrics& metrics); |
60 | 60 |
61 // Calls OnDisplayModified() on delegate. | 61 // Calls OnDisplayModified() on delegate. |
62 void ModifyDisplay(int64_t id, const display::ViewportMetrics& metrics); | 62 void ModifyDisplay(int64_t id, const display::ViewportMetrics& metrics); |
63 | 63 |
64 // Calls OnDisplayRemoved() on delegate. | 64 // Calls OnDisplayRemoved() on delegate. |
65 void RemoveDisplay(int64_t id); | 65 void RemoveDisplay(int64_t id); |
66 | 66 |
67 // display::PlatformScreen: | 67 // display::ScreenManager: |
68 void AddInterfaces(service_manager::InterfaceRegistry* registry) override {} | 68 void AddInterfaces(service_manager::InterfaceRegistry* registry) override {} |
69 void Init(display::PlatformScreenDelegate* delegate) override; | 69 void Init(display::ScreenManagerDelegate* delegate) override; |
70 void RequestCloseDisplay(int64_t display_id) override {} | 70 void RequestCloseDisplay(int64_t display_id) override {} |
71 int64_t GetPrimaryDisplayId() const override; | 71 int64_t GetPrimaryDisplayId() const override; |
72 | 72 |
73 private: | 73 private: |
74 display::PlatformScreenDelegate* delegate_; | 74 display::ScreenManagerDelegate* delegate_; |
75 int64_t primary_display_id_ = display::kInvalidDisplayId; | 75 int64_t primary_display_id_ = display::kInvalidDisplayId; |
76 std::set<int64_t> display_ids_; | 76 std::set<int64_t> display_ids_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(TestPlatformScreen); | 78 DISALLOW_COPY_AND_ASSIGN(TestScreenManager); |
79 }; | 79 }; |
80 | 80 |
81 // ----------------------------------------------------------------------------- | 81 // ----------------------------------------------------------------------------- |
82 | 82 |
83 class UserActivityMonitorTestApi { | 83 class UserActivityMonitorTestApi { |
84 public: | 84 public: |
85 explicit UserActivityMonitorTestApi(UserActivityMonitor* monitor) | 85 explicit UserActivityMonitorTestApi(UserActivityMonitor* monitor) |
86 : monitor_(monitor) {} | 86 : monitor_(monitor) {} |
87 | 87 |
88 void SetTimerTaskRunner( | 88 void SetTimerTaskRunner( |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); | 672 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); |
673 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 673 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
674 ServerWindow* parent, | 674 ServerWindow* parent, |
675 ClientWindowId* client_id); | 675 ClientWindowId* client_id); |
676 | 676 |
677 } // namespace test | 677 } // namespace test |
678 } // namespace ws | 678 } // namespace ws |
679 } // namespace ui | 679 } // namespace ui |
680 | 680 |
681 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 681 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
OLD | NEW |