display_preferences_unittest.cc revision ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16
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#include "chrome/browser/chromeos/display/display_preferences.h" 6 7#include "ash/display/display_controller.h" 8#include "ash/display/display_layout_store.h" 9#include "ash/display/display_manager.h" 10#include "ash/display/resolution_notification_controller.h" 11#include "ash/screen_ash.h" 12#include "ash/shell.h" 13#include "ash/test/ash_test_base.h" 14#include "base/prefs/testing_pref_service.h" 15#include "base/strings/string_number_conversions.h" 16#include "base/values.h" 17#include "chrome/browser/chromeos/display/display_configuration_observer.h" 18#include "chrome/browser/chromeos/login/mock_user_manager.h" 19#include "chrome/browser/chromeos/login/user_manager.h" 20#include "chrome/browser/prefs/scoped_user_pref_update.h" 21#include "chrome/common/pref_names.h" 22#include "chrome/test/base/testing_browser_process.h" 23#include "chromeos/display/output_configurator.h" 24#include "ui/message_center/message_center.h" 25 26using ash::internal::ResolutionNotificationController; 27 28namespace chromeos { 29namespace { 30const char kPrimaryIdKey[] = "primary-id"; 31const char kMirroredKey[] = "mirrored"; 32const char kPositionKey[] = "position"; 33const char kOffsetKey[] = "offset"; 34 35class DisplayPreferencesTest : public ash::test::AshTestBase { 36 protected: 37 DisplayPreferencesTest() : ash::test::AshTestBase(), 38 mock_user_manager_(new MockUserManager), 39 user_manager_enabler_(mock_user_manager_) { 40 } 41 42 virtual ~DisplayPreferencesTest() {} 43 44 virtual void SetUp() OVERRIDE { 45 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) 46 .WillRepeatedly(testing::Return(false)); 47 EXPECT_CALL(*mock_user_manager_, Shutdown()); 48 ash::test::AshTestBase::SetUp(); 49 RegisterDisplayLocalStatePrefs(local_state_.registry()); 50 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); 51 observer_.reset(new DisplayConfigurationObserver()); 52 } 53 54 virtual void TearDown() OVERRIDE { 55 observer_.reset(); 56 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); 57 ash::test::AshTestBase::TearDown(); 58 } 59 60 void LoggedInAsUser() { 61 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) 62 .WillRepeatedly(testing::Return(true)); 63 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsDemoUser()) 64 .WillRepeatedly(testing::Return(false)); 65 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsGuest()) 66 .WillRepeatedly(testing::Return(false)); 67 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsStub()) 68 .WillRepeatedly(testing::Return(false)); 69 } 70 71 void LoggedInAsGuest() { 72 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) 73 .WillRepeatedly(testing::Return(true)); 74 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsDemoUser()) 75 .WillRepeatedly(testing::Return(false)); 76 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsGuest()) 77 .WillRepeatedly(testing::Return(true)); 78 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsStub()) 79 .WillRepeatedly(testing::Return(false)); 80 } 81 82 // Do not use the implementation of display_preferences.cc directly to avoid 83 // notifying the update to the system. 84 void StoreDisplayLayoutPrefForName(const std::string& name, 85 ash::DisplayLayout::Position layout, 86 int offset, 87 int64 primary_id) { 88 DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays); 89 ash::DisplayLayout display_layout(layout, offset); 90 display_layout.primary_id = primary_id; 91 92 DCHECK(!name.empty()); 93 94 base::DictionaryValue* pref_data = update.Get(); 95 scoped_ptr<base::Value>layout_value(new base::DictionaryValue()); 96 if (pref_data->HasKey(name)) { 97 base::Value* value = NULL; 98 if (pref_data->Get(name, &value) && value != NULL) 99 layout_value.reset(value->DeepCopy()); 100 } 101 if (ash::DisplayLayout::ConvertToValue(display_layout, layout_value.get())) 102 pref_data->Set(name, layout_value.release()); 103 } 104 105 void StoreDisplayLayoutPrefForPair(int64 id1, 106 int64 id2, 107 ash::DisplayLayout::Position layout, 108 int offset) { 109 StoreDisplayLayoutPrefForName( 110 base::Int64ToString(id1) + "," + base::Int64ToString(id2), 111 layout, offset, id1); 112 } 113 114 void StoreDisplayLayoutPrefForSecondary(int64 id, 115 ash::DisplayLayout::Position layout, 116 int offset, 117 int64 primary_id) { 118 StoreDisplayLayoutPrefForName( 119 base::Int64ToString(id), layout, offset, primary_id); 120 } 121 122 void StoreDisplayOverscan(int64 id, const gfx::Insets& insets) { 123 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties); 124 const std::string name = base::Int64ToString(id); 125 126 base::DictionaryValue* pref_data = update.Get(); 127 base::DictionaryValue* insets_value = new base::DictionaryValue(); 128 insets_value->SetInteger("insets_top", insets.top()); 129 insets_value->SetInteger("insets_left", insets.left()); 130 insets_value->SetInteger("insets_bottom", insets.bottom()); 131 insets_value->SetInteger("insets_right", insets.right()); 132 pref_data->Set(name, insets_value); 133 } 134 135 std::string GetRegisteredDisplayLayoutStr(int64 id1, int64 id2) { 136 ash::DisplayIdPair pair; 137 pair.first = id1; 138 pair.second = id2; 139 return ash::Shell::GetInstance()->display_manager()->layout_store()-> 140 GetRegisteredDisplayLayout(pair).ToString(); 141 } 142 143 const PrefService* local_state() const { return &local_state_; } 144 145 private: 146 MockUserManager* mock_user_manager_; // Not owned. 147 ScopedUserManagerEnabler user_manager_enabler_; 148 TestingPrefServiceSimple local_state_; 149 scoped_ptr<DisplayConfigurationObserver> observer_; 150 151 DISALLOW_COPY_AND_ASSIGN(DisplayPreferencesTest); 152}; 153 154} // namespace 155 156TEST_F(DisplayPreferencesTest, PairedLayoutOverrides) { 157 UpdateDisplay("100x100,200x200"); 158 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 159 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 160 int64 dummy_id = id2 + 1; 161 ASSERT_NE(id1, dummy_id); 162 163 StoreDisplayLayoutPrefForPair(id1, id2, ash::DisplayLayout::TOP, 20); 164 StoreDisplayLayoutPrefForPair(id1, dummy_id, ash::DisplayLayout::LEFT, 30); 165 StoreDisplayPowerStateForTest( 166 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON); 167 168 ash::Shell* shell = ash::Shell::GetInstance(); 169 170 LoadDisplayPreferences(true); 171 // DisplayPowerState should be ignored at boot. 172 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, 173 shell->output_configurator()->power_state()); 174 175 shell->display_manager()->UpdateDisplays(); 176 // Check if the layout settings are notified to the system properly. 177 // The paired layout overrides old layout. 178 ash::DisplayController* display_controller = shell->display_controller(); 179 // Inverted one of for specified pair (id1, id2). Not used for the pair 180 // (id1, dummy_id) since dummy_id is not connected right now. 181 EXPECT_EQ("top, 20", 182 display_controller->GetCurrentDisplayLayout().ToString()); 183 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(id1, id2)); 184 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(id1, dummy_id)); 185} 186 187TEST_F(DisplayPreferencesTest, BasicStores) { 188 ash::DisplayController* display_controller = 189 ash::Shell::GetInstance()->display_controller(); 190 ash::internal::DisplayManager* display_manager = 191 ash::Shell::GetInstance()->display_manager(); 192 193 UpdateDisplay("200x200*2,400x300"); 194 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 195 gfx::Display::SetInternalDisplayId(id1); 196 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 197 int64 dummy_id = id2 + 1; 198 ASSERT_NE(id1, dummy_id); 199 200 LoggedInAsUser(); 201 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 202 SetCurrentDisplayLayout(layout); 203 StoreDisplayLayoutPrefForTest( 204 id1, dummy_id, ash::DisplayLayout(ash::DisplayLayout::LEFT, 20)); 205 // Can't switch to a display that does not exist. 206 display_controller->SetPrimaryDisplayId(dummy_id); 207 EXPECT_NE(dummy_id, display_controller->GetPrimaryDisplay().id()); 208 209 display_controller->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13)); 210 display_manager->SetDisplayRotation(id1, gfx::Display::ROTATE_90); 211 display_manager->SetDisplayUIScale(id1, 1.25f); 212 display_manager->SetDisplayUIScale(id2, 1.25f); 213 214 const base::DictionaryValue* displays = 215 local_state()->GetDictionary(prefs::kSecondaryDisplays); 216 const base::DictionaryValue* layout_value = NULL; 217 std::string key = base::Int64ToString(id1) + "," + base::Int64ToString(id2); 218 EXPECT_TRUE(displays->GetDictionary(key, &layout_value)); 219 220 ash::DisplayLayout stored_layout; 221 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*layout_value, 222 &stored_layout)); 223 EXPECT_EQ(layout.position, stored_layout.position); 224 EXPECT_EQ(layout.offset, stored_layout.offset); 225 226 bool mirrored = true; 227 EXPECT_TRUE(layout_value->GetBoolean(kMirroredKey, &mirrored)); 228 EXPECT_FALSE(mirrored); 229 230 const base::DictionaryValue* properties = 231 local_state()->GetDictionary(prefs::kDisplayProperties); 232 const base::DictionaryValue* property = NULL; 233 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id1), &property)); 234 int ui_scale = 0; 235 int rotation = 0; 236 EXPECT_TRUE(property->GetInteger("rotation", &rotation)); 237 EXPECT_TRUE(property->GetInteger("ui-scale", &ui_scale)); 238 EXPECT_EQ(1, rotation); 239 EXPECT_EQ(1250, ui_scale); 240 241 // Internal display never registere the resolution. 242 int width = 0, height = 0; 243 EXPECT_FALSE(property->GetInteger("width", &width)); 244 EXPECT_FALSE(property->GetInteger("height", &height)); 245 246 int top = 0, left = 0, bottom = 0, right = 0; 247 EXPECT_TRUE(property->GetInteger("insets_top", &top)); 248 EXPECT_TRUE(property->GetInteger("insets_left", &left)); 249 EXPECT_TRUE(property->GetInteger("insets_bottom", &bottom)); 250 EXPECT_TRUE(property->GetInteger("insets_right", &right)); 251 EXPECT_EQ(10, top); 252 EXPECT_EQ(11, left); 253 EXPECT_EQ(12, bottom); 254 EXPECT_EQ(13, right); 255 256 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id2), &property)); 257 EXPECT_TRUE(property->GetInteger("rotation", &rotation)); 258 EXPECT_TRUE(property->GetInteger("ui-scale", &ui_scale)); 259 EXPECT_EQ(0, rotation); 260 // ui_scale works only on 2x scale factor/1st display. 261 EXPECT_EQ(1000, ui_scale); 262 EXPECT_FALSE(property->GetInteger("insets_top", &top)); 263 EXPECT_FALSE(property->GetInteger("insets_left", &left)); 264 EXPECT_FALSE(property->GetInteger("insets_bottom", &bottom)); 265 EXPECT_FALSE(property->GetInteger("insets_right", &right)); 266 267 // Resolution is saved only when the resolution is set 268 // by DisplayManager::SetDisplayResolution 269 width = 0; 270 height = 0; 271 EXPECT_FALSE(property->GetInteger("width", &width)); 272 EXPECT_FALSE(property->GetInteger("height", &height)); 273 274 display_manager->SetDisplayResolution(id2, gfx::Size(400, 300)); 275 276 display_controller->SetPrimaryDisplayId(id2); 277 278 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id1), &property)); 279 width = 0; 280 height = 0; 281 // Internal dispaly shouldn't store its resolution. 282 EXPECT_FALSE(property->GetInteger("width", &width)); 283 EXPECT_FALSE(property->GetInteger("height", &height)); 284 285 // External dispaly's resolution must be stored this time. 286 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id2), &property)); 287 EXPECT_TRUE(property->GetInteger("width", &width)); 288 EXPECT_TRUE(property->GetInteger("height", &height)); 289 EXPECT_EQ(400, width); 290 EXPECT_EQ(300, height); 291 292 // The layout remains the same. 293 EXPECT_TRUE(displays->GetDictionary(key, &layout_value)); 294 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*layout_value, 295 &stored_layout)); 296 EXPECT_EQ(layout.position, stored_layout.position); 297 EXPECT_EQ(layout.offset, stored_layout.offset); 298 EXPECT_EQ(id2, stored_layout.primary_id); 299 300 mirrored = true; 301 EXPECT_TRUE(layout_value->GetBoolean(kMirroredKey, &mirrored)); 302 EXPECT_FALSE(mirrored); 303 std::string primary_id_str; 304 EXPECT_TRUE(layout_value->GetString(kPrimaryIdKey, &primary_id_str)); 305 EXPECT_EQ(base::Int64ToString(id2), primary_id_str); 306 307 SetCurrentDisplayLayout( 308 ash::DisplayLayout(ash::DisplayLayout::BOTTOM, 20)); 309 310 UpdateDisplay("1+0-200x200*2,1+0-200x200"); 311 // Mirrored. 312 int offset = 0; 313 std::string position; 314 EXPECT_TRUE(displays->GetDictionary(key, &layout_value)); 315 EXPECT_TRUE(layout_value->GetString(kPositionKey, &position)); 316 EXPECT_EQ("top", position); 317 EXPECT_TRUE(layout_value->GetInteger(kOffsetKey, &offset)); 318 EXPECT_EQ(-20, offset); 319 mirrored = false; 320 EXPECT_TRUE(layout_value->GetBoolean(kMirroredKey, &mirrored)); 321 EXPECT_TRUE(mirrored); 322 EXPECT_TRUE(layout_value->GetString(kPrimaryIdKey, &primary_id_str)); 323 EXPECT_EQ(base::Int64ToString(id2), primary_id_str); 324 325 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id1), &property)); 326 EXPECT_FALSE(property->GetInteger("width", &width)); 327 EXPECT_FALSE(property->GetInteger("height", &height)); 328 329 // External dispaly's selected resolution must not change 330 // by mirroring. 331 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id2), &property)); 332 EXPECT_TRUE(property->GetInteger("width", &width)); 333 EXPECT_TRUE(property->GetInteger("height", &height)); 334 EXPECT_EQ(400, width); 335 EXPECT_EQ(300, height); 336 337 // Set new display's selected resolution. 338 display_manager->SetDisplayResolution(id2 + 1, gfx::Size(500, 400)); 339 UpdateDisplay("200x200*2,500x400"); 340 // Update key as the 2nd display gets new id. 341 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 342 key = base::Int64ToString(id1) + "," + base::Int64ToString(id2); 343 EXPECT_TRUE(displays->GetDictionary(key, &layout_value)); 344 EXPECT_TRUE(layout_value->GetString(kPositionKey, &position)); 345 EXPECT_EQ("right", position); 346 EXPECT_TRUE(layout_value->GetInteger(kOffsetKey, &offset)); 347 EXPECT_EQ(0, offset); 348 mirrored = true; 349 EXPECT_TRUE(layout_value->GetBoolean(kMirroredKey, &mirrored)); 350 EXPECT_FALSE(mirrored); 351 EXPECT_TRUE(layout_value->GetString(kPrimaryIdKey, &primary_id_str)); 352 EXPECT_EQ(base::Int64ToString(id1), primary_id_str); 353 354 // External dispaly's selected resolution must be updated. 355 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id2), &property)); 356 EXPECT_TRUE(property->GetInteger("width", &width)); 357 EXPECT_TRUE(property->GetInteger("height", &height)); 358 EXPECT_EQ(500, width); 359 EXPECT_EQ(400, height); 360} 361 362TEST_F(DisplayPreferencesTest, PreventStore) { 363 ResolutionNotificationController::SuppressTimerForTest(); 364 LoggedInAsUser(); 365 UpdateDisplay("400x300"); 366 int64 id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); 367 // Set display's resolution in single display. It creates the notification and 368 // display preferences should not stored meanwhile. 369 ash::Shell::GetInstance()->resolution_notification_controller()-> 370 SetDisplayResolutionAndNotify( 371 id, gfx::Size(400, 300), gfx::Size(500, 400), base::Closure()); 372 UpdateDisplay("500x400"); 373 374 const base::DictionaryValue* properties = 375 local_state()->GetDictionary(prefs::kDisplayProperties); 376 const base::DictionaryValue* property = NULL; 377 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id), &property)); 378 int width = 0, height = 0; 379 EXPECT_FALSE(property->GetInteger("width", &width)); 380 EXPECT_FALSE(property->GetInteger("height", &height)); 381 382 // Revert the change. When timeout, 2nd button is revert. 383 message_center::MessageCenter::Get()->ClickOnNotificationButton( 384 ResolutionNotificationController::kNotificationId, 1); 385 RunAllPendingInMessageLoop(); 386 EXPECT_FALSE(message_center::MessageCenter::Get()->HasNotification( 387 ResolutionNotificationController::kNotificationId)); 388 389 // Once the notification is removed, the specified resolution will be stored 390 // by SetDisplayResolution. 391 ash::Shell::GetInstance()->display_manager()->SetDisplayResolution( 392 id, gfx::Size(300, 200)); 393 UpdateDisplay("300x200"); 394 395 property = NULL; 396 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id), &property)); 397 EXPECT_TRUE(property->GetInteger("width", &width)); 398 EXPECT_TRUE(property->GetInteger("height", &height)); 399 EXPECT_EQ(300, width); 400 EXPECT_EQ(200, height); 401} 402 403TEST_F(DisplayPreferencesTest, StoreForSwappedDisplay) { 404 UpdateDisplay("100x100,200x200"); 405 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 406 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 407 408 ash::DisplayController* display_controller = 409 ash::Shell::GetInstance()->display_controller(); 410 display_controller->SwapPrimaryDisplay(); 411 ASSERT_EQ(id1, ash::ScreenAsh::GetSecondaryDisplay().id()); 412 413 LoggedInAsUser(); 414 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 415 SetCurrentDisplayLayout(layout); 416 layout = layout.Invert(); 417 418 const base::DictionaryValue* displays = 419 local_state()->GetDictionary(prefs::kSecondaryDisplays); 420 const base::DictionaryValue* new_value = NULL; 421 std::string key = base::Int64ToString(id1) + "," + base::Int64ToString(id2); 422 EXPECT_TRUE(displays->GetDictionary(key, &new_value)); 423 424 ash::DisplayLayout stored_layout; 425 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout)); 426 EXPECT_EQ(layout.position, stored_layout.position); 427 EXPECT_EQ(layout.offset, stored_layout.offset); 428 EXPECT_EQ(id2, stored_layout.primary_id); 429 430 display_controller->SwapPrimaryDisplay(); 431 EXPECT_TRUE(displays->GetDictionary(key, &new_value)); 432 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout)); 433 EXPECT_EQ(layout.position, stored_layout.position); 434 EXPECT_EQ(layout.offset, stored_layout.offset); 435 EXPECT_EQ(id1, stored_layout.primary_id); 436} 437 438TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) { 439 ash::DisplayController* display_controller = 440 ash::Shell::GetInstance()->display_controller(); 441 ash::internal::DisplayManager* display_manager = 442 ash::Shell::GetInstance()->display_manager(); 443 444 UpdateDisplay("200x200*2,200x200"); 445 446 LoggedInAsGuest(); 447 int64 id1 = ash::ScreenAsh::GetNativeScreen()->GetPrimaryDisplay().id(); 448 gfx::Display::SetInternalDisplayId(id1); 449 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 450 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 451 SetCurrentDisplayLayout(layout); 452 display_manager->SetDisplayUIScale(id1, 1.25f); 453 display_controller->SetPrimaryDisplayId(id2); 454 int64 new_primary = 455 ash::ScreenAsh::GetNativeScreen()->GetPrimaryDisplay().id(); 456 display_controller->SetOverscanInsets( 457 new_primary, 458 gfx::Insets(10, 11, 12, 13)); 459 display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90); 460 461 // Does not store the preferences locally. 462 EXPECT_FALSE(local_state()->FindPreference( 463 prefs::kSecondaryDisplays)->HasUserSetting()); 464 EXPECT_FALSE(local_state()->FindPreference( 465 prefs::kDisplayProperties)->HasUserSetting()); 466 467 // Settings are still notified to the system. 468 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); 469 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id()); 470 EXPECT_EQ(ash::DisplayLayout::BOTTOM, 471 display_controller->GetCurrentDisplayLayout().position); 472 EXPECT_EQ(-10, display_controller->GetCurrentDisplayLayout().offset); 473 const gfx::Display& primary_display = screen->GetPrimaryDisplay(); 474 EXPECT_EQ("178x176", primary_display.bounds().size().ToString()); 475 EXPECT_EQ(gfx::Display::ROTATE_90, primary_display.rotation()); 476 477 const ash::internal::DisplayInfo& info1 = 478 display_manager->GetDisplayInfo(id1); 479 EXPECT_EQ(1.25f, info1.ui_scale()); 480 481 const ash::internal::DisplayInfo& info_primary = 482 display_manager->GetDisplayInfo(new_primary); 483 EXPECT_EQ(gfx::Display::ROTATE_90, info_primary.rotation()); 484 EXPECT_EQ(1.0f, info_primary.ui_scale()); 485} 486 487TEST_F(DisplayPreferencesTest, DisplayPowerStateAfterRestart) { 488 StoreDisplayPowerStateForTest( 489 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON); 490 LoadDisplayPreferences(false); 491 EXPECT_EQ( 492 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, 493 ash::Shell::GetInstance()->output_configurator()->power_state()); 494} 495 496} // namespace chromeos 497