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