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

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

Issue 1823913002: Allow moving cursors between connected displays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1046
1047 // Sanity check. Restore to extended. 1047 // Sanity check. Restore to extended.
1048 StoreDisplayBoolPropertyForList(list, "default_unified", false); 1048 StoreDisplayBoolPropertyForList(list, "default_unified", false);
1049 StoreDisplayBoolPropertyForList(list, "mirrored", false); 1049 StoreDisplayBoolPropertyForList(list, "mirrored", false);
1050 LoadDisplayPreferences(false); 1050 LoadDisplayPreferences(false);
1051 UpdateDisplay("100x100,200x200"); 1051 UpdateDisplay("100x100,200x200");
1052 EXPECT_FALSE(display_manager->IsInMirrorMode()); 1052 EXPECT_FALSE(display_manager->IsInMirrorMode());
1053 EXPECT_FALSE(display_manager->IsInUnifiedMode()); 1053 EXPECT_FALSE(display_manager->IsInUnifiedMode());
1054 } 1054 }
1055 1055
1056 TEST_F(DisplayPreferencesTest, SaveThreeDisplays) {
1057 LoggedInAsUser();
1058 ash::DisplayManager* display_manager =
1059 ash::Shell::GetInstance()->display_manager();
1060 UpdateDisplay("200x200,200x200,300x300");
1061
1062 ash::DisplayIdList list = display_manager->GetCurrentDisplayIdList();
1063 ASSERT_EQ(3u, list.size());
1064
1065 ash::DisplayLayoutBuilder builder(list[0]);
1066 builder.AddDisplayPlacement(list[1], list[0], ash::DisplayPlacement::RIGHT,
1067 0);
1068 builder.AddDisplayPlacement(list[2], list[0], ash::DisplayPlacement::BOTTOM,
1069 100);
1070 display_manager->SetLayoutForCurrentDisplays(builder.Build());
1071
1072 const base::DictionaryValue* secondary_displays =
1073 local_state()->GetDictionary(prefs::kSecondaryDisplays);
1074 const base::DictionaryValue* new_value = nullptr;
1075 EXPECT_TRUE(secondary_displays->GetDictionary(
1076 ash::DisplayIdListToString(list), &new_value));
1077 }
1078
1079 TEST_F(DisplayPreferencesTest, RestoreThreeDisplays) {
1080 LoggedInAsUser();
1081 ash::DisplayManager* display_manager =
1082 ash::Shell::GetInstance()->display_manager();
1083 int64_t id1 = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
1084 ash::DisplayIdList list =
1085 ash::test::CreateDisplayIdListN(3, id1, id1 + 1, id1 + 2);
1086
1087 ash::DisplayLayoutBuilder builder(list[0]);
1088 builder.AddDisplayPlacement(list[1], list[0], ash::DisplayPlacement::LEFT, 0);
1089 builder.AddDisplayPlacement(list[2], list[1], ash::DisplayPlacement::BOTTOM,
1090 100);
1091 StoreDisplayLayoutPrefForTest(list, *builder.Build());
1092 LoadDisplayPreferences(false);
1093
1094 UpdateDisplay("200x200,200x200,300x300");
1095 ash::DisplayIdList new_list = display_manager->GetCurrentDisplayIdList();
1096 ASSERT_EQ(3u, list.size());
1097 ASSERT_EQ(list[0], new_list[0]);
1098 ASSERT_EQ(list[1], new_list[1]);
1099 ASSERT_EQ(list[2], new_list[2]);
1100
1101 EXPECT_EQ(gfx::Rect(0, 0, 200, 200),
1102 display_manager->GetDisplayForId(list[0]).bounds());
1103 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200),
1104 display_manager->GetDisplayForId(list[1]).bounds());
1105 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300),
1106 display_manager->GetDisplayForId(list[2]).bounds());
1107 }
1108
1056 } // namespace chromeos 1109 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698