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 #include "chrome/browser/chromeos/display/display_preferences.h" | 5 #include "chrome/browser/chromeos/display/display_preferences.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_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 ASSERT_NE(id1, dummy_id); | 148 ASSERT_NE(id1, dummy_id); |
149 | 149 |
150 StoreDisplayLayoutPrefForSecondary(id2, ash::DisplayLayout::BOTTOM, 20); | 150 StoreDisplayLayoutPrefForSecondary(id2, ash::DisplayLayout::BOTTOM, 20); |
151 StoreDisplayLayoutPrefForSecondary(dummy_id, ash::DisplayLayout::TOP, -10); | 151 StoreDisplayLayoutPrefForSecondary(dummy_id, ash::DisplayLayout::TOP, -10); |
152 StoreDefaultLayoutPref(ash::DisplayLayout::LEFT, 50); | 152 StoreDefaultLayoutPref(ash::DisplayLayout::LEFT, 50); |
153 StorePrimaryDisplayId(id2); | 153 StorePrimaryDisplayId(id2); |
154 StoreDisplayOverscan(id1, gfx::Insets(10, 10, 10, 10)); | 154 StoreDisplayOverscan(id1, gfx::Insets(10, 10, 10, 10)); |
155 StoreDisplayOverscan(id2, gfx::Insets(20, 20, 20, 20)); | 155 StoreDisplayOverscan(id2, gfx::Insets(20, 20, 20, 20)); |
156 | 156 |
157 LoadDisplayPreferences(); | 157 LoadDisplayPreferences(); |
| 158 ash::Shell::GetInstance()->display_manager()->UpdateDisplays(); |
| 159 |
158 // Check if the layout settings are notified to the system properly. | 160 // Check if the layout settings are notified to the system properly. |
159 ash::DisplayController* display_controller = | 161 ash::DisplayController* display_controller = |
160 ash::Shell::GetInstance()->display_controller(); | 162 ash::Shell::GetInstance()->display_controller(); |
161 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); | 163 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); |
162 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id()); | 164 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id()); |
163 // Display was swapped, so the layout was inverted. | 165 // Display was swapped, so the layout was inverted. |
164 EXPECT_EQ("top, -20", | 166 EXPECT_EQ("top, -20", |
165 display_controller->GetCurrentDisplayLayout().ToString()); | 167 display_controller->GetCurrentDisplayLayout().ToString()); |
166 | 168 |
167 EXPECT_EQ("bottom, 20", GetRegisteredDisplayLayoutStr(id1, id2)); | 169 EXPECT_EQ("bottom, 20", GetRegisteredDisplayLayoutStr(id1, id2)); |
(...skipping 10 matching lines...) Expand all Loading... |
178 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); | 180 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); |
179 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); | 181 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); |
180 int64 dummy_id = id2 + 1; | 182 int64 dummy_id = id2 + 1; |
181 ASSERT_NE(id1, dummy_id); | 183 ASSERT_NE(id1, dummy_id); |
182 | 184 |
183 StoreDisplayLayoutPrefForPair(id1, id2, ash::DisplayLayout::TOP, 20); | 185 StoreDisplayLayoutPrefForPair(id1, id2, ash::DisplayLayout::TOP, 20); |
184 StoreDisplayLayoutPrefForPair(id1, dummy_id, ash::DisplayLayout::LEFT, 30); | 186 StoreDisplayLayoutPrefForPair(id1, dummy_id, ash::DisplayLayout::LEFT, 30); |
185 StoreDefaultLayoutPref(ash::DisplayLayout::LEFT, 50); | 187 StoreDefaultLayoutPref(ash::DisplayLayout::LEFT, 50); |
186 | 188 |
187 LoadDisplayPreferences(); | 189 LoadDisplayPreferences(); |
| 190 ash::Shell::GetInstance()->display_manager()->UpdateDisplays(); |
188 // Check if the layout settings are notified to the system properly. | 191 // Check if the layout settings are notified to the system properly. |
189 // The paired layout overrides old layout. | 192 // The paired layout overrides old layout. |
190 ash::DisplayController* display_controller = | 193 ash::DisplayController* display_controller = |
191 ash::Shell::GetInstance()->display_controller(); | 194 ash::Shell::GetInstance()->display_controller(); |
192 // Inverted one of for specified pair (id1, id2). Not used for the pair | 195 // Inverted one of for specified pair (id1, id2). Not used for the pair |
193 // (id1, dummy_id) since dummy_id is not connected right now. | 196 // (id1, dummy_id) since dummy_id is not connected right now. |
194 EXPECT_EQ("top, 20", | 197 EXPECT_EQ("top, 20", |
195 display_controller->GetCurrentDisplayLayout().ToString()); | 198 display_controller->GetCurrentDisplayLayout().ToString()); |
196 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(id1, id2)); | 199 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(id1, id2)); |
197 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(id1, dummy_id)); | 200 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(id1, dummy_id)); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 EXPECT_EQ(1.25f, info1.ui_scale()); | 374 EXPECT_EQ(1.25f, info1.ui_scale()); |
372 | 375 |
373 const ash::internal::DisplayInfo& info_primary = | 376 const ash::internal::DisplayInfo& info_primary = |
374 display_manager->GetDisplayInfo(new_primary); | 377 display_manager->GetDisplayInfo(new_primary); |
375 EXPECT_EQ(gfx::Display::ROTATE_90, info_primary.rotation()); | 378 EXPECT_EQ(gfx::Display::ROTATE_90, info_primary.rotation()); |
376 EXPECT_EQ(1.0f, info_primary.ui_scale()); | 379 EXPECT_EQ(1.0f, info_primary.ui_scale()); |
377 } | 380 } |
378 | 381 |
379 } // namespace | 382 } // namespace |
380 } // namespace chromeos | 383 } // namespace chromeos |
OLD | NEW |