OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_TEST_DISPLAY_MANAGER_TEST_API_H_ | 5 #ifndef ASH_TEST_DISPLAY_MANAGER_TEST_API_H_ |
6 #define ASH_TEST_DISPLAY_MANAGER_TEST_API_H_ | 6 #define ASH_TEST_DISPLAY_MANAGER_TEST_API_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "ui/display/manager/display_layout.h" | 15 #include "ui/display/manager/display_layout.h" |
16 #include "ui/display/types/display_constants.h" | 16 #include "ui/display/types/display_constants.h" |
17 | 17 |
| 18 namespace display { |
| 19 class ManagedDisplayInfo; |
| 20 } |
| 21 |
18 namespace gfx { | 22 namespace gfx { |
19 class Point; | 23 class Point; |
20 class Size; | 24 class Size; |
21 } | 25 } |
22 | 26 |
23 namespace ui { | 27 namespace ui { |
24 namespace test { | 28 namespace test { |
25 class EventGenerator; | 29 class EventGenerator; |
26 } | 30 } |
27 } | 31 } |
28 | 32 |
29 namespace ash { | 33 namespace ash { |
30 class DisplayManager; | 34 class DisplayManager; |
31 | 35 |
32 namespace test { | 36 namespace test { |
33 | 37 |
34 class DisplayManagerTestApi { | 38 class DisplayManagerTestApi { |
35 public: | 39 public: |
36 // Test if moving a mouse to |point_in_screen| warps it to another | 40 explicit DisplayManagerTestApi(DisplayManager* display_manager); |
37 // display. | |
38 static bool TestIfMouseWarpsAt(ui::test::EventGenerator& event_generator, | |
39 const gfx::Point& point_in_screen); | |
40 | |
41 DisplayManagerTestApi(); | |
42 virtual ~DisplayManagerTestApi(); | 41 virtual ~DisplayManagerTestApi(); |
43 | 42 |
44 // Update the display configuration as given in |display_specs|. The format of | 43 // Update the display configuration as given in |display_specs|. The format of |
45 // |display_spec| is a list of comma separated spec for each displays. Please | 44 // |display_spec| is a list of comma separated spec for each displays. Please |
46 // refer to the comment in |ash::DisplayInfo::CreateFromSpec| for the format | 45 // refer to the comment in |ash::DisplayInfo::CreateFromSpec| for the format |
47 // of the display spec. | 46 // of the display spec. |
48 void UpdateDisplay(const std::string& display_specs); | 47 void UpdateDisplay(const std::string& display_specs); |
49 | 48 |
50 // Set the 1st display as an internal display and returns the display Id for | 49 // Set the 1st display as an internal display and returns the display Id for |
51 // the internal display. | 50 // the internal display. |
52 int64_t SetFirstDisplayAsInternalDisplay(); | 51 int64_t SetFirstDisplayAsInternalDisplay(); |
53 | 52 |
54 // Don't update the display when the root window's size was changed. | 53 // Don't update the display when the root window's size was changed. |
55 void DisableChangeDisplayUponHostResize(); | 54 void DisableChangeDisplayUponHostResize(); |
56 | 55 |
57 // Sets the available color profiles for |display_id|. | 56 // Sets the available color profiles for |display_id|. |
58 void SetAvailableColorProfiles( | 57 void SetAvailableColorProfiles( |
59 int64_t display_id, | 58 int64_t display_id, |
60 const std::vector<ui::ColorCalibrationProfile>& profiles); | 59 const std::vector<ui::ColorCalibrationProfile>& profiles); |
61 | 60 |
| 61 // Gets the internal display::ManagedDisplayInfo for a specific display id. |
| 62 const display::ManagedDisplayInfo& GetInternalManagedDisplayInfo( |
| 63 int64_t display_id); |
| 64 |
62 private: | 65 private: |
63 friend class ScopedSetInternalDisplayId; | 66 friend class ScopedSetInternalDisplayId; |
64 // Sets the display id for internal display and | 67 // Sets the display id for internal display and |
65 // update the display mode list if necessary. | 68 // update the display mode list if necessary. |
66 void SetInternalDisplayId(int64_t id); | 69 void SetInternalDisplayId(int64_t id); |
67 | 70 |
68 DisplayManager* display_manager_; // not owned | 71 DisplayManager* display_manager_; // not owned |
69 | 72 |
70 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTestApi); | 73 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTestApi); |
71 }; | 74 }; |
72 | 75 |
73 class ScopedDisable125DSFForUIScaling { | 76 class ScopedDisable125DSFForUIScaling { |
74 public: | 77 public: |
75 ScopedDisable125DSFForUIScaling(); | 78 ScopedDisable125DSFForUIScaling(); |
76 ~ScopedDisable125DSFForUIScaling(); | 79 ~ScopedDisable125DSFForUIScaling(); |
77 | 80 |
78 private: | 81 private: |
79 DISALLOW_COPY_AND_ASSIGN(ScopedDisable125DSFForUIScaling); | 82 DISALLOW_COPY_AND_ASSIGN(ScopedDisable125DSFForUIScaling); |
80 }; | 83 }; |
81 | 84 |
82 class ScopedSetInternalDisplayId { | 85 class ScopedSetInternalDisplayId { |
83 public: | 86 public: |
84 ScopedSetInternalDisplayId(int64_t id); | 87 ScopedSetInternalDisplayId(DisplayManager* test_api, int64_t id); |
85 ~ScopedSetInternalDisplayId(); | 88 ~ScopedSetInternalDisplayId(); |
86 | 89 |
87 private: | 90 private: |
88 DISALLOW_COPY_AND_ASSIGN(ScopedSetInternalDisplayId); | 91 DISALLOW_COPY_AND_ASSIGN(ScopedSetInternalDisplayId); |
89 }; | 92 }; |
90 | 93 |
91 // Sets the display mode that matches the |resolution| for |display_id|. | 94 // Sets the display mode that matches the |resolution| for |display_id|. |
92 bool SetDisplayResolution(int64_t display_id, const gfx::Size& resolution); | 95 bool SetDisplayResolution(DisplayManager* display_manager, |
93 | 96 int64_t display_id, |
94 // Swap the primary display with the secondary. | 97 const gfx::Size& resolution); |
95 void SwapPrimaryDisplay(); | |
96 | 98 |
97 // Creates the dislpay layout from position and offset for the current | 99 // Creates the dislpay layout from position and offset for the current |
98 // display list. If you simply want to create a new layout that is | 100 // display list. If you simply want to create a new layout that is |
99 // independent of current displays, use DisplayLayoutBuilder or simply | 101 // independent of current displays, use DisplayLayoutBuilder or simply |
100 // create a new DisplayLayout and set display id fields (primary, ids | 102 // create a new DisplayLayout and set display id fields (primary, ids |
101 // in placement) manually. | 103 // in placement) manually. |
102 std::unique_ptr<display::DisplayLayout> CreateDisplayLayout( | 104 std::unique_ptr<display::DisplayLayout> CreateDisplayLayout( |
| 105 DisplayManager* display_manager, |
103 display::DisplayPlacement::Position position, | 106 display::DisplayPlacement::Position position, |
104 int offset); | 107 int offset); |
105 | 108 |
106 // Creates the DisplayIdList from ints. | 109 // Creates the DisplayIdList from ints. |
107 display::DisplayIdList CreateDisplayIdList2(int64_t id1, int64_t id2); | 110 display::DisplayIdList CreateDisplayIdList2(int64_t id1, int64_t id2); |
108 display::DisplayIdList CreateDisplayIdListN(size_t count, ...); | 111 display::DisplayIdList CreateDisplayIdListN(size_t count, ...); |
109 | 112 |
110 } // namespace test | 113 } // namespace test |
111 } // namespace ash | 114 } // namespace ash |
112 | 115 |
113 #endif // ASH_TEST_DISPLAY_MANAGER_TEST_API_H_ | 116 #endif // ASH_TEST_DISPLAY_MANAGER_TEST_API_H_ |
OLD | NEW |