Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / display / display_preferences_unittest.cc
blobb504d7cbd04479de3325d0eedb0387ad80b2c11d
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"
7 #include <string>
8 #include <vector>
10 #include "ash/content/display/screen_orientation_controller_chromeos.h"
11 #include "ash/display/display_layout_store.h"
12 #include "ash/display/display_manager.h"
13 #include "ash/display/display_util.h"
14 #include "ash/display/resolution_notification_controller.h"
15 #include "ash/display/window_tree_host_manager.h"
16 #include "ash/screen_util.h"
17 #include "ash/shell.h"
18 #include "ash/test/ash_test_base.h"
19 #include "ash/test/display_manager_test_api.h"
20 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
21 #include "base/memory/ref_counted.h"
22 #include "base/prefs/scoped_user_pref_update.h"
23 #include "base/prefs/testing_pref_service.h"
24 #include "base/strings/string_number_conversions.h"
25 #include "base/values.h"
26 #include "chrome/browser/chromeos/display/display_configuration_observer.h"
27 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
28 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
29 #include "chrome/common/pref_names.h"
30 #include "chrome/test/base/testing_browser_process.h"
31 #include "ui/display/chromeos/display_configurator.h"
32 #include "ui/gfx/geometry/vector3d_f.h"
33 #include "ui/gfx/screen.h"
34 #include "ui/message_center/message_center.h"
36 using ash::ResolutionNotificationController;
38 namespace chromeos {
39 namespace {
40 const char kPrimaryIdKey[] = "primary-id";
41 const char kMirroredKey[] = "mirrored";
42 const char kPositionKey[] = "position";
43 const char kOffsetKey[] = "offset";
45 // The mean acceleration due to gravity on Earth in m/s^2.
46 const float kMeanGravity = -9.80665f;
48 bool IsRotationLocked() {
49 return ash::Shell::GetInstance()
50 ->screen_orientation_controller()
51 ->rotation_locked();
54 std::string ToPairString(const ash::DisplayIdPair& pair) {
55 return base::Int64ToString(pair.first) + "," +
56 base::Int64ToString(pair.second);
59 class DisplayPreferencesTest : public ash::test::AshTestBase {
60 protected:
61 DisplayPreferencesTest()
62 : mock_user_manager_(new MockUserManager),
63 user_manager_enabler_(mock_user_manager_) {
66 ~DisplayPreferencesTest() override {}
68 void SetUp() override {
69 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn())
70 .WillRepeatedly(testing::Return(false));
71 EXPECT_CALL(*mock_user_manager_, Shutdown());
72 ash::test::AshTestBase::SetUp();
73 RegisterDisplayLocalStatePrefs(local_state_.registry());
74 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
75 observer_.reset(new DisplayConfigurationObserver());
78 void TearDown() override {
79 observer_.reset();
80 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
81 ash::test::AshTestBase::TearDown();
84 void LoggedInAsUser() {
85 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn())
86 .WillRepeatedly(testing::Return(true));
87 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsUserWithGaiaAccount())
88 .WillRepeatedly(testing::Return(true));
91 void LoggedInAsGuest() {
92 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn())
93 .WillRepeatedly(testing::Return(true));
94 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsUserWithGaiaAccount())
95 .WillRepeatedly(testing::Return(false));
96 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsSupervisedUser())
97 .WillRepeatedly(testing::Return(false));
100 // Do not use the implementation of display_preferences.cc directly to avoid
101 // notifying the update to the system.
102 void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair& pair,
103 ash::DisplayLayout::Position layout,
104 int offset,
105 int64 primary_id) {
106 std::string name = ToPairString(pair);
107 DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays);
108 ash::DisplayLayout display_layout(layout, offset);
109 display_layout.primary_id = primary_id;
111 DCHECK(!name.empty());
113 base::DictionaryValue* pref_data = update.Get();
114 scoped_ptr<base::Value>layout_value(new base::DictionaryValue());
115 if (pref_data->HasKey(name)) {
116 base::Value* value = NULL;
117 if (pref_data->Get(name, &value) && value != NULL)
118 layout_value.reset(value->DeepCopy());
120 if (ash::DisplayLayout::ConvertToValue(display_layout, layout_value.get()))
121 pref_data->Set(name, layout_value.release());
124 void StoreDisplayPropertyForPair(const ash::DisplayIdPair& pair,
125 std::string key,
126 scoped_ptr<base::Value> value) {
127 std::string name = ToPairString(pair);
129 DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays);
130 base::DictionaryValue* pref_data = update.Get();
132 if (pref_data->HasKey(name)) {
133 base::Value* layout_value = NULL;
134 pref_data->Get(name, &layout_value);
135 if (layout_value)
136 static_cast<base::DictionaryValue*>(layout_value)
137 ->Set(key, value.Pass());
138 } else {
139 scoped_ptr<base::DictionaryValue> layout_value(
140 new base::DictionaryValue());
141 layout_value->SetBoolean(key, value);
142 pref_data->Set(name, layout_value.release());
146 void StoreDisplayBoolPropertyForPair(const ash::DisplayIdPair& pair,
147 const std::string& key,
148 bool value) {
149 StoreDisplayPropertyForPair(
150 pair, key, make_scoped_ptr(new base::FundamentalValue(value)));
153 void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair& pair,
154 ash::DisplayLayout::Position layout,
155 int offset) {
156 StoreDisplayLayoutPrefForPair(pair, layout, offset, pair.first);
159 void StoreDisplayOverscan(int64 id, const gfx::Insets& insets) {
160 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties);
161 const std::string name = base::Int64ToString(id);
163 base::DictionaryValue* pref_data = update.Get();
164 base::DictionaryValue* insets_value = new base::DictionaryValue();
165 insets_value->SetInteger("insets_top", insets.top());
166 insets_value->SetInteger("insets_left", insets.left());
167 insets_value->SetInteger("insets_bottom", insets.bottom());
168 insets_value->SetInteger("insets_right", insets.right());
169 pref_data->Set(name, insets_value);
172 void StoreColorProfile(int64 id, const std::string& profile) {
173 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties);
174 const std::string name = base::Int64ToString(id);
176 base::DictionaryValue* pref_data = update.Get();
177 base::DictionaryValue* property = new base::DictionaryValue();
178 property->SetString("color_profile_name", profile);
179 pref_data->Set(name, property);
182 void StoreDisplayRotationPrefsForTest(bool rotation_lock,
183 gfx::Display::Rotation rotation) {
184 DictionaryPrefUpdate update(local_state(), prefs::kDisplayRotationLock);
185 base::DictionaryValue* pref_data = update.Get();
186 pref_data->SetBoolean("lock", rotation_lock);
187 pref_data->SetInteger("orientation", static_cast<int>(rotation));
190 std::string GetRegisteredDisplayLayoutStr(const ash::DisplayIdPair& pair) {
191 return ash::Shell::GetInstance()->display_manager()->layout_store()->
192 GetRegisteredDisplayLayout(pair).ToString();
195 PrefService* local_state() { return &local_state_; }
197 private:
198 MockUserManager* mock_user_manager_; // Not owned.
199 ScopedUserManagerEnabler user_manager_enabler_;
200 TestingPrefServiceSimple local_state_;
201 scoped_ptr<DisplayConfigurationObserver> observer_;
203 DISALLOW_COPY_AND_ASSIGN(DisplayPreferencesTest);
206 } // namespace
208 TEST_F(DisplayPreferencesTest, PairedLayoutOverrides) {
209 UpdateDisplay("100x100,200x200");
210 ash::DisplayManager* display_manager =
211 ash::Shell::GetInstance()->display_manager();
213 ash::DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair();
214 ash::DisplayIdPair dummy_pair = std::make_pair(pair.first, pair.second + 1);
215 ASSERT_NE(pair.first, dummy_pair.second);
217 StoreDisplayLayoutPrefForPair(pair, ash::DisplayLayout::TOP, 20);
218 StoreDisplayLayoutPrefForPair(dummy_pair, ash::DisplayLayout::LEFT, 30);
219 StoreDisplayPowerStateForTest(
220 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON);
222 ash::Shell* shell = ash::Shell::GetInstance();
224 LoadDisplayPreferences(true);
225 // DisplayPowerState should be ignored at boot.
226 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON,
227 shell->display_configurator()->requested_power_state());
229 shell->display_manager()->UpdateDisplays();
230 // Check if the layout settings are notified to the system properly.
231 // The paired layout overrides old layout.
232 // Inverted one of for specified pair (id1, id2). Not used for the pair
233 // (id1, dummy_id) since dummy_id is not connected right now.
234 EXPECT_EQ("top, 20",
235 shell->display_manager()->GetCurrentDisplayLayout().ToString());
236 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(pair));
237 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(dummy_pair));
240 TEST_F(DisplayPreferencesTest, BasicStores) {
241 ash::WindowTreeHostManager* window_tree_host_manager =
242 ash::Shell::GetInstance()->window_tree_host_manager();
243 ash::DisplayManager* display_manager =
244 ash::Shell::GetInstance()->display_manager();
246 UpdateDisplay("200x200*2, 400x300#400x400|300x200*1.25");
247 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
248 ash::test::ScopedSetInternalDisplayId set_internal(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 ash::test::DisplayManagerTestApi().SetAvailableColorProfiles(id1, profiles);
259 display_manager->SetColorCalibrationProfile(id1, ui::COLOR_PROFILE_DYNAMIC);
260 display_manager->SetColorCalibrationProfile(id2, ui::COLOR_PROFILE_DYNAMIC);
262 LoggedInAsUser();
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 window_tree_host_manager->SetPrimaryDisplayId(dummy_id);
269 EXPECT_NE(dummy_id, ash::Shell::GetScreen()->GetPrimaryDisplay().id());
271 window_tree_host_manager->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(ash::SetDisplayUIScale(id1, 1.25f));
275 EXPECT_FALSE(ash::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,
285 &stored_layout));
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));
297 int ui_scale = 0;
298 int rotation = 0;
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));
314 EXPECT_EQ(10, top);
315 EXPECT_EQ(11, left);
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
340 width = 0;
341 height = 0;
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 window_tree_host_manager->SetPrimaryDisplayId(id2);
351 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id1), &property));
352 width = 0;
353 height = 0;
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
359 // it's not best.
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,
373 &stored_layout));
374 EXPECT_EQ(layout.position, stored_layout.position);
375 EXPECT_EQ(layout.offset, stored_layout.offset);
376 EXPECT_EQ(id2, stored_layout.primary_id);
378 mirrored = true;
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");
389 // Mirrored.
390 int offset = 0;
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);
397 mirrored = false;
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
408 // by mirroring.
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);
430 mirrored = true;
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);
456 mirrored = true;
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();
472 LoggedInAsUser();
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();
500 EXPECT_FALSE(
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");
510 property = NULL;
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::WindowTreeHostManager* window_tree_host_manager =
524 ash::Shell::GetInstance()->window_tree_host_manager();
525 window_tree_host_manager->SwapPrimaryDisplay();
526 ASSERT_EQ(id1, ash::ScreenUtil::GetSecondaryDisplay().id());
528 LoggedInAsUser();
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 window_tree_host_manager->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");
561 LoggedInAsUser();
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().SetAvailableColorProfiles(id1, profiles);
577 LoadDisplayPreferences(false);
578 EXPECT_EQ(ui::COLOR_PROFILE_DYNAMIC,
579 display_manager->GetDisplayInfo(id1).color_profile());
582 TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) {
583 ash::WindowTreeHostManager* window_tree_host_manager =
584 ash::Shell::GetInstance()->window_tree_host_manager();
586 UpdateDisplay("200x200*2,200x200");
588 LoggedInAsGuest();
589 int64 id1 = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
590 ash::test::ScopedSetInternalDisplayId set_internal(id1);
591 int64 id2 = ash::ScreenUtil::GetSecondaryDisplay().id();
592 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10);
593 SetCurrentDisplayLayout(layout);
594 ash::DisplayManager* display_manager =
595 ash::Shell::GetInstance()->display_manager();
596 ash::SetDisplayUIScale(id1, 1.25f);
597 window_tree_host_manager->SetPrimaryDisplayId(id2);
598 int64 new_primary = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
599 window_tree_host_manager->SetOverscanInsets(new_primary,
600 gfx::Insets(10, 11, 12, 13));
601 display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90,
602 gfx::Display::ROTATION_SOURCE_USER);
604 // Does not store the preferences locally.
605 EXPECT_FALSE(local_state()->FindPreference(
606 prefs::kSecondaryDisplays)->HasUserSetting());
607 EXPECT_FALSE(local_state()->FindPreference(
608 prefs::kDisplayProperties)->HasUserSetting());
610 // Settings are still notified to the system.
611 gfx::Screen* screen = gfx::Screen::GetNativeScreen();
612 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id());
613 EXPECT_EQ(ash::DisplayLayout::BOTTOM,
614 display_manager->GetCurrentDisplayLayout().position);
615 EXPECT_EQ(-10, display_manager->GetCurrentDisplayLayout().offset);
616 const gfx::Display& primary_display = screen->GetPrimaryDisplay();
617 EXPECT_EQ("178x176", primary_display.bounds().size().ToString());
618 EXPECT_EQ(gfx::Display::ROTATE_90, primary_display.rotation());
620 const ash::DisplayInfo& info1 = display_manager->GetDisplayInfo(id1);
621 EXPECT_EQ(1.25f, info1.configured_ui_scale());
623 const ash::DisplayInfo& info_primary =
624 display_manager->GetDisplayInfo(new_primary);
625 EXPECT_EQ(gfx::Display::ROTATE_90, info_primary.GetActiveRotation());
626 EXPECT_EQ(1.0f, info_primary.configured_ui_scale());
629 TEST_F(DisplayPreferencesTest, StorePowerStateNoLogin) {
630 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayPowerState));
632 // Stores display prefs without login, which still stores the power state.
633 StoreDisplayPrefs();
634 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayPowerState));
637 TEST_F(DisplayPreferencesTest, StorePowerStateGuest) {
638 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayPowerState));
640 LoggedInAsGuest();
641 StoreDisplayPrefs();
642 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayPowerState));
645 TEST_F(DisplayPreferencesTest, StorePowerStateNormalUser) {
646 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayPowerState));
648 LoggedInAsUser();
649 StoreDisplayPrefs();
650 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayPowerState));
653 TEST_F(DisplayPreferencesTest, DisplayPowerStateAfterRestart) {
654 StoreDisplayPowerStateForTest(
655 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON);
656 LoadDisplayPreferences(false);
657 EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
658 ash::Shell::GetInstance()->display_configurator()->
659 requested_power_state());
662 TEST_F(DisplayPreferencesTest, DontSaveAndRestoreAllOff) {
663 ash::Shell* shell = ash::Shell::GetInstance();
664 StoreDisplayPowerStateForTest(
665 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON);
666 LoadDisplayPreferences(false);
667 // DisplayPowerState should be ignored at boot.
668 EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
669 shell->display_configurator()->requested_power_state());
671 StoreDisplayPowerStateForTest(
672 chromeos::DISPLAY_POWER_ALL_OFF);
673 EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
674 shell->display_configurator()->requested_power_state());
675 EXPECT_EQ("internal_off_external_on",
676 local_state()->GetString(prefs::kDisplayPowerState));
678 // Don't try to load
679 local_state()->SetString(prefs::kDisplayPowerState, "all_off");
680 LoadDisplayPreferences(false);
681 EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
682 shell->display_configurator()->requested_power_state());
685 // Tests that display configuration changes caused by MaximizeModeController
686 // are not saved.
687 TEST_F(DisplayPreferencesTest, DontSaveMaximizeModeControllerRotations) {
688 ash::Shell* shell = ash::Shell::GetInstance();
689 gfx::Display::SetInternalDisplayId(
690 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
691 ash::DisplayManager* display_manager = shell->display_manager();
692 LoggedInAsUser();
693 // Populate the properties.
694 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
695 gfx::Display::ROTATE_180,
696 gfx::Display::ROTATION_SOURCE_USER);
697 // Reset property to avoid rotation lock
698 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
699 gfx::Display::ROTATE_0,
700 gfx::Display::ROTATION_SOURCE_USER);
702 // Open up 270 degrees to trigger maximize mode
703 scoped_refptr<chromeos::AccelerometerUpdate> update(
704 new chromeos::AccelerometerUpdate());
705 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, 0.0f, 0.0f,
706 kMeanGravity);
707 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, 0.0f, -kMeanGravity, 0.0f);
708 ash::MaximizeModeController* controller = shell->maximize_mode_controller();
709 controller->OnAccelerometerUpdated(update);
710 EXPECT_TRUE(controller->IsMaximizeModeWindowManagerEnabled());
712 // Trigger 90 degree rotation
713 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, -kMeanGravity,
714 0.0f, 0.0f);
715 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, -kMeanGravity, 0.0f, 0.0f);
716 controller->OnAccelerometerUpdated(update);
717 shell->screen_orientation_controller()->OnAccelerometerUpdated(update);
718 EXPECT_EQ(gfx::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
720 const base::DictionaryValue* properties =
721 local_state()->GetDictionary(prefs::kDisplayProperties);
722 const base::DictionaryValue* property = NULL;
723 EXPECT_TRUE(properties->GetDictionary(
724 base::Int64ToString(gfx::Display::InternalDisplayId()), &property));
725 int rotation = -1;
726 EXPECT_TRUE(property->GetInteger("rotation", &rotation));
727 EXPECT_EQ(gfx::Display::ROTATE_0, rotation);
729 // Trigger a save, the acceleration rotation should not be saved as the user
730 // rotation.
731 StoreDisplayPrefs();
732 properties = local_state()->GetDictionary(prefs::kDisplayProperties);
733 property = NULL;
734 EXPECT_TRUE(properties->GetDictionary(
735 base::Int64ToString(gfx::Display::InternalDisplayId()), &property));
736 rotation = -1;
737 EXPECT_TRUE(property->GetInteger("rotation", &rotation));
738 EXPECT_EQ(gfx::Display::ROTATE_0, rotation);
741 // Tests that the rotation state is saved without a user being logged in.
742 TEST_F(DisplayPreferencesTest, StoreRotationStateNoLogin) {
743 gfx::Display::SetInternalDisplayId(
744 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
745 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
747 bool current_rotation_lock = IsRotationLocked();
748 StoreDisplayRotationPrefs(current_rotation_lock);
749 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
751 const base::DictionaryValue* properties =
752 local_state()->GetDictionary(prefs::kDisplayRotationLock);
753 bool rotation_lock;
754 EXPECT_TRUE(properties->GetBoolean("lock", &rotation_lock));
755 EXPECT_EQ(current_rotation_lock, rotation_lock);
757 int orientation;
758 gfx::Display::Rotation current_rotation = GetCurrentInternalDisplayRotation();
759 EXPECT_TRUE(properties->GetInteger("orientation", &orientation));
760 EXPECT_EQ(current_rotation, orientation);
763 // Tests that the rotation state is saved when a guest is logged in.
764 TEST_F(DisplayPreferencesTest, StoreRotationStateGuest) {
765 gfx::Display::SetInternalDisplayId(
766 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
767 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
768 LoggedInAsGuest();
770 bool current_rotation_lock = IsRotationLocked();
771 StoreDisplayRotationPrefs(current_rotation_lock);
772 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
774 const base::DictionaryValue* properties =
775 local_state()->GetDictionary(prefs::kDisplayRotationLock);
776 bool rotation_lock;
777 EXPECT_TRUE(properties->GetBoolean("lock", &rotation_lock));
778 EXPECT_EQ(current_rotation_lock, rotation_lock);
780 int orientation;
781 gfx::Display::Rotation current_rotation = GetCurrentInternalDisplayRotation();
782 EXPECT_TRUE(properties->GetInteger("orientation", &orientation));
783 EXPECT_EQ(current_rotation, orientation);
786 // Tests that the rotation state is saved when a normal user is logged in.
787 TEST_F(DisplayPreferencesTest, StoreRotationStateNormalUser) {
788 gfx::Display::SetInternalDisplayId(
789 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
790 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
791 LoggedInAsGuest();
793 bool current_rotation_lock = IsRotationLocked();
794 StoreDisplayRotationPrefs(current_rotation_lock);
795 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
797 const base::DictionaryValue* properties =
798 local_state()->GetDictionary(prefs::kDisplayRotationLock);
799 bool rotation_lock;
800 EXPECT_TRUE(properties->GetBoolean("lock", &rotation_lock));
801 EXPECT_EQ(current_rotation_lock, rotation_lock);
803 int orientation;
804 gfx::Display::Rotation current_rotation = GetCurrentInternalDisplayRotation();
805 EXPECT_TRUE(properties->GetInteger("orientation", &orientation));
806 EXPECT_EQ(current_rotation, orientation);
809 // Tests that rotation state is loaded without a user being logged in, and that
810 // entering maximize mode applies the state.
811 TEST_F(DisplayPreferencesTest, LoadRotationNoLogin) {
812 gfx::Display::SetInternalDisplayId(
813 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
814 ASSERT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
816 ash::Shell* shell = ash::Shell::GetInstance();
817 bool initial_rotation_lock = IsRotationLocked();
818 ASSERT_FALSE(initial_rotation_lock);
819 ash::DisplayManager* display_manager = shell->display_manager();
820 gfx::Display::Rotation initial_rotation = GetCurrentInternalDisplayRotation();
821 ASSERT_EQ(gfx::Display::ROTATE_0, initial_rotation);
823 StoreDisplayRotationPrefs(initial_rotation_lock);
824 ASSERT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
826 StoreDisplayRotationPrefsForTest(true, gfx::Display::ROTATE_90);
827 LoadDisplayPreferences(false);
829 bool display_rotation_lock =
830 display_manager->registered_internal_display_rotation_lock();
831 bool display_rotation =
832 display_manager->registered_internal_display_rotation();
833 EXPECT_TRUE(display_rotation_lock);
834 EXPECT_EQ(gfx::Display::ROTATE_90, display_rotation);
836 bool rotation_lock = IsRotationLocked();
837 gfx::Display::Rotation before_maximize_mode_rotation =
838 GetCurrentInternalDisplayRotation();
840 // Settings should not be applied until maximize mode activates
841 EXPECT_FALSE(rotation_lock);
842 EXPECT_EQ(gfx::Display::ROTATE_0, before_maximize_mode_rotation);
844 // Open up 270 degrees to trigger maximize mode
845 scoped_refptr<chromeos::AccelerometerUpdate> update(
846 new chromeos::AccelerometerUpdate());
847 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, 0.0f, 0.0f,
848 kMeanGravity);
849 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, 0.0f, -kMeanGravity, 0.0f);
850 ash::MaximizeModeController* maximize_mode_controller =
851 shell->maximize_mode_controller();
852 maximize_mode_controller->OnAccelerometerUpdated(update);
853 EXPECT_TRUE(maximize_mode_controller->IsMaximizeModeWindowManagerEnabled());
854 bool screen_orientation_rotation_lock = IsRotationLocked();
855 gfx::Display::Rotation maximize_mode_rotation =
856 GetCurrentInternalDisplayRotation();
857 EXPECT_TRUE(screen_orientation_rotation_lock);
858 EXPECT_EQ(gfx::Display::ROTATE_90, maximize_mode_rotation);
861 // Tests that rotation lock being set causes the rotation state to be saved.
862 TEST_F(DisplayPreferencesTest, RotationLockTriggersStore) {
863 gfx::Display::SetInternalDisplayId(
864 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
865 ASSERT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
867 ash::Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked(
868 true);
870 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
872 const base::DictionaryValue* properties =
873 local_state()->GetDictionary(prefs::kDisplayRotationLock);
874 bool rotation_lock;
875 EXPECT_TRUE(properties->GetBoolean("lock", &rotation_lock));
878 TEST_F(DisplayPreferencesTest, SaveUnifiedMode) {
880 LoggedInAsUser();
881 ash::DisplayManager* display_manager =
882 ash::Shell::GetInstance()->display_manager();
883 display_manager->SetUnifiedDesktopEnabled(true);
885 UpdateDisplay("200x200,100x100");
886 ash::DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair();
887 EXPECT_EQ(
888 "400x200",
889 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size().ToString());
891 const base::DictionaryValue* secondary_displays =
892 local_state()->GetDictionary(prefs::kSecondaryDisplays);
893 const base::DictionaryValue* new_value = NULL;
894 EXPECT_TRUE(
895 secondary_displays->GetDictionary(ToPairString(pair), &new_value));
897 ash::DisplayLayout stored_layout;
898 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
899 EXPECT_TRUE(stored_layout.default_unified);
900 EXPECT_FALSE(stored_layout.mirrored);
902 const base::DictionaryValue* displays =
903 local_state()->GetDictionary(prefs::kDisplayProperties);
904 int64 unified_id = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
905 EXPECT_FALSE(
906 displays->GetDictionary(base::Int64ToString(unified_id), &new_value));
908 ash::test::SetDisplayResolution(unified_id, gfx::Size(200, 100));
909 EXPECT_EQ(
910 "200x100",
911 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size().ToString());
912 EXPECT_FALSE(
913 displays->GetDictionary(base::Int64ToString(unified_id), &new_value));
915 // Mirror mode should remember if the default mode was unified.
916 display_manager->SetMirrorMode(true);
917 ASSERT_TRUE(
918 secondary_displays->GetDictionary(ToPairString(pair), &new_value));
919 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
920 EXPECT_TRUE(stored_layout.default_unified);
921 EXPECT_TRUE(stored_layout.mirrored);
923 display_manager->SetMirrorMode(false);
924 ASSERT_TRUE(
925 secondary_displays->GetDictionary(ToPairString(pair), &new_value));
926 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
927 EXPECT_TRUE(stored_layout.default_unified);
928 EXPECT_FALSE(stored_layout.mirrored);
930 // Exit unified mode.
931 display_manager->SetDefaultMultiDisplayModeForCurrentDisplays(
932 ash::DisplayManager::EXTENDED);
933 display_manager->ReconfigureDisplays();
934 ASSERT_TRUE(
935 secondary_displays->GetDictionary(ToPairString(pair), &new_value));
936 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
937 EXPECT_FALSE(stored_layout.default_unified);
938 EXPECT_FALSE(stored_layout.mirrored);
941 TEST_F(DisplayPreferencesTest, RestoreUnifiedMode) {
942 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
943 ash::DisplayIdPair pair = std::make_pair(id1, id1 + 1);
944 StoreDisplayBoolPropertyForPair(pair, "default_unified", true);
945 StoreDisplayPropertyForPair(
946 pair, "primary-id",
947 make_scoped_ptr(new base::StringValue(base::Int64ToString(id1))));
948 LoadDisplayPreferences(false);
950 // Should not restore to unified unless unified desktop is enabled.
951 UpdateDisplay("100x100,200x200");
952 ash::DisplayManager* display_manager =
953 ash::Shell::GetInstance()->display_manager();
954 EXPECT_FALSE(display_manager->IsInUnifiedMode());
956 // Restored to unified.
957 display_manager->SetUnifiedDesktopEnabled(true);
958 StoreDisplayBoolPropertyForPair(pair, "default_unified", true);
959 LoadDisplayPreferences(false);
960 UpdateDisplay("100x100,200x200");
961 EXPECT_TRUE(display_manager->IsInUnifiedMode());
963 // Restored to mirror, then unified.
964 StoreDisplayBoolPropertyForPair(pair, "mirrored", true);
965 StoreDisplayBoolPropertyForPair(pair, "default_unified", true);
966 LoadDisplayPreferences(false);
967 UpdateDisplay("100x100,200x200");
968 EXPECT_TRUE(display_manager->IsInMirrorMode());
970 display_manager->SetMirrorMode(false);
971 EXPECT_TRUE(display_manager->IsInUnifiedMode());
973 // Sanity check. Restore to extended.
974 StoreDisplayBoolPropertyForPair(pair, "default_unified", false);
975 StoreDisplayBoolPropertyForPair(pair, "mirrored", false);
976 LoadDisplayPreferences(false);
977 UpdateDisplay("100x100,200x200");
978 EXPECT_FALSE(display_manager->IsInMirrorMode());
979 EXPECT_FALSE(display_manager->IsInUnifiedMode());
982 } // namespace chromeos