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.
5 #include "chrome/browser/chromeos/display/display_preferences.h"
10 #include "ash/content/display/screen_orientation_controller_chromeos.h"
11 #include "ash/display/display_controller.h"
12 #include "ash/display/display_layout_store.h"
13 #include "ash/display/display_manager.h"
14 #include "ash/display/resolution_notification_controller.h"
15 #include "ash/screen_util.h"
16 #include "ash/shell.h"
17 #include "ash/test/ash_test_base.h"
18 #include "ash/test/display_manager_test_api.h"
19 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
20 #include "base/memory/ref_counted.h"
21 #include "base/prefs/scoped_user_pref_update.h"
22 #include "base/prefs/testing_pref_service.h"
23 #include "base/strings/string_number_conversions.h"
24 #include "base/values.h"
25 #include "chrome/browser/chromeos/display/display_configuration_observer.h"
26 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
27 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
28 #include "chrome/common/pref_names.h"
29 #include "chrome/test/base/testing_browser_process.h"
30 #include "ui/display/chromeos/display_configurator.h"
31 #include "ui/gfx/geometry/vector3d_f.h"
32 #include "ui/gfx/screen.h"
33 #include "ui/message_center/message_center.h"
35 using ash::ResolutionNotificationController
;
39 const char kPrimaryIdKey
[] = "primary-id";
40 const char kMirroredKey
[] = "mirrored";
41 const char kPositionKey
[] = "position";
42 const char kOffsetKey
[] = "offset";
44 // The mean acceleration due to gravity on Earth in m/s^2.
45 const float kMeanGravity
= 9.80665f
;
47 bool IsRotationLocked() {
48 return ash::Shell::GetInstance()
49 ->screen_orientation_controller()
53 std::string
ToPairString(const ash::DisplayIdPair
& pair
) {
54 return base::Int64ToString(pair
.first
) + "," +
55 base::Int64ToString(pair
.second
);
58 class DisplayPreferencesTest
: public ash::test::AshTestBase
{
60 DisplayPreferencesTest()
61 : mock_user_manager_(new MockUserManager
),
62 user_manager_enabler_(mock_user_manager_
) {
65 ~DisplayPreferencesTest() override
{}
67 void SetUp() override
{
68 EXPECT_CALL(*mock_user_manager_
, IsUserLoggedIn())
69 .WillRepeatedly(testing::Return(false));
70 EXPECT_CALL(*mock_user_manager_
, Shutdown());
71 ash::test::AshTestBase::SetUp();
72 RegisterDisplayLocalStatePrefs(local_state_
.registry());
73 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_
);
74 observer_
.reset(new DisplayConfigurationObserver());
77 void TearDown() override
{
79 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL
);
80 ash::test::AshTestBase::TearDown();
83 void LoggedInAsUser() {
84 EXPECT_CALL(*mock_user_manager_
, IsUserLoggedIn())
85 .WillRepeatedly(testing::Return(true));
86 EXPECT_CALL(*mock_user_manager_
, IsLoggedInAsUserWithGaiaAccount())
87 .WillRepeatedly(testing::Return(true));
90 void LoggedInAsGuest() {
91 EXPECT_CALL(*mock_user_manager_
, IsUserLoggedIn())
92 .WillRepeatedly(testing::Return(true));
93 EXPECT_CALL(*mock_user_manager_
, IsLoggedInAsUserWithGaiaAccount())
94 .WillRepeatedly(testing::Return(false));
95 EXPECT_CALL(*mock_user_manager_
, IsLoggedInAsSupervisedUser())
96 .WillRepeatedly(testing::Return(false));
99 // Do not use the implementation of display_preferences.cc directly to avoid
100 // notifying the update to the system.
101 void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair
& pair
,
102 ash::DisplayLayout::Position layout
,
105 std::string name
= ToPairString(pair
);
106 DictionaryPrefUpdate
update(&local_state_
, prefs::kSecondaryDisplays
);
107 ash::DisplayLayout
display_layout(layout
, offset
);
108 display_layout
.primary_id
= primary_id
;
110 DCHECK(!name
.empty());
112 base::DictionaryValue
* pref_data
= update
.Get();
113 scoped_ptr
<base::Value
>layout_value(new base::DictionaryValue());
114 if (pref_data
->HasKey(name
)) {
115 base::Value
* value
= NULL
;
116 if (pref_data
->Get(name
, &value
) && value
!= NULL
)
117 layout_value
.reset(value
->DeepCopy());
119 if (ash::DisplayLayout::ConvertToValue(display_layout
, layout_value
.get()))
120 pref_data
->Set(name
, layout_value
.release());
123 void StoreDisplayPropertyForPair(const ash::DisplayIdPair
& pair
,
125 scoped_ptr
<base::Value
> value
) {
126 std::string name
= ToPairString(pair
);
128 DictionaryPrefUpdate
update(&local_state_
, prefs::kSecondaryDisplays
);
129 base::DictionaryValue
* pref_data
= update
.Get();
131 if (pref_data
->HasKey(name
)) {
132 base::Value
* layout_value
= NULL
;
133 pref_data
->Get(name
, &layout_value
);
135 static_cast<base::DictionaryValue
*>(layout_value
)
136 ->Set(key
, value
.Pass());
138 scoped_ptr
<base::DictionaryValue
> layout_value(
139 new base::DictionaryValue());
140 layout_value
->SetBoolean(key
, value
);
141 pref_data
->Set(name
, layout_value
.release());
145 void StoreDisplayBoolPropertyForPair(const ash::DisplayIdPair
& pair
,
146 const std::string
& key
,
148 StoreDisplayPropertyForPair(
149 pair
, key
, make_scoped_ptr(new base::FundamentalValue(value
)));
152 void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair
& pair
,
153 ash::DisplayLayout::Position layout
,
155 StoreDisplayLayoutPrefForPair(pair
, layout
, offset
, pair
.first
);
158 void StoreDisplayOverscan(int64 id
, const gfx::Insets
& insets
) {
159 DictionaryPrefUpdate
update(&local_state_
, prefs::kDisplayProperties
);
160 const std::string name
= base::Int64ToString(id
);
162 base::DictionaryValue
* pref_data
= update
.Get();
163 base::DictionaryValue
* insets_value
= new base::DictionaryValue();
164 insets_value
->SetInteger("insets_top", insets
.top());
165 insets_value
->SetInteger("insets_left", insets
.left());
166 insets_value
->SetInteger("insets_bottom", insets
.bottom());
167 insets_value
->SetInteger("insets_right", insets
.right());
168 pref_data
->Set(name
, insets_value
);
171 void StoreColorProfile(int64 id
, const std::string
& profile
) {
172 DictionaryPrefUpdate
update(&local_state_
, prefs::kDisplayProperties
);
173 const std::string name
= base::Int64ToString(id
);
175 base::DictionaryValue
* pref_data
= update
.Get();
176 base::DictionaryValue
* property
= new base::DictionaryValue();
177 property
->SetString("color_profile_name", profile
);
178 pref_data
->Set(name
, property
);
181 void StoreDisplayRotationPrefsForTest(bool rotation_lock
,
182 gfx::Display::Rotation rotation
) {
183 DictionaryPrefUpdate
update(local_state(), prefs::kDisplayRotationLock
);
184 base::DictionaryValue
* pref_data
= update
.Get();
185 pref_data
->SetBoolean("lock", rotation_lock
);
186 pref_data
->SetInteger("orientation", static_cast<int>(rotation
));
189 std::string
GetRegisteredDisplayLayoutStr(const ash::DisplayIdPair
& pair
) {
190 return ash::Shell::GetInstance()->display_manager()->layout_store()->
191 GetRegisteredDisplayLayout(pair
).ToString();
194 PrefService
* local_state() { return &local_state_
; }
197 MockUserManager
* mock_user_manager_
; // Not owned.
198 ScopedUserManagerEnabler user_manager_enabler_
;
199 TestingPrefServiceSimple local_state_
;
200 scoped_ptr
<DisplayConfigurationObserver
> observer_
;
202 DISALLOW_COPY_AND_ASSIGN(DisplayPreferencesTest
);
207 TEST_F(DisplayPreferencesTest
, PairedLayoutOverrides
) {
208 UpdateDisplay("100x100,200x200");
209 ash::DisplayManager
* display_manager
=
210 ash::Shell::GetInstance()->display_manager();
212 ash::DisplayIdPair pair
= display_manager
->GetCurrentDisplayIdPair();
213 ash::DisplayIdPair dummy_pair
= std::make_pair(pair
.first
, pair
.second
+ 1);
214 ASSERT_NE(pair
.first
, dummy_pair
.second
);
216 StoreDisplayLayoutPrefForPair(pair
, ash::DisplayLayout::TOP
, 20);
217 StoreDisplayLayoutPrefForPair(dummy_pair
, ash::DisplayLayout::LEFT
, 30);
218 StoreDisplayPowerStateForTest(
219 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON
);
221 ash::Shell
* shell
= ash::Shell::GetInstance();
223 LoadDisplayPreferences(true);
224 // DisplayPowerState should be ignored at boot.
225 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON
,
226 shell
->display_configurator()->requested_power_state());
228 shell
->display_manager()->UpdateDisplays();
229 // Check if the layout settings are notified to the system properly.
230 // The paired layout overrides old layout.
231 // Inverted one of for specified pair (id1, id2). Not used for the pair
232 // (id1, dummy_id) since dummy_id is not connected right now.
234 shell
->display_manager()->GetCurrentDisplayLayout().ToString());
235 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(pair
));
236 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(dummy_pair
));
239 TEST_F(DisplayPreferencesTest
, BasicStores
) {
240 ash::DisplayController
* display_controller
=
241 ash::Shell::GetInstance()->display_controller();
242 ash::DisplayManager
* display_manager
=
243 ash::Shell::GetInstance()->display_manager();
245 UpdateDisplay("200x200*2, 400x300#400x400|300x200*1.25");
246 int64 id1
= gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
247 ash::test::DisplayManagerTestApi
test_api(display_manager
);
248 test_api
.SetInternalDisplayId(id1
);
249 int64 id2
= ash::ScreenUtil::GetSecondaryDisplay().id();
250 int64 dummy_id
= id2
+ 1;
251 ASSERT_NE(id1
, dummy_id
);
252 std::vector
<ui::ColorCalibrationProfile
> profiles
;
253 profiles
.push_back(ui::COLOR_PROFILE_STANDARD
);
254 profiles
.push_back(ui::COLOR_PROFILE_DYNAMIC
);
255 profiles
.push_back(ui::COLOR_PROFILE_MOVIE
);
256 profiles
.push_back(ui::COLOR_PROFILE_READING
);
257 // Allows only |id1|.
258 test_api
.SetAvailableColorProfiles(id1
, profiles
);
259 display_manager
->SetColorCalibrationProfile(id1
, ui::COLOR_PROFILE_DYNAMIC
);
260 display_manager
->SetColorCalibrationProfile(id2
, ui::COLOR_PROFILE_DYNAMIC
);
263 ash::DisplayLayout
layout(ash::DisplayLayout::TOP
, 10);
264 SetCurrentDisplayLayout(layout
);
265 StoreDisplayLayoutPrefForTest(
266 id1
, dummy_id
, ash::DisplayLayout(ash::DisplayLayout::LEFT
, 20));
267 // Can't switch to a display that does not exist.
268 display_controller
->SetPrimaryDisplayId(dummy_id
);
269 EXPECT_NE(dummy_id
, ash::Shell::GetScreen()->GetPrimaryDisplay().id());
271 display_controller
->SetOverscanInsets(id1
, gfx::Insets(10, 11, 12, 13));
272 display_manager
->SetDisplayRotation(id1
, gfx::Display::ROTATE_90
,
273 gfx::Display::ROTATION_SOURCE_USER
);
274 EXPECT_TRUE(display_manager
->SetDisplayUIScale(id1
, 1.25f
));
275 EXPECT_FALSE(display_manager
->SetDisplayUIScale(id2
, 1.25f
));
277 const base::DictionaryValue
* displays
=
278 local_state()->GetDictionary(prefs::kSecondaryDisplays
);
279 const base::DictionaryValue
* layout_value
= NULL
;
280 std::string key
= base::Int64ToString(id1
) + "," + base::Int64ToString(id2
);
281 EXPECT_TRUE(displays
->GetDictionary(key
, &layout_value
));
283 ash::DisplayLayout stored_layout
;
284 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*layout_value
,
286 EXPECT_EQ(layout
.position
, stored_layout
.position
);
287 EXPECT_EQ(layout
.offset
, stored_layout
.offset
);
289 bool mirrored
= true;
290 EXPECT_TRUE(layout_value
->GetBoolean(kMirroredKey
, &mirrored
));
291 EXPECT_FALSE(mirrored
);
293 const base::DictionaryValue
* properties
=
294 local_state()->GetDictionary(prefs::kDisplayProperties
);
295 const base::DictionaryValue
* property
= NULL
;
296 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id1
), &property
));
299 EXPECT_TRUE(property
->GetInteger("rotation", &rotation
));
300 EXPECT_TRUE(property
->GetInteger("ui-scale", &ui_scale
));
301 EXPECT_EQ(1, rotation
);
302 EXPECT_EQ(1250, ui_scale
);
304 // Internal display never registered the resolution.
305 int width
= 0, height
= 0;
306 EXPECT_FALSE(property
->GetInteger("width", &width
));
307 EXPECT_FALSE(property
->GetInteger("height", &height
));
309 int top
= 0, left
= 0, bottom
= 0, right
= 0;
310 EXPECT_TRUE(property
->GetInteger("insets_top", &top
));
311 EXPECT_TRUE(property
->GetInteger("insets_left", &left
));
312 EXPECT_TRUE(property
->GetInteger("insets_bottom", &bottom
));
313 EXPECT_TRUE(property
->GetInteger("insets_right", &right
));
316 EXPECT_EQ(12, bottom
);
317 EXPECT_EQ(13, right
);
319 std::string color_profile
;
320 EXPECT_TRUE(property
->GetString("color_profile_name", &color_profile
));
321 EXPECT_EQ("dynamic", color_profile
);
323 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id2
), &property
));
324 EXPECT_TRUE(property
->GetInteger("rotation", &rotation
));
325 EXPECT_TRUE(property
->GetInteger("ui-scale", &ui_scale
));
326 EXPECT_EQ(0, rotation
);
327 // ui_scale works only on 2x scale factor/1st display.
328 EXPECT_EQ(1000, ui_scale
);
329 EXPECT_FALSE(property
->GetInteger("insets_top", &top
));
330 EXPECT_FALSE(property
->GetInteger("insets_left", &left
));
331 EXPECT_FALSE(property
->GetInteger("insets_bottom", &bottom
));
332 EXPECT_FALSE(property
->GetInteger("insets_right", &right
));
334 // |id2| doesn't have the color_profile because it doesn't have 'dynamic' in
335 // its available list.
336 EXPECT_FALSE(property
->GetString("color_profile_name", &color_profile
));
338 // Resolution is saved only when the resolution is set
339 // by DisplayManager::SetDisplayMode
342 EXPECT_FALSE(property
->GetInteger("width", &width
));
343 EXPECT_FALSE(property
->GetInteger("height", &height
));
345 ash::DisplayMode
mode(gfx::Size(300, 200), 60.0f
, false, true);
346 mode
.device_scale_factor
= 1.25f
;
347 display_manager
->SetDisplayMode(id2
, mode
);
349 display_controller
->SetPrimaryDisplayId(id2
);
351 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id1
), &property
));
354 // Internal display shouldn't store its resolution.
355 EXPECT_FALSE(property
->GetInteger("width", &width
));
356 EXPECT_FALSE(property
->GetInteger("height", &height
));
358 // External display's resolution must be stored this time because
360 int device_scale_factor
= 0;
361 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id2
), &property
));
362 EXPECT_TRUE(property
->GetInteger("width", &width
));
363 EXPECT_TRUE(property
->GetInteger("height", &height
));
364 EXPECT_TRUE(property
->GetInteger(
365 "device-scale-factor", &device_scale_factor
));
366 EXPECT_EQ(300, width
);
367 EXPECT_EQ(200, height
);
368 EXPECT_EQ(1250, device_scale_factor
);
370 // The layout remains the same.
371 EXPECT_TRUE(displays
->GetDictionary(key
, &layout_value
));
372 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*layout_value
,
374 EXPECT_EQ(layout
.position
, stored_layout
.position
);
375 EXPECT_EQ(layout
.offset
, stored_layout
.offset
);
376 EXPECT_EQ(id2
, stored_layout
.primary_id
);
379 EXPECT_TRUE(layout_value
->GetBoolean(kMirroredKey
, &mirrored
));
380 EXPECT_FALSE(mirrored
);
381 std::string primary_id_str
;
382 EXPECT_TRUE(layout_value
->GetString(kPrimaryIdKey
, &primary_id_str
));
383 EXPECT_EQ(base::Int64ToString(id2
), primary_id_str
);
385 SetCurrentDisplayLayout(
386 ash::DisplayLayout(ash::DisplayLayout::BOTTOM
, 20));
388 UpdateDisplay("1+0-200x200*2,1+0-200x200");
391 std::string position
;
392 EXPECT_TRUE(displays
->GetDictionary(key
, &layout_value
));
393 EXPECT_TRUE(layout_value
->GetString(kPositionKey
, &position
));
394 EXPECT_EQ("top", position
);
395 EXPECT_TRUE(layout_value
->GetInteger(kOffsetKey
, &offset
));
396 EXPECT_EQ(-20, offset
);
398 EXPECT_TRUE(layout_value
->GetBoolean(kMirroredKey
, &mirrored
));
399 EXPECT_TRUE(mirrored
);
400 EXPECT_TRUE(layout_value
->GetString(kPrimaryIdKey
, &primary_id_str
));
401 EXPECT_EQ(base::Int64ToString(id2
), primary_id_str
);
403 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id1
), &property
));
404 EXPECT_FALSE(property
->GetInteger("width", &width
));
405 EXPECT_FALSE(property
->GetInteger("height", &height
));
407 // External display's selected resolution must not change
409 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id2
), &property
));
410 EXPECT_TRUE(property
->GetInteger("width", &width
));
411 EXPECT_TRUE(property
->GetInteger("height", &height
));
412 EXPECT_EQ(300, width
);
413 EXPECT_EQ(200, height
);
415 // Set new display's selected resolution.
416 display_manager
->RegisterDisplayProperty(
417 id2
+ 1, gfx::Display::ROTATE_0
, 1.0f
, NULL
, gfx::Size(500, 400), 1.0f
,
418 ui::COLOR_PROFILE_STANDARD
);
420 UpdateDisplay("200x200*2, 600x500#600x500|500x400");
422 // Update key as the 2nd display gets new id.
423 id2
= ash::ScreenUtil::GetSecondaryDisplay().id();
424 key
= base::Int64ToString(id1
) + "," + base::Int64ToString(id2
);
425 EXPECT_TRUE(displays
->GetDictionary(key
, &layout_value
));
426 EXPECT_TRUE(layout_value
->GetString(kPositionKey
, &position
));
427 EXPECT_EQ("right", position
);
428 EXPECT_TRUE(layout_value
->GetInteger(kOffsetKey
, &offset
));
429 EXPECT_EQ(0, offset
);
431 EXPECT_TRUE(layout_value
->GetBoolean(kMirroredKey
, &mirrored
));
432 EXPECT_FALSE(mirrored
);
433 EXPECT_TRUE(layout_value
->GetString(kPrimaryIdKey
, &primary_id_str
));
434 EXPECT_EQ(base::Int64ToString(id1
), primary_id_str
);
436 // Best resolution should not be saved.
437 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id2
), &property
));
438 EXPECT_FALSE(property
->GetInteger("width", &width
));
439 EXPECT_FALSE(property
->GetInteger("height", &height
));
441 // Set yet another new display's selected resolution.
442 display_manager
->RegisterDisplayProperty(
443 id2
+ 1, gfx::Display::ROTATE_0
, 1.0f
, NULL
, gfx::Size(500, 400), 1.0f
,
444 ui::COLOR_PROFILE_STANDARD
);
445 // Disconnect 2nd display first to generate new id for external display.
446 UpdateDisplay("200x200*2");
447 UpdateDisplay("200x200*2, 500x400#600x500|500x400%60.0f");
448 // Update key as the 2nd display gets new id.
449 id2
= ash::ScreenUtil::GetSecondaryDisplay().id();
450 key
= base::Int64ToString(id1
) + "," + base::Int64ToString(id2
);
451 EXPECT_TRUE(displays
->GetDictionary(key
, &layout_value
));
452 EXPECT_TRUE(layout_value
->GetString(kPositionKey
, &position
));
453 EXPECT_EQ("right", position
);
454 EXPECT_TRUE(layout_value
->GetInteger(kOffsetKey
, &offset
));
455 EXPECT_EQ(0, offset
);
457 EXPECT_TRUE(layout_value
->GetBoolean(kMirroredKey
, &mirrored
));
458 EXPECT_FALSE(mirrored
);
459 EXPECT_TRUE(layout_value
->GetString(kPrimaryIdKey
, &primary_id_str
));
460 EXPECT_EQ(base::Int64ToString(id1
), primary_id_str
);
462 // External display's selected resolution must be updated.
463 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id2
), &property
));
464 EXPECT_TRUE(property
->GetInteger("width", &width
));
465 EXPECT_TRUE(property
->GetInteger("height", &height
));
466 EXPECT_EQ(500, width
);
467 EXPECT_EQ(400, height
);
470 TEST_F(DisplayPreferencesTest
, PreventStore
) {
471 ResolutionNotificationController::SuppressTimerForTest();
473 UpdateDisplay("400x300#500x400|400x300|300x200");
474 int64 id
= ash::Shell::GetScreen()->GetPrimaryDisplay().id();
475 // Set display's resolution in single display. It creates the notification and
476 // display preferences should not stored meanwhile.
477 ash::Shell
* shell
= ash::Shell::GetInstance();
478 ash::DisplayMode old_mode
;
479 ash::DisplayMode new_mode
;
480 old_mode
.size
= gfx::Size(400, 300);
481 new_mode
.size
= gfx::Size(500, 400);
482 if (shell
->display_manager()->SetDisplayMode(id
, new_mode
)) {
483 shell
->resolution_notification_controller()->PrepareNotification(
484 id
, old_mode
, new_mode
, base::Closure());
486 UpdateDisplay("500x400#500x400|400x300|300x200");
488 const base::DictionaryValue
* properties
=
489 local_state()->GetDictionary(prefs::kDisplayProperties
);
490 const base::DictionaryValue
* property
= NULL
;
491 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id
), &property
));
492 int width
= 0, height
= 0;
493 EXPECT_FALSE(property
->GetInteger("width", &width
));
494 EXPECT_FALSE(property
->GetInteger("height", &height
));
496 // Revert the change. When timeout, 2nd button is revert.
497 message_center::MessageCenter::Get()->ClickOnNotificationButton(
498 ResolutionNotificationController::kNotificationId
, 1);
499 RunAllPendingInMessageLoop();
501 message_center::MessageCenter::Get()->FindVisibleNotificationById(
502 ResolutionNotificationController::kNotificationId
));
504 // Once the notification is removed, the specified resolution will be stored
505 // by SetDisplayMode.
506 ash::Shell::GetInstance()->display_manager()->SetDisplayMode(
507 id
, ash::DisplayMode(gfx::Size(300, 200), 60.0f
, false, true));
508 UpdateDisplay("300x200#500x400|400x300|300x200");
511 EXPECT_TRUE(properties
->GetDictionary(base::Int64ToString(id
), &property
));
512 EXPECT_TRUE(property
->GetInteger("width", &width
));
513 EXPECT_TRUE(property
->GetInteger("height", &height
));
514 EXPECT_EQ(300, width
);
515 EXPECT_EQ(200, height
);
518 TEST_F(DisplayPreferencesTest
, StoreForSwappedDisplay
) {
519 UpdateDisplay("100x100,200x200");
520 int64 id1
= gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
521 int64 id2
= ash::ScreenUtil::GetSecondaryDisplay().id();
523 ash::DisplayController
* display_controller
=
524 ash::Shell::GetInstance()->display_controller();
525 display_controller
->SwapPrimaryDisplay();
526 ASSERT_EQ(id1
, ash::ScreenUtil::GetSecondaryDisplay().id());
529 ash::DisplayLayout
layout(ash::DisplayLayout::TOP
, 10);
530 SetCurrentDisplayLayout(layout
);
531 layout
= layout
.Invert();
533 const base::DictionaryValue
* displays
=
534 local_state()->GetDictionary(prefs::kSecondaryDisplays
);
535 const base::DictionaryValue
* new_value
= NULL
;
536 std::string key
= base::Int64ToString(id1
) + "," + base::Int64ToString(id2
);
537 EXPECT_TRUE(displays
->GetDictionary(key
, &new_value
));
539 ash::DisplayLayout stored_layout
;
540 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value
, &stored_layout
));
541 EXPECT_EQ(layout
.position
, stored_layout
.position
);
542 EXPECT_EQ(layout
.offset
, stored_layout
.offset
);
543 EXPECT_EQ(id2
, stored_layout
.primary_id
);
545 display_controller
->SwapPrimaryDisplay();
546 EXPECT_TRUE(displays
->GetDictionary(key
, &new_value
));
547 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value
, &stored_layout
));
548 EXPECT_EQ(layout
.position
, stored_layout
.position
);
549 EXPECT_EQ(layout
.offset
, stored_layout
.offset
);
550 EXPECT_EQ(id1
, stored_layout
.primary_id
);
553 TEST_F(DisplayPreferencesTest
, RestoreColorProfiles
) {
554 ash::DisplayManager
* display_manager
=
555 ash::Shell::GetInstance()->display_manager();
557 int64 id1
= gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
559 StoreColorProfile(id1
, "dynamic");
562 LoadDisplayPreferences(false);
564 // id1's available color profiles list is empty, means somehow the color
565 // profile suport is temporary in trouble.
566 EXPECT_NE(ui::COLOR_PROFILE_DYNAMIC
,
567 display_manager
->GetDisplayInfo(id1
).color_profile());
569 // Once the profile is supported, the color profile should be restored.
570 std::vector
<ui::ColorCalibrationProfile
> profiles
;
571 profiles
.push_back(ui::COLOR_PROFILE_STANDARD
);
572 profiles
.push_back(ui::COLOR_PROFILE_DYNAMIC
);
573 profiles
.push_back(ui::COLOR_PROFILE_MOVIE
);
574 profiles
.push_back(ui::COLOR_PROFILE_READING
);
575 ash::test::DisplayManagerTestApi
test_api(display_manager
);
576 test_api
.SetAvailableColorProfiles(id1
, profiles
);
578 LoadDisplayPreferences(false);
579 EXPECT_EQ(ui::COLOR_PROFILE_DYNAMIC
,
580 display_manager
->GetDisplayInfo(id1
).color_profile());
583 TEST_F(DisplayPreferencesTest
, DontStoreInGuestMode
) {
584 ash::DisplayController
* display_controller
=
585 ash::Shell::GetInstance()->display_controller();
586 ash::DisplayManager
* display_manager
=
587 ash::Shell::GetInstance()->display_manager();
589 UpdateDisplay("200x200*2,200x200");
592 int64 id1
= ash::Shell::GetScreen()->GetPrimaryDisplay().id();
593 ash::test::DisplayManagerTestApi(display_manager
)
594 .SetInternalDisplayId(id1
);
595 int64 id2
= ash::ScreenUtil::GetSecondaryDisplay().id();
596 ash::DisplayLayout
layout(ash::DisplayLayout::TOP
, 10);
597 SetCurrentDisplayLayout(layout
);
598 display_manager
->SetDisplayUIScale(id1
, 1.25f
);
599 display_controller
->SetPrimaryDisplayId(id2
);
600 int64 new_primary
= ash::Shell::GetScreen()->GetPrimaryDisplay().id();
601 display_controller
->SetOverscanInsets(
603 gfx::Insets(10, 11, 12, 13));
604 display_manager
->SetDisplayRotation(new_primary
, gfx::Display::ROTATE_90
,
605 gfx::Display::ROTATION_SOURCE_USER
);
607 // Does not store the preferences locally.
608 EXPECT_FALSE(local_state()->FindPreference(
609 prefs::kSecondaryDisplays
)->HasUserSetting());
610 EXPECT_FALSE(local_state()->FindPreference(
611 prefs::kDisplayProperties
)->HasUserSetting());
613 // Settings are still notified to the system.
614 gfx::Screen
* screen
= gfx::Screen::GetNativeScreen();
615 EXPECT_EQ(id2
, screen
->GetPrimaryDisplay().id());
616 EXPECT_EQ(ash::DisplayLayout::BOTTOM
,
617 display_manager
->GetCurrentDisplayLayout().position
);
618 EXPECT_EQ(-10, display_manager
->GetCurrentDisplayLayout().offset
);
619 const gfx::Display
& primary_display
= screen
->GetPrimaryDisplay();
620 EXPECT_EQ("178x176", primary_display
.bounds().size().ToString());
621 EXPECT_EQ(gfx::Display::ROTATE_90
, primary_display
.rotation());
623 const ash::DisplayInfo
& info1
= display_manager
->GetDisplayInfo(id1
);
624 EXPECT_EQ(1.25f
, info1
.configured_ui_scale());
626 const ash::DisplayInfo
& info_primary
=
627 display_manager
->GetDisplayInfo(new_primary
);
628 EXPECT_EQ(gfx::Display::ROTATE_90
, info_primary
.GetActiveRotation());
629 EXPECT_EQ(1.0f
, info_primary
.configured_ui_scale());
632 TEST_F(DisplayPreferencesTest
, StorePowerStateNoLogin
) {
633 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayPowerState
));
635 // Stores display prefs without login, which still stores the power state.
637 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayPowerState
));
640 TEST_F(DisplayPreferencesTest
, StorePowerStateGuest
) {
641 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayPowerState
));
645 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayPowerState
));
648 TEST_F(DisplayPreferencesTest
, StorePowerStateNormalUser
) {
649 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayPowerState
));
653 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayPowerState
));
656 TEST_F(DisplayPreferencesTest
, DisplayPowerStateAfterRestart
) {
657 StoreDisplayPowerStateForTest(
658 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON
);
659 LoadDisplayPreferences(false);
660 EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON
,
661 ash::Shell::GetInstance()->display_configurator()->
662 requested_power_state());
665 TEST_F(DisplayPreferencesTest
, DontSaveAndRestoreAllOff
) {
666 ash::Shell
* shell
= ash::Shell::GetInstance();
667 StoreDisplayPowerStateForTest(
668 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON
);
669 LoadDisplayPreferences(false);
670 // DisplayPowerState should be ignored at boot.
671 EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON
,
672 shell
->display_configurator()->requested_power_state());
674 StoreDisplayPowerStateForTest(
675 chromeos::DISPLAY_POWER_ALL_OFF
);
676 EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON
,
677 shell
->display_configurator()->requested_power_state());
678 EXPECT_EQ("internal_off_external_on",
679 local_state()->GetString(prefs::kDisplayPowerState
));
682 local_state()->SetString(prefs::kDisplayPowerState
, "all_off");
683 LoadDisplayPreferences(false);
684 EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON
,
685 shell
->display_configurator()->requested_power_state());
688 // Tests that display configuration changes caused by MaximizeModeController
690 TEST_F(DisplayPreferencesTest
, DontSaveMaximizeModeControllerRotations
) {
691 ash::Shell
* shell
= ash::Shell::GetInstance();
692 gfx::Display::SetInternalDisplayId(
693 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
694 ash::DisplayManager
* display_manager
= shell
->display_manager();
696 // Populate the properties.
697 display_manager
->SetDisplayRotation(gfx::Display::InternalDisplayId(),
698 gfx::Display::ROTATE_180
,
699 gfx::Display::ROTATION_SOURCE_USER
);
700 // Reset property to avoid rotation lock
701 display_manager
->SetDisplayRotation(gfx::Display::InternalDisplayId(),
702 gfx::Display::ROTATE_0
,
703 gfx::Display::ROTATION_SOURCE_USER
);
705 // Open up 270 degrees to trigger maximize mode
706 scoped_refptr
<chromeos::AccelerometerUpdate
> update(
707 new chromeos::AccelerometerUpdate());
708 update
->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD
, 0.0f
, 0.0f
,
710 update
->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN
, 0.0f
, -kMeanGravity
, 0.0f
);
711 ash::MaximizeModeController
* controller
= shell
->maximize_mode_controller();
712 controller
->OnAccelerometerUpdated(update
);
713 EXPECT_TRUE(controller
->IsMaximizeModeWindowManagerEnabled());
715 // Trigger 90 degree rotation
716 update
->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD
, -kMeanGravity
,
718 update
->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN
, -kMeanGravity
, 0.0f
, 0.0f
);
719 controller
->OnAccelerometerUpdated(update
);
720 shell
->screen_orientation_controller()->OnAccelerometerUpdated(update
);
721 EXPECT_EQ(gfx::Display::ROTATE_90
, GetCurrentInternalDisplayRotation());
723 const base::DictionaryValue
* properties
=
724 local_state()->GetDictionary(prefs::kDisplayProperties
);
725 const base::DictionaryValue
* property
= NULL
;
726 EXPECT_TRUE(properties
->GetDictionary(
727 base::Int64ToString(gfx::Display::InternalDisplayId()), &property
));
729 EXPECT_TRUE(property
->GetInteger("rotation", &rotation
));
730 EXPECT_EQ(gfx::Display::ROTATE_0
, rotation
);
732 // Trigger a save, the acceleration rotation should not be saved as the user
735 properties
= local_state()->GetDictionary(prefs::kDisplayProperties
);
737 EXPECT_TRUE(properties
->GetDictionary(
738 base::Int64ToString(gfx::Display::InternalDisplayId()), &property
));
740 EXPECT_TRUE(property
->GetInteger("rotation", &rotation
));
741 EXPECT_EQ(gfx::Display::ROTATE_0
, rotation
);
744 // Tests that the rotation state is saved without a user being logged in.
745 TEST_F(DisplayPreferencesTest
, StoreRotationStateNoLogin
) {
746 gfx::Display::SetInternalDisplayId(
747 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
748 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
750 bool current_rotation_lock
= IsRotationLocked();
751 StoreDisplayRotationPrefs(current_rotation_lock
);
752 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
754 const base::DictionaryValue
* properties
=
755 local_state()->GetDictionary(prefs::kDisplayRotationLock
);
757 EXPECT_TRUE(properties
->GetBoolean("lock", &rotation_lock
));
758 EXPECT_EQ(current_rotation_lock
, rotation_lock
);
761 gfx::Display::Rotation current_rotation
= GetCurrentInternalDisplayRotation();
762 EXPECT_TRUE(properties
->GetInteger("orientation", &orientation
));
763 EXPECT_EQ(current_rotation
, orientation
);
766 // Tests that the rotation state is saved when a guest is logged in.
767 TEST_F(DisplayPreferencesTest
, StoreRotationStateGuest
) {
768 gfx::Display::SetInternalDisplayId(
769 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
770 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
773 bool current_rotation_lock
= IsRotationLocked();
774 StoreDisplayRotationPrefs(current_rotation_lock
);
775 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
777 const base::DictionaryValue
* properties
=
778 local_state()->GetDictionary(prefs::kDisplayRotationLock
);
780 EXPECT_TRUE(properties
->GetBoolean("lock", &rotation_lock
));
781 EXPECT_EQ(current_rotation_lock
, rotation_lock
);
784 gfx::Display::Rotation current_rotation
= GetCurrentInternalDisplayRotation();
785 EXPECT_TRUE(properties
->GetInteger("orientation", &orientation
));
786 EXPECT_EQ(current_rotation
, orientation
);
789 // Tests that the rotation state is saved when a normal user is logged in.
790 TEST_F(DisplayPreferencesTest
, StoreRotationStateNormalUser
) {
791 gfx::Display::SetInternalDisplayId(
792 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
793 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
796 bool current_rotation_lock
= IsRotationLocked();
797 StoreDisplayRotationPrefs(current_rotation_lock
);
798 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
800 const base::DictionaryValue
* properties
=
801 local_state()->GetDictionary(prefs::kDisplayRotationLock
);
803 EXPECT_TRUE(properties
->GetBoolean("lock", &rotation_lock
));
804 EXPECT_EQ(current_rotation_lock
, rotation_lock
);
807 gfx::Display::Rotation current_rotation
= GetCurrentInternalDisplayRotation();
808 EXPECT_TRUE(properties
->GetInteger("orientation", &orientation
));
809 EXPECT_EQ(current_rotation
, orientation
);
812 // Tests that rotation state is loaded without a user being logged in, and that
813 // entering maximize mode applies the state.
814 TEST_F(DisplayPreferencesTest
, LoadRotationNoLogin
) {
815 gfx::Display::SetInternalDisplayId(
816 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
817 ASSERT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
819 ash::Shell
* shell
= ash::Shell::GetInstance();
820 bool initial_rotation_lock
= IsRotationLocked();
821 ASSERT_FALSE(initial_rotation_lock
);
822 ash::DisplayManager
* display_manager
= shell
->display_manager();
823 gfx::Display::Rotation initial_rotation
= GetCurrentInternalDisplayRotation();
824 ASSERT_EQ(gfx::Display::ROTATE_0
, initial_rotation
);
826 StoreDisplayRotationPrefs(initial_rotation_lock
);
827 ASSERT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
829 StoreDisplayRotationPrefsForTest(true, gfx::Display::ROTATE_90
);
830 LoadDisplayPreferences(false);
832 bool display_rotation_lock
=
833 display_manager
->registered_internal_display_rotation_lock();
834 bool display_rotation
=
835 display_manager
->registered_internal_display_rotation();
836 EXPECT_TRUE(display_rotation_lock
);
837 EXPECT_EQ(gfx::Display::ROTATE_90
, display_rotation
);
839 bool rotation_lock
= IsRotationLocked();
840 gfx::Display::Rotation before_maximize_mode_rotation
=
841 GetCurrentInternalDisplayRotation();
843 // Settings should not be applied until maximize mode activates
844 EXPECT_FALSE(rotation_lock
);
845 EXPECT_EQ(gfx::Display::ROTATE_0
, before_maximize_mode_rotation
);
847 // Open up 270 degrees to trigger maximize mode
848 scoped_refptr
<chromeos::AccelerometerUpdate
> update(
849 new chromeos::AccelerometerUpdate());
850 update
->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD
, 0.0f
, 0.0f
,
852 update
->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN
, 0.0f
, -kMeanGravity
, 0.0f
);
853 ash::MaximizeModeController
* maximize_mode_controller
=
854 shell
->maximize_mode_controller();
855 maximize_mode_controller
->OnAccelerometerUpdated(update
);
856 EXPECT_TRUE(maximize_mode_controller
->IsMaximizeModeWindowManagerEnabled());
857 bool screen_orientation_rotation_lock
= IsRotationLocked();
858 gfx::Display::Rotation maximize_mode_rotation
=
859 GetCurrentInternalDisplayRotation();
860 EXPECT_TRUE(screen_orientation_rotation_lock
);
861 EXPECT_EQ(gfx::Display::ROTATE_90
, maximize_mode_rotation
);
864 // Tests that rotation lock being set causes the rotation state to be saved.
865 TEST_F(DisplayPreferencesTest
, RotationLockTriggersStore
) {
866 gfx::Display::SetInternalDisplayId(
867 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
868 ASSERT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
870 ash::Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked(
873 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock
));
875 const base::DictionaryValue
* properties
=
876 local_state()->GetDictionary(prefs::kDisplayRotationLock
);
878 EXPECT_TRUE(properties
->GetBoolean("lock", &rotation_lock
));
881 TEST_F(DisplayPreferencesTest
, SaveUnifiedMode
) {
882 ash::test::DisplayManagerTestApi::EnableUnifiedDesktopForTest();
885 ash::DisplayManager
* display_manager
=
886 ash::Shell::GetInstance()->display_manager();
888 UpdateDisplay("100x100,200x200");
889 ash::DisplayIdPair pair
= display_manager
->GetCurrentDisplayIdPair();
892 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size().ToString());
894 const base::DictionaryValue
* secondary_displays
=
895 local_state()->GetDictionary(prefs::kSecondaryDisplays
);
896 const base::DictionaryValue
* new_value
= NULL
;
898 secondary_displays
->GetDictionary(ToPairString(pair
), &new_value
));
900 ash::DisplayLayout stored_layout
;
901 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value
, &stored_layout
));
902 EXPECT_TRUE(stored_layout
.default_unified
);
903 EXPECT_FALSE(stored_layout
.mirrored
);
905 const base::DictionaryValue
* displays
=
906 local_state()->GetDictionary(prefs::kDisplayProperties
);
907 int64 unified_id
= gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
909 displays
->GetDictionary(base::Int64ToString(unified_id
), &new_value
));
911 EXPECT_FALSE(new_value
->GetInteger("ui-scale", &ui_scale
));
913 display_manager
->SetDisplayUIScale(unified_id
, 0.5f
);
916 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size().ToString());
918 displays
->GetDictionary(base::Int64ToString(unified_id
), &new_value
));
919 EXPECT_FALSE(new_value
->GetInteger("ui-scale", &ui_scale
));
921 // Mirror mode should remember if the default mode was unified.
922 display_manager
->SetMirrorMode(true);
924 secondary_displays
->GetDictionary(ToPairString(pair
), &new_value
));
925 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value
, &stored_layout
));
926 EXPECT_TRUE(stored_layout
.default_unified
);
927 EXPECT_TRUE(stored_layout
.mirrored
);
929 display_manager
->SetMirrorMode(false);
931 secondary_displays
->GetDictionary(ToPairString(pair
), &new_value
));
932 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value
, &stored_layout
));
933 EXPECT_TRUE(stored_layout
.default_unified
);
934 EXPECT_FALSE(stored_layout
.mirrored
);
936 // Exit unified mode.
937 display_manager
->SetDefaultMultiDisplayMode(ash::DisplayManager::EXTENDED
);
938 display_manager
->ReconfigureDisplays();
940 secondary_displays
->GetDictionary(ToPairString(pair
), &new_value
));
941 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value
, &stored_layout
));
942 EXPECT_FALSE(stored_layout
.default_unified
);
943 EXPECT_FALSE(stored_layout
.mirrored
);
946 TEST_F(DisplayPreferencesTest
, RestoreUnifiedMode
) {
947 int64 id1
= gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
948 ash::DisplayIdPair pair
= std::make_pair(id1
, id1
+ 1);
949 StoreDisplayBoolPropertyForPair(pair
, "default_unified", true);
950 StoreDisplayPropertyForPair(
952 make_scoped_ptr(new base::StringValue(base::Int64ToString(id1
))));
953 LoadDisplayPreferences(false);
955 // Should not restore to unified unless unified desktop is enabled.
956 UpdateDisplay("100x100,200x200");
957 ash::DisplayManager
* display_manager
=
958 ash::Shell::GetInstance()->display_manager();
959 EXPECT_FALSE(display_manager
->IsInUnifiedMode());
961 // Restored to unified.
962 ash::test::DisplayManagerTestApi::EnableUnifiedDesktopForTest();
963 StoreDisplayBoolPropertyForPair(pair
, "default_unified", true);
964 LoadDisplayPreferences(false);
965 UpdateDisplay("100x100,200x200");
966 EXPECT_TRUE(display_manager
->IsInUnifiedMode());
968 // Restored to mirror, then unified.
969 StoreDisplayBoolPropertyForPair(pair
, "mirrored", true);
970 StoreDisplayBoolPropertyForPair(pair
, "default_unified", true);
971 LoadDisplayPreferences(false);
972 UpdateDisplay("100x100,200x200");
973 EXPECT_TRUE(display_manager
->IsInMirrorMode());
975 display_manager
->SetMirrorMode(false);
976 EXPECT_TRUE(display_manager
->IsInUnifiedMode());
978 // Sanity check. Restore to extended.
979 StoreDisplayBoolPropertyForPair(pair
, "default_unified", false);
980 StoreDisplayBoolPropertyForPair(pair
, "mirrored", false);
981 LoadDisplayPreferences(false);
982 UpdateDisplay("100x100,200x200");
983 EXPECT_FALSE(display_manager
->IsInMirrorMode());
984 EXPECT_FALSE(display_manager
->IsInUnifiedMode());
987 } // namespace chromeos