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