OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/extensions/api/system_display/display_info_provider.h" | 5 #include "chrome/browser/extensions/api/system_display/display_info_provider.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ASSERT_EQ(1u, result.size()); | 112 ASSERT_EQ(1u, result.size()); |
113 | 113 |
114 int64 display_id; | 114 int64 display_id; |
115 ASSERT_TRUE(base::StringToInt64(result[0]->id, &display_id)) | 115 ASSERT_TRUE(base::StringToInt64(result[0]->id, &display_id)) |
116 << "Display id must be convertable to integer: " << result[0]->id; | 116 << "Display id must be convertable to integer: " << result[0]->id; |
117 | 117 |
118 ASSERT_TRUE(DisplayExists(display_id)) << display_id << " not found"; | 118 ASSERT_TRUE(DisplayExists(display_id)) << display_id << " not found"; |
119 EXPECT_EQ("0,0 600x500", SystemInfoDisplayBoundsToString(result[0]->bounds)); | 119 EXPECT_EQ("0,0 600x500", SystemInfoDisplayBoundsToString(result[0]->bounds)); |
120 EXPECT_EQ(90, result[0]->rotation); | 120 EXPECT_EQ(90, result[0]->rotation); |
121 | 121 |
122 GetDisplayManager()->SetDisplayRotation(display_id, gfx::Display::ROTATE_270); | 122 GetDisplayManager()->SetDisplayRotation(display_id, |
| 123 gfx::Display::ROTATE_270, |
| 124 ui::USER); |
123 | 125 |
124 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); | 126 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); |
125 | 127 |
126 ASSERT_EQ(1u, result.size()); | 128 ASSERT_EQ(1u, result.size()); |
127 | 129 |
128 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); | 130 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); |
129 EXPECT_EQ("0,0 600x500", SystemInfoDisplayBoundsToString(result[0]->bounds)); | 131 EXPECT_EQ("0,0 600x500", SystemInfoDisplayBoundsToString(result[0]->bounds)); |
130 EXPECT_EQ(270, result[0]->rotation); | 132 EXPECT_EQ(270, result[0]->rotation); |
131 | 133 |
132 GetDisplayManager()->SetDisplayRotation(display_id, gfx::Display::ROTATE_180); | 134 GetDisplayManager()->SetDisplayRotation(display_id, |
| 135 gfx::Display::ROTATE_180, |
| 136 ui::USER); |
133 | 137 |
134 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); | 138 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); |
135 | 139 |
136 ASSERT_EQ(1u, result.size()); | 140 ASSERT_EQ(1u, result.size()); |
137 | 141 |
138 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); | 142 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); |
139 EXPECT_EQ("0,0 500x600", SystemInfoDisplayBoundsToString(result[0]->bounds)); | 143 EXPECT_EQ("0,0 500x600", SystemInfoDisplayBoundsToString(result[0]->bounds)); |
140 EXPECT_EQ(180, result[0]->rotation); | 144 EXPECT_EQ(180, result[0]->rotation); |
141 | 145 |
142 GetDisplayManager()->SetDisplayRotation(display_id, gfx::Display::ROTATE_0); | 146 GetDisplayManager()->SetDisplayRotation(display_id, |
| 147 gfx::Display::ROTATE_0, |
| 148 ui::USER); |
143 | 149 |
144 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); | 150 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); |
145 | 151 |
146 ASSERT_EQ(1u, result.size()); | 152 ASSERT_EQ(1u, result.size()); |
147 | 153 |
148 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); | 154 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); |
149 EXPECT_EQ("0,0 500x600", SystemInfoDisplayBoundsToString(result[0]->bounds)); | 155 EXPECT_EQ("0,0 500x600", SystemInfoDisplayBoundsToString(result[0]->bounds)); |
150 EXPECT_EQ(0, result[0]->rotation); | 156 EXPECT_EQ(0, result[0]->rotation); |
151 } | 157 } |
152 | 158 |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 CallSetDisplayUnitInfo(base::Int64ToString(internal_display_id), info, | 890 CallSetDisplayUnitInfo(base::Int64ToString(internal_display_id), info, |
885 &success, &error); | 891 &success, &error); |
886 | 892 |
887 ASSERT_FALSE(success); | 893 ASSERT_FALSE(success); |
888 EXPECT_EQ("Overscan changes not allowed for the internal monitor.", | 894 EXPECT_EQ("Overscan changes not allowed for the internal monitor.", |
889 error); | 895 error); |
890 } | 896 } |
891 | 897 |
892 } // namespace | 898 } // namespace |
893 } // namespace extensions | 899 } // namespace extensions |
OLD | NEW |