Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/browser/chromeos/display/display_preferences_unittest.cc

Issue 1547093002: Switch to standard integer types in chrome/browser/chromeos/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/display/display_preferences.h" 5 #include "chrome/browser/chromeos/display/display_preferences.h"
6 6
7 #include <stdint.h>
8
7 #include <string> 9 #include <string>
8 #include <vector> 10 #include <vector>
9 11
10 #include "ash/display/display_layout_store.h" 12 #include "ash/display/display_layout_store.h"
11 #include "ash/display/display_manager.h" 13 #include "ash/display/display_manager.h"
12 #include "ash/display/display_util.h" 14 #include "ash/display/display_util.h"
13 #include "ash/display/resolution_notification_controller.h" 15 #include "ash/display/resolution_notification_controller.h"
14 #include "ash/display/screen_orientation_controller_chromeos.h" 16 #include "ash/display/screen_orientation_controller_chromeos.h"
15 #include "ash/display/window_tree_host_manager.h" 17 #include "ash/display/window_tree_host_manager.h"
16 #include "ash/screen_util.h" 18 #include "ash/screen_util.h"
17 #include "ash/shell.h" 19 #include "ash/shell.h"
18 #include "ash/test/ash_test_base.h" 20 #include "ash/test/ash_test_base.h"
19 #include "ash/test/display_manager_test_api.h" 21 #include "ash/test/display_manager_test_api.h"
20 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 22 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
23 #include "base/macros.h"
21 #include "base/memory/ref_counted.h" 24 #include "base/memory/ref_counted.h"
22 #include "base/prefs/scoped_user_pref_update.h" 25 #include "base/prefs/scoped_user_pref_update.h"
23 #include "base/prefs/testing_pref_service.h" 26 #include "base/prefs/testing_pref_service.h"
24 #include "base/strings/string_number_conversions.h" 27 #include "base/strings/string_number_conversions.h"
25 #include "base/values.h" 28 #include "base/values.h"
26 #include "chrome/browser/chromeos/display/display_configuration_observer.h" 29 #include "chrome/browser/chromeos/display/display_configuration_observer.h"
27 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" 30 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
28 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 31 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
29 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
30 #include "chrome/test/base/testing_browser_process.h" 33 #include "chrome/test/base/testing_browser_process.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 .WillRepeatedly(testing::Return(false)); 98 .WillRepeatedly(testing::Return(false));
96 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsSupervisedUser()) 99 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsSupervisedUser())
97 .WillRepeatedly(testing::Return(false)); 100 .WillRepeatedly(testing::Return(false));
98 } 101 }
99 102
100 // Do not use the implementation of display_preferences.cc directly to avoid 103 // Do not use the implementation of display_preferences.cc directly to avoid
101 // notifying the update to the system. 104 // notifying the update to the system.
102 void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair& pair, 105 void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair& pair,
103 ash::DisplayLayout::Position layout, 106 ash::DisplayLayout::Position layout,
104 int offset, 107 int offset,
105 int64 primary_id) { 108 int64_t primary_id) {
106 std::string name = ToPairString(pair); 109 std::string name = ToPairString(pair);
107 DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays); 110 DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays);
108 ash::DisplayLayout display_layout(layout, offset); 111 ash::DisplayLayout display_layout(layout, offset);
109 display_layout.primary_id = primary_id; 112 display_layout.primary_id = primary_id;
110 113
111 DCHECK(!name.empty()); 114 DCHECK(!name.empty());
112 115
113 base::DictionaryValue* pref_data = update.Get(); 116 base::DictionaryValue* pref_data = update.Get();
114 scoped_ptr<base::Value>layout_value(new base::DictionaryValue()); 117 scoped_ptr<base::Value>layout_value(new base::DictionaryValue());
115 if (pref_data->HasKey(name)) { 118 if (pref_data->HasKey(name)) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 StoreDisplayPropertyForPair( 152 StoreDisplayPropertyForPair(
150 pair, key, make_scoped_ptr(new base::FundamentalValue(value))); 153 pair, key, make_scoped_ptr(new base::FundamentalValue(value)));
151 } 154 }
152 155
153 void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair& pair, 156 void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair& pair,
154 ash::DisplayLayout::Position layout, 157 ash::DisplayLayout::Position layout,
155 int offset) { 158 int offset) {
156 StoreDisplayLayoutPrefForPair(pair, layout, offset, pair.first); 159 StoreDisplayLayoutPrefForPair(pair, layout, offset, pair.first);
157 } 160 }
158 161
159 void StoreDisplayOverscan(int64 id, const gfx::Insets& insets) { 162 void StoreDisplayOverscan(int64_t id, const gfx::Insets& insets) {
160 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties); 163 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties);
161 const std::string name = base::Int64ToString(id); 164 const std::string name = base::Int64ToString(id);
162 165
163 base::DictionaryValue* pref_data = update.Get(); 166 base::DictionaryValue* pref_data = update.Get();
164 base::DictionaryValue* insets_value = new base::DictionaryValue(); 167 base::DictionaryValue* insets_value = new base::DictionaryValue();
165 insets_value->SetInteger("insets_top", insets.top()); 168 insets_value->SetInteger("insets_top", insets.top());
166 insets_value->SetInteger("insets_left", insets.left()); 169 insets_value->SetInteger("insets_left", insets.left());
167 insets_value->SetInteger("insets_bottom", insets.bottom()); 170 insets_value->SetInteger("insets_bottom", insets.bottom());
168 insets_value->SetInteger("insets_right", insets.right()); 171 insets_value->SetInteger("insets_right", insets.right());
169 pref_data->Set(name, insets_value); 172 pref_data->Set(name, insets_value);
170 } 173 }
171 174
172 void StoreColorProfile(int64 id, const std::string& profile) { 175 void StoreColorProfile(int64_t id, const std::string& profile) {
173 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties); 176 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties);
174 const std::string name = base::Int64ToString(id); 177 const std::string name = base::Int64ToString(id);
175 178
176 base::DictionaryValue* pref_data = update.Get(); 179 base::DictionaryValue* pref_data = update.Get();
177 base::DictionaryValue* property = new base::DictionaryValue(); 180 base::DictionaryValue* property = new base::DictionaryValue();
178 property->SetString("color_profile_name", profile); 181 property->SetString("color_profile_name", profile);
179 pref_data->Set(name, property); 182 pref_data->Set(name, property);
180 } 183 }
181 184
182 void StoreDisplayRotationPrefsForTest(bool rotation_lock, 185 void StoreDisplayRotationPrefsForTest(bool rotation_lock,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(dummy_pair)); 240 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(dummy_pair));
238 } 241 }
239 242
240 TEST_F(DisplayPreferencesTest, BasicStores) { 243 TEST_F(DisplayPreferencesTest, BasicStores) {
241 ash::WindowTreeHostManager* window_tree_host_manager = 244 ash::WindowTreeHostManager* window_tree_host_manager =
242 ash::Shell::GetInstance()->window_tree_host_manager(); 245 ash::Shell::GetInstance()->window_tree_host_manager();
243 ash::DisplayManager* display_manager = 246 ash::DisplayManager* display_manager =
244 ash::Shell::GetInstance()->display_manager(); 247 ash::Shell::GetInstance()->display_manager();
245 248
246 UpdateDisplay("200x200*2, 400x300#400x400|300x200*1.25"); 249 UpdateDisplay("200x200*2, 400x300#400x400|300x200*1.25");
247 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 250 int64_t id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
248 ash::test::ScopedSetInternalDisplayId set_internal(id1); 251 ash::test::ScopedSetInternalDisplayId set_internal(id1);
249 int64 id2 = ash::ScreenUtil::GetSecondaryDisplay().id(); 252 int64_t id2 = ash::ScreenUtil::GetSecondaryDisplay().id();
250 int64 dummy_id = id2 + 1; 253 int64_t dummy_id = id2 + 1;
251 ASSERT_NE(id1, dummy_id); 254 ASSERT_NE(id1, dummy_id);
252 std::vector<ui::ColorCalibrationProfile> profiles; 255 std::vector<ui::ColorCalibrationProfile> profiles;
253 profiles.push_back(ui::COLOR_PROFILE_STANDARD); 256 profiles.push_back(ui::COLOR_PROFILE_STANDARD);
254 profiles.push_back(ui::COLOR_PROFILE_DYNAMIC); 257 profiles.push_back(ui::COLOR_PROFILE_DYNAMIC);
255 profiles.push_back(ui::COLOR_PROFILE_MOVIE); 258 profiles.push_back(ui::COLOR_PROFILE_MOVIE);
256 profiles.push_back(ui::COLOR_PROFILE_READING); 259 profiles.push_back(ui::COLOR_PROFILE_READING);
257 // Allows only |id1|. 260 // Allows only |id1|.
258 ash::test::DisplayManagerTestApi().SetAvailableColorProfiles(id1, profiles); 261 ash::test::DisplayManagerTestApi().SetAvailableColorProfiles(id1, profiles);
259 display_manager->SetColorCalibrationProfile(id1, ui::COLOR_PROFILE_DYNAMIC); 262 display_manager->SetColorCalibrationProfile(id1, ui::COLOR_PROFILE_DYNAMIC);
260 display_manager->SetColorCalibrationProfile(id2, ui::COLOR_PROFILE_DYNAMIC); 263 display_manager->SetColorCalibrationProfile(id2, ui::COLOR_PROFILE_DYNAMIC);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 EXPECT_TRUE(property->GetInteger("width", &width)); 467 EXPECT_TRUE(property->GetInteger("width", &width));
465 EXPECT_TRUE(property->GetInteger("height", &height)); 468 EXPECT_TRUE(property->GetInteger("height", &height));
466 EXPECT_EQ(500, width); 469 EXPECT_EQ(500, width);
467 EXPECT_EQ(400, height); 470 EXPECT_EQ(400, height);
468 } 471 }
469 472
470 TEST_F(DisplayPreferencesTest, PreventStore) { 473 TEST_F(DisplayPreferencesTest, PreventStore) {
471 ResolutionNotificationController::SuppressTimerForTest(); 474 ResolutionNotificationController::SuppressTimerForTest();
472 LoggedInAsUser(); 475 LoggedInAsUser();
473 UpdateDisplay("400x300#500x400|400x300|300x200"); 476 UpdateDisplay("400x300#500x400|400x300|300x200");
474 int64 id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); 477 int64_t id = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
475 // Set display's resolution in single display. It creates the notification and 478 // Set display's resolution in single display. It creates the notification and
476 // display preferences should not stored meanwhile. 479 // display preferences should not stored meanwhile.
477 ash::Shell* shell = ash::Shell::GetInstance(); 480 ash::Shell* shell = ash::Shell::GetInstance();
478 ash::DisplayMode old_mode; 481 ash::DisplayMode old_mode;
479 ash::DisplayMode new_mode; 482 ash::DisplayMode new_mode;
480 old_mode.size = gfx::Size(400, 300); 483 old_mode.size = gfx::Size(400, 300);
481 new_mode.size = gfx::Size(500, 400); 484 new_mode.size = gfx::Size(500, 400);
482 if (shell->display_manager()->SetDisplayMode(id, new_mode)) { 485 if (shell->display_manager()->SetDisplayMode(id, new_mode)) {
483 shell->resolution_notification_controller()->PrepareNotification( 486 shell->resolution_notification_controller()->PrepareNotification(
484 id, old_mode, new_mode, base::Closure()); 487 id, old_mode, new_mode, base::Closure());
(...skipping 25 matching lines...) Expand all
510 property = NULL; 513 property = NULL;
511 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id), &property)); 514 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id), &property));
512 EXPECT_TRUE(property->GetInteger("width", &width)); 515 EXPECT_TRUE(property->GetInteger("width", &width));
513 EXPECT_TRUE(property->GetInteger("height", &height)); 516 EXPECT_TRUE(property->GetInteger("height", &height));
514 EXPECT_EQ(300, width); 517 EXPECT_EQ(300, width);
515 EXPECT_EQ(200, height); 518 EXPECT_EQ(200, height);
516 } 519 }
517 520
518 TEST_F(DisplayPreferencesTest, StoreForSwappedDisplay) { 521 TEST_F(DisplayPreferencesTest, StoreForSwappedDisplay) {
519 UpdateDisplay("100x100,200x200"); 522 UpdateDisplay("100x100,200x200");
520 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 523 int64_t id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
521 int64 id2 = ash::ScreenUtil::GetSecondaryDisplay().id(); 524 int64_t id2 = ash::ScreenUtil::GetSecondaryDisplay().id();
522 525
523 ash::WindowTreeHostManager* window_tree_host_manager = 526 ash::WindowTreeHostManager* window_tree_host_manager =
524 ash::Shell::GetInstance()->window_tree_host_manager(); 527 ash::Shell::GetInstance()->window_tree_host_manager();
525 window_tree_host_manager->SwapPrimaryDisplay(); 528 window_tree_host_manager->SwapPrimaryDisplay();
526 ASSERT_EQ(id1, ash::ScreenUtil::GetSecondaryDisplay().id()); 529 ASSERT_EQ(id1, ash::ScreenUtil::GetSecondaryDisplay().id());
527 530
528 LoggedInAsUser(); 531 LoggedInAsUser();
529 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 532 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10);
530 SetCurrentDisplayLayout(layout); 533 SetCurrentDisplayLayout(layout);
531 layout = layout.Invert(); 534 layout = layout.Invert();
(...skipping 15 matching lines...) Expand all
547 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout)); 550 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
548 EXPECT_EQ(layout.position, stored_layout.position); 551 EXPECT_EQ(layout.position, stored_layout.position);
549 EXPECT_EQ(layout.offset, stored_layout.offset); 552 EXPECT_EQ(layout.offset, stored_layout.offset);
550 EXPECT_EQ(id1, stored_layout.primary_id); 553 EXPECT_EQ(id1, stored_layout.primary_id);
551 } 554 }
552 555
553 TEST_F(DisplayPreferencesTest, RestoreColorProfiles) { 556 TEST_F(DisplayPreferencesTest, RestoreColorProfiles) {
554 ash::DisplayManager* display_manager = 557 ash::DisplayManager* display_manager =
555 ash::Shell::GetInstance()->display_manager(); 558 ash::Shell::GetInstance()->display_manager();
556 559
557 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 560 int64_t id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
558 561
559 StoreColorProfile(id1, "dynamic"); 562 StoreColorProfile(id1, "dynamic");
560 563
561 LoggedInAsUser(); 564 LoggedInAsUser();
562 LoadDisplayPreferences(false); 565 LoadDisplayPreferences(false);
563 566
564 // id1's available color profiles list is empty, means somehow the color 567 // id1's available color profiles list is empty, means somehow the color
565 // profile suport is temporary in trouble. 568 // profile suport is temporary in trouble.
566 EXPECT_NE(ui::COLOR_PROFILE_DYNAMIC, 569 EXPECT_NE(ui::COLOR_PROFILE_DYNAMIC,
567 display_manager->GetDisplayInfo(id1).color_profile()); 570 display_manager->GetDisplayInfo(id1).color_profile());
(...skipping 11 matching lines...) Expand all
579 display_manager->GetDisplayInfo(id1).color_profile()); 582 display_manager->GetDisplayInfo(id1).color_profile());
580 } 583 }
581 584
582 TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) { 585 TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) {
583 ash::WindowTreeHostManager* window_tree_host_manager = 586 ash::WindowTreeHostManager* window_tree_host_manager =
584 ash::Shell::GetInstance()->window_tree_host_manager(); 587 ash::Shell::GetInstance()->window_tree_host_manager();
585 588
586 UpdateDisplay("200x200*2,200x200"); 589 UpdateDisplay("200x200*2,200x200");
587 590
588 LoggedInAsGuest(); 591 LoggedInAsGuest();
589 int64 id1 = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); 592 int64_t id1 = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
590 ash::test::ScopedSetInternalDisplayId set_internal(id1); 593 ash::test::ScopedSetInternalDisplayId set_internal(id1);
591 int64 id2 = ash::ScreenUtil::GetSecondaryDisplay().id(); 594 int64_t id2 = ash::ScreenUtil::GetSecondaryDisplay().id();
592 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 595 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10);
593 SetCurrentDisplayLayout(layout); 596 SetCurrentDisplayLayout(layout);
594 ash::DisplayManager* display_manager = 597 ash::DisplayManager* display_manager =
595 ash::Shell::GetInstance()->display_manager(); 598 ash::Shell::GetInstance()->display_manager();
596 ash::SetDisplayUIScale(id1, 1.25f); 599 ash::SetDisplayUIScale(id1, 1.25f);
597 window_tree_host_manager->SetPrimaryDisplayId(id2); 600 window_tree_host_manager->SetPrimaryDisplayId(id2);
598 int64 new_primary = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); 601 int64_t new_primary = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
599 window_tree_host_manager->SetOverscanInsets(new_primary, 602 window_tree_host_manager->SetOverscanInsets(new_primary,
600 gfx::Insets(10, 11, 12, 13)); 603 gfx::Insets(10, 11, 12, 13));
601 display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90, 604 display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90,
602 gfx::Display::ROTATION_SOURCE_USER); 605 gfx::Display::ROTATION_SOURCE_USER);
603 606
604 // Does not store the preferences locally. 607 // Does not store the preferences locally.
605 EXPECT_FALSE(local_state()->FindPreference( 608 EXPECT_FALSE(local_state()->FindPreference(
606 prefs::kSecondaryDisplays)->HasUserSetting()); 609 prefs::kSecondaryDisplays)->HasUserSetting());
607 EXPECT_FALSE(local_state()->FindPreference( 610 EXPECT_FALSE(local_state()->FindPreference(
608 prefs::kDisplayProperties)->HasUserSetting()); 611 prefs::kDisplayProperties)->HasUserSetting());
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 EXPECT_TRUE( 897 EXPECT_TRUE(
895 secondary_displays->GetDictionary(ToPairString(pair), &new_value)); 898 secondary_displays->GetDictionary(ToPairString(pair), &new_value));
896 899
897 ash::DisplayLayout stored_layout; 900 ash::DisplayLayout stored_layout;
898 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout)); 901 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
899 EXPECT_TRUE(stored_layout.default_unified); 902 EXPECT_TRUE(stored_layout.default_unified);
900 EXPECT_FALSE(stored_layout.mirrored); 903 EXPECT_FALSE(stored_layout.mirrored);
901 904
902 const base::DictionaryValue* displays = 905 const base::DictionaryValue* displays =
903 local_state()->GetDictionary(prefs::kDisplayProperties); 906 local_state()->GetDictionary(prefs::kDisplayProperties);
904 int64 unified_id = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 907 int64_t unified_id = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
905 EXPECT_FALSE( 908 EXPECT_FALSE(
906 displays->GetDictionary(base::Int64ToString(unified_id), &new_value)); 909 displays->GetDictionary(base::Int64ToString(unified_id), &new_value));
907 910
908 ash::test::SetDisplayResolution(unified_id, gfx::Size(200, 100)); 911 ash::test::SetDisplayResolution(unified_id, gfx::Size(200, 100));
909 EXPECT_EQ( 912 EXPECT_EQ(
910 "200x100", 913 "200x100",
911 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size().ToString()); 914 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size().ToString());
912 EXPECT_FALSE( 915 EXPECT_FALSE(
913 displays->GetDictionary(base::Int64ToString(unified_id), &new_value)); 916 displays->GetDictionary(base::Int64ToString(unified_id), &new_value));
914 917
(...skipping 17 matching lines...) Expand all
932 ash::DisplayManager::EXTENDED); 935 ash::DisplayManager::EXTENDED);
933 display_manager->ReconfigureDisplays(); 936 display_manager->ReconfigureDisplays();
934 ASSERT_TRUE( 937 ASSERT_TRUE(
935 secondary_displays->GetDictionary(ToPairString(pair), &new_value)); 938 secondary_displays->GetDictionary(ToPairString(pair), &new_value));
936 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout)); 939 EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
937 EXPECT_FALSE(stored_layout.default_unified); 940 EXPECT_FALSE(stored_layout.default_unified);
938 EXPECT_FALSE(stored_layout.mirrored); 941 EXPECT_FALSE(stored_layout.mirrored);
939 } 942 }
940 943
941 TEST_F(DisplayPreferencesTest, RestoreUnifiedMode) { 944 TEST_F(DisplayPreferencesTest, RestoreUnifiedMode) {
942 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 945 int64_t id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
943 ash::DisplayIdPair pair = std::make_pair(id1, id1 + 1); 946 ash::DisplayIdPair pair = std::make_pair(id1, id1 + 1);
944 StoreDisplayBoolPropertyForPair(pair, "default_unified", true); 947 StoreDisplayBoolPropertyForPair(pair, "default_unified", true);
945 StoreDisplayPropertyForPair( 948 StoreDisplayPropertyForPair(
946 pair, "primary-id", 949 pair, "primary-id",
947 make_scoped_ptr(new base::StringValue(base::Int64ToString(id1)))); 950 make_scoped_ptr(new base::StringValue(base::Int64ToString(id1))));
948 LoadDisplayPreferences(false); 951 LoadDisplayPreferences(false);
949 952
950 // Should not restore to unified unless unified desktop is enabled. 953 // Should not restore to unified unless unified desktop is enabled.
951 UpdateDisplay("100x100,200x200"); 954 UpdateDisplay("100x100,200x200");
952 ash::DisplayManager* display_manager = 955 ash::DisplayManager* display_manager =
(...skipping 20 matching lines...) Expand all
973 // Sanity check. Restore to extended. 976 // Sanity check. Restore to extended.
974 StoreDisplayBoolPropertyForPair(pair, "default_unified", false); 977 StoreDisplayBoolPropertyForPair(pair, "default_unified", false);
975 StoreDisplayBoolPropertyForPair(pair, "mirrored", false); 978 StoreDisplayBoolPropertyForPair(pair, "mirrored", false);
976 LoadDisplayPreferences(false); 979 LoadDisplayPreferences(false);
977 UpdateDisplay("100x100,200x200"); 980 UpdateDisplay("100x100,200x200");
978 EXPECT_FALSE(display_manager->IsInMirrorMode()); 981 EXPECT_FALSE(display_manager->IsInMirrorMode());
979 EXPECT_FALSE(display_manager->IsInUnifiedMode()); 982 EXPECT_FALSE(display_manager->IsInUnifiedMode());
980 } 983 }
981 984
982 } // namespace chromeos 985 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences.cc ('k') | chrome/browser/chromeos/display/output_protection_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698