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); |
125 | 126 |
126 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); | 127 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); |
127 | 128 |
128 ASSERT_EQ(1u, result.size()); | 129 ASSERT_EQ(1u, result.size()); |
129 | 130 |
130 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); | 131 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); |
131 EXPECT_EQ("0,0 600x500", SystemInfoDisplayBoundsToString(result[0]->bounds)); | 132 EXPECT_EQ("0,0 600x500", SystemInfoDisplayBoundsToString(result[0]->bounds)); |
132 EXPECT_EQ(270, result[0]->rotation); | 133 EXPECT_EQ(270, result[0]->rotation); |
133 | 134 |
134 GetDisplayManager()->SetDisplayRotation(display_id, gfx::Display::ROTATE_180); | 135 GetDisplayManager()->SetDisplayRotation(display_id, gfx::Display::ROTATE_180, |
| 136 gfx::Display::ROTATION_SOURCE_ACTIVE); |
135 | 137 |
136 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); | 138 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); |
137 | 139 |
138 ASSERT_EQ(1u, result.size()); | 140 ASSERT_EQ(1u, result.size()); |
139 | 141 |
140 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); | 142 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); |
141 EXPECT_EQ("0,0 500x600", SystemInfoDisplayBoundsToString(result[0]->bounds)); | 143 EXPECT_EQ("0,0 500x600", SystemInfoDisplayBoundsToString(result[0]->bounds)); |
142 EXPECT_EQ(180, result[0]->rotation); | 144 EXPECT_EQ(180, result[0]->rotation); |
143 | 145 |
144 GetDisplayManager()->SetDisplayRotation(display_id, gfx::Display::ROTATE_0); | 146 GetDisplayManager()->SetDisplayRotation(display_id, gfx::Display::ROTATE_0, |
| 147 gfx::Display::ROTATION_SOURCE_ACTIVE); |
145 | 148 |
146 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); | 149 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); |
147 | 150 |
148 ASSERT_EQ(1u, result.size()); | 151 ASSERT_EQ(1u, result.size()); |
149 | 152 |
150 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); | 153 EXPECT_EQ(base::Int64ToString(display_id), result[0]->id); |
151 EXPECT_EQ("0,0 500x600", SystemInfoDisplayBoundsToString(result[0]->bounds)); | 154 EXPECT_EQ("0,0 500x600", SystemInfoDisplayBoundsToString(result[0]->bounds)); |
152 EXPECT_EQ(0, result[0]->rotation); | 155 EXPECT_EQ(0, result[0]->rotation); |
153 } | 156 } |
154 | 157 |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 std::string error; | 885 std::string error; |
883 CallSetDisplayUnitInfo( | 886 CallSetDisplayUnitInfo( |
884 base::Int64ToString(internal_display_id), info, &success, &error); | 887 base::Int64ToString(internal_display_id), info, &success, &error); |
885 | 888 |
886 ASSERT_FALSE(success); | 889 ASSERT_FALSE(success); |
887 EXPECT_EQ("Overscan changes not allowed for the internal monitor.", error); | 890 EXPECT_EQ("Overscan changes not allowed for the internal monitor.", error); |
888 } | 891 } |
889 | 892 |
890 } // namespace | 893 } // namespace |
891 } // namespace extensions | 894 } // namespace extensions |
OLD | NEW |