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

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

Issue 12505005: Store rotation/ui scale to local state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/display_manager.h"
8 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 11 #include "ash/test/ash_test_base.h"
11 #include "base/prefs/testing_pref_service.h" 12 #include "base/prefs/testing_pref_service.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/chromeos/display/display_configuration_observer.h" 15 #include "chrome/browser/chromeos/display/display_configuration_observer.h"
15 #include "chrome/browser/chromeos/login/mock_user_manager.h" 16 #include "chrome/browser/chromeos/login/mock_user_manager.h"
16 #include "chrome/browser/chromeos/login/user_manager.h" 17 #include "chrome/browser/chromeos/login/user_manager.h"
17 #include "chrome/browser/prefs/scoped_user_pref_update.h" 18 #include "chrome/browser/prefs/scoped_user_pref_update.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "chrome/test/base/testing_browser_process.h" 20 #include "chrome/test/base/testing_browser_process.h"
20 21
21 namespace chromeos { 22 namespace chromeos {
22 namespace { 23 namespace {
23 24
24 ash::DisplayController* GetDisplayController() {
25 return ash::Shell::GetInstance()->display_controller();
26 }
27
28 class DisplayPreferencesTest : public ash::test::AshTestBase { 25 class DisplayPreferencesTest : public ash::test::AshTestBase {
29 protected: 26 protected:
30 DisplayPreferencesTest() : ash::test::AshTestBase() {} 27 DisplayPreferencesTest() : ash::test::AshTestBase() {}
31 virtual ~DisplayPreferencesTest() {} 28 virtual ~DisplayPreferencesTest() {}
32 29
33 virtual void SetUp() OVERRIDE { 30 virtual void SetUp() OVERRIDE {
34 ash::test::AshTestBase::SetUp(); 31 ash::test::AshTestBase::SetUp();
35 RegisterDisplayLocalStatePrefs(local_state_.registry()); 32 RegisterDisplayLocalStatePrefs(local_state_.registry());
36 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); 33 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
37 observer_.reset(new DisplayConfigurationObserver()); 34 observer_.reset(new DisplayConfigurationObserver());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 local_state_.SetInteger( 103 local_state_.SetInteger(
107 prefs::kSecondaryDisplayLayout, static_cast<int>(layout)); 104 prefs::kSecondaryDisplayLayout, static_cast<int>(layout));
108 local_state_.SetInteger(prefs::kSecondaryDisplayOffset, offset); 105 local_state_.SetInteger(prefs::kSecondaryDisplayOffset, offset);
109 } 106 }
110 107
111 void StorePrimaryDisplayId(int64 display_id) { 108 void StorePrimaryDisplayId(int64 display_id) {
112 local_state_.SetInt64(prefs::kPrimaryDisplayID, display_id); 109 local_state_.SetInt64(prefs::kPrimaryDisplayID, display_id);
113 } 110 }
114 111
115 void StoreDisplayOverscan(int64 id, const gfx::Insets& insets) { 112 void StoreDisplayOverscan(int64 id, const gfx::Insets& insets) {
116 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayOverscans); 113 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties);
117 const std::string name = base::Int64ToString(id); 114 const std::string name = base::Int64ToString(id);
118 115
119 base::DictionaryValue* pref_data = update.Get(); 116 base::DictionaryValue* pref_data = update.Get();
120 base::DictionaryValue* insets_value = new base::DictionaryValue(); 117 base::DictionaryValue* insets_value = new base::DictionaryValue();
121 insets_value->SetInteger("top", insets.top()); 118 insets_value->SetInteger("insets_top", insets.top());
122 insets_value->SetInteger("left", insets.left()); 119 insets_value->SetInteger("insets_left", insets.left());
123 insets_value->SetInteger("bottom", insets.bottom()); 120 insets_value->SetInteger("insets_bottom", insets.bottom());
124 insets_value->SetInteger("right", insets.right()); 121 insets_value->SetInteger("insets_right", insets.right());
125 pref_data->Set(name, insets_value); 122 pref_data->Set(name, insets_value);
126 } 123 }
127 124
128 std::string GetRegisteredDisplayLayoutStr(int64 id1, int64 id2) { 125 std::string GetRegisteredDisplayLayoutStr(int64 id1, int64 id2) {
129 ash::DisplayIdPair pair; 126 ash::DisplayIdPair pair;
130 pair.first = id1; 127 pair.first = id1;
131 pair.second = id2; 128 pair.second = id2;
132 return ash::Shell::GetInstance()->display_controller()-> 129 return ash::Shell::GetInstance()->display_controller()->
133 GetRegisteredDisplayLayout(pair).ToString(); 130 GetRegisteredDisplayLayout(pair).ToString();
134 } 131 }
(...skipping 15 matching lines...) Expand all
150 int64 dummy_id = id2 + 1; 147 int64 dummy_id = id2 + 1;
151 ASSERT_NE(id1, dummy_id); 148 ASSERT_NE(id1, dummy_id);
152 149
153 StoreDisplayLayoutPrefForSecondary(id2, ash::DisplayLayout::BOTTOM, 20); 150 StoreDisplayLayoutPrefForSecondary(id2, ash::DisplayLayout::BOTTOM, 20);
154 StoreDisplayLayoutPrefForSecondary(dummy_id, ash::DisplayLayout::TOP, -10); 151 StoreDisplayLayoutPrefForSecondary(dummy_id, ash::DisplayLayout::TOP, -10);
155 StoreDefaultLayoutPref(ash::DisplayLayout::LEFT, 50); 152 StoreDefaultLayoutPref(ash::DisplayLayout::LEFT, 50);
156 StorePrimaryDisplayId(id2); 153 StorePrimaryDisplayId(id2);
157 StoreDisplayOverscan(id1, gfx::Insets(10, 10, 10, 10)); 154 StoreDisplayOverscan(id1, gfx::Insets(10, 10, 10, 10));
158 StoreDisplayOverscan(id2, gfx::Insets(20, 20, 20, 20)); 155 StoreDisplayOverscan(id2, gfx::Insets(20, 20, 20, 20));
159 156
160 NotifyDisplayLocalStatePrefChanged(); 157 LoadDisplayPreferences();
161 // Check if the layout settings are notified to the system properly. 158 // Check if the layout settings are notified to the system properly.
162 ash::DisplayController* display_controller = 159 ash::DisplayController* display_controller =
163 ash::Shell::GetInstance()->display_controller(); 160 ash::Shell::GetInstance()->display_controller();
164 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); 161 gfx::Screen* screen = gfx::Screen::GetNativeScreen();
165 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id()); 162 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id());
166 // Display was swapped, so the layout was inverted. 163 // Display was swapped, so the layout was inverted.
167 EXPECT_EQ("top, -20", 164 EXPECT_EQ("top, -20",
168 display_controller->GetCurrentDisplayLayout().ToString()); 165 display_controller->GetCurrentDisplayLayout().ToString());
169 166
170 EXPECT_EQ("bottom, 20", GetRegisteredDisplayLayoutStr(id1, id2)); 167 EXPECT_EQ("bottom, 20", GetRegisteredDisplayLayoutStr(id1, id2));
171 EXPECT_EQ("top, -10", GetRegisteredDisplayLayoutStr(id1, dummy_id)); 168 EXPECT_EQ("top, -10", GetRegisteredDisplayLayoutStr(id1, dummy_id));
172 EXPECT_EQ("left, 50", 169 EXPECT_EQ("left, 50",
173 display_controller->default_display_layout().ToString()); 170 display_controller->default_display_layout().ToString());
174 EXPECT_EQ("160x160", screen->GetPrimaryDisplay().bounds().size().ToString()); 171 EXPECT_EQ("160x160", screen->GetPrimaryDisplay().bounds().size().ToString());
175 EXPECT_EQ("80x80", 172 EXPECT_EQ("80x80",
176 ash::ScreenAsh::GetSecondaryDisplay().bounds().size().ToString()); 173 ash::ScreenAsh::GetSecondaryDisplay().bounds().size().ToString());
177 } 174 }
178 175
179 TEST_F(DisplayPreferencesTest, PairedLayoutOverrides) { 176 TEST_F(DisplayPreferencesTest, PairedLayoutOverrides) {
180 UpdateDisplay("100x100,200x200"); 177 UpdateDisplay("100x100,200x200");
181 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 178 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
182 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 179 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id();
183 int64 dummy_id = id2 + 1; 180 int64 dummy_id = id2 + 1;
184 ASSERT_NE(id1, dummy_id); 181 ASSERT_NE(id1, dummy_id);
185 182
186 StoreDisplayLayoutPrefForPair(id1, id2, ash::DisplayLayout::TOP, 20); 183 StoreDisplayLayoutPrefForPair(id1, id2, ash::DisplayLayout::TOP, 20);
187 StoreDisplayLayoutPrefForPair(id1, dummy_id, ash::DisplayLayout::LEFT, 30); 184 StoreDisplayLayoutPrefForPair(id1, dummy_id, ash::DisplayLayout::LEFT, 30);
188 StoreDefaultLayoutPref(ash::DisplayLayout::LEFT, 50); 185 StoreDefaultLayoutPref(ash::DisplayLayout::LEFT, 50);
189 186
190 NotifyDisplayLocalStatePrefChanged(); 187 LoadDisplayPreferences();
191 // Check if the layout settings are notified to the system properly. 188 // Check if the layout settings are notified to the system properly.
192 // The paired layout overrides old layout. 189 // The paired layout overrides old layout.
193 ash::DisplayController* display_controller = 190 ash::DisplayController* display_controller =
194 ash::Shell::GetInstance()->display_controller(); 191 ash::Shell::GetInstance()->display_controller();
195 // Inverted one of for specified pair (id1, id2). Not used for the pair 192 // Inverted one of for specified pair (id1, id2). Not used for the pair
196 // (id1, dummy_id) since dummy_id is not connected right now. 193 // (id1, dummy_id) since dummy_id is not connected right now.
197 EXPECT_EQ("top, 20", 194 EXPECT_EQ("top, 20",
198 display_controller->GetCurrentDisplayLayout().ToString()); 195 display_controller->GetCurrentDisplayLayout().ToString());
199 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(id1, id2)); 196 EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(id1, id2));
200 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(id1, dummy_id)); 197 EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(id1, dummy_id));
201 } 198 }
202 199
203 TEST_F(DisplayPreferencesTest, BasicStores) { 200 TEST_F(DisplayPreferencesTest, BasicStores) {
204 UpdateDisplay("100x100,200x200"); 201 ash::DisplayController* display_controller =
202 ash::Shell::GetInstance()->display_controller();
203 ash::internal::DisplayManager* display_manager =
204 ash::Shell::GetInstance()->display_manager();
205
206 UpdateDisplay("200x200*2,200x200");
205 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id(); 207 int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
206 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 208 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id();
207 int64 dummy_id = id2 + 1; 209 int64 dummy_id = id2 + 1;
208 ASSERT_NE(id1, dummy_id); 210 ASSERT_NE(id1, dummy_id);
209 211
210 LoggedInAsUser(); 212 LoggedInAsUser();
211 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 213 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10);
212 SetCurrentAndDefaultDisplayLayout(layout); 214 SetCurrentAndDefaultDisplayLayout(layout);
213 StoreDisplayLayoutPrefForTest( 215 StoreDisplayLayoutPrefForTest(
214 id1, dummy_id, ash::DisplayLayout(ash::DisplayLayout::LEFT, 20)); 216 id1, dummy_id, ash::DisplayLayout(ash::DisplayLayout::LEFT, 20));
215 // Can't switch to a display that does not exist. 217 // Can't switch to a display that does not exist.
216 GetDisplayController()->SetPrimaryDisplayId(dummy_id); 218 display_controller->SetPrimaryDisplayId(dummy_id);
217 EXPECT_NE(dummy_id, local_state()->GetInt64(prefs::kPrimaryDisplayID)); 219 EXPECT_NE(dummy_id, local_state()->GetInt64(prefs::kPrimaryDisplayID));
218 220
219 SetAndStoreDisplayOverscan( 221 display_controller->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13));
220 ash::ScreenAsh::GetNativeScreen()->GetPrimaryDisplay(), 222 display_manager->SetDisplayRotation(id1, gfx::Display::ROTATE_90);
221 gfx::Insets(10, 11, 12, 13)); 223 display_manager->SetDisplayUIScale(id1, 1.25f);
224 display_manager->SetDisplayUIScale(id2, 1.25f);
222 225
223 scoped_ptr<base::DictionaryValue> serialized_value( 226 scoped_ptr<base::DictionaryValue> serialized_value(
224 new base::DictionaryValue()); 227 new base::DictionaryValue());
225 ASSERT_TRUE(ash::DisplayLayout::ConvertToValue(layout, 228 ASSERT_TRUE(ash::DisplayLayout::ConvertToValue(layout,
226 serialized_value.get())); 229 serialized_value.get()));
227 230
228 const base::DictionaryValue* displays = 231 const base::DictionaryValue* displays =
229 local_state()->GetDictionary(prefs::kSecondaryDisplays); 232 local_state()->GetDictionary(prefs::kSecondaryDisplays);
230 const base::DictionaryValue* display_layout = NULL; 233 const base::DictionaryValue* display_layout = NULL;
231 std::string key = base::Int64ToString(id1) + "," + base::Int64ToString(id2); 234 std::string key = base::Int64ToString(id1) + "," + base::Int64ToString(id2);
232 EXPECT_TRUE(displays->GetDictionary(key, &display_layout)); 235 EXPECT_TRUE(displays->GetDictionary(key, &display_layout));
233 EXPECT_TRUE(serialized_value->Equals(display_layout)); 236 EXPECT_TRUE(serialized_value->Equals(display_layout));
234 237
235 // The default value is set for the last call of 238 // The default value is set for the last call of
236 // SetCurrentAndDefaultDisplayLayout 239 // SetCurrentAndDefaultDisplayLayout
237 EXPECT_EQ(ash::DisplayLayout::TOP, 240 EXPECT_EQ(ash::DisplayLayout::TOP,
238 local_state()->GetInteger(prefs::kSecondaryDisplayLayout)); 241 local_state()->GetInteger(prefs::kSecondaryDisplayLayout));
239 EXPECT_EQ(10, local_state()->GetInteger(prefs::kSecondaryDisplayOffset)); 242 EXPECT_EQ(10, local_state()->GetInteger(prefs::kSecondaryDisplayOffset));
240 243
241 const base::DictionaryValue* overscans = 244 const base::DictionaryValue* properties =
242 local_state()->GetDictionary(prefs::kDisplayOverscans); 245 local_state()->GetDictionary(prefs::kDisplayProperties);
243 const base::DictionaryValue* overscan = NULL; 246 const base::DictionaryValue* property = NULL;
244 EXPECT_TRUE(overscans->GetDictionary(base::Int64ToString(id1), &overscan)); 247 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id1), &property));
248 int ui_scale = 0;
249 int rotation = 0;
250 EXPECT_TRUE(property->GetInteger("rotation", &rotation));
251 EXPECT_TRUE(property->GetInteger("ui-scale", &ui_scale));
252 EXPECT_EQ(1, rotation);
253 EXPECT_EQ(1250, ui_scale);
254
245 int top = 0, left = 0, bottom = 0, right = 0; 255 int top = 0, left = 0, bottom = 0, right = 0;
246 EXPECT_TRUE(overscan->GetInteger("top", &top)); 256 EXPECT_TRUE(property->GetInteger("insets_top", &top));
247 EXPECT_TRUE(overscan->GetInteger("left", &left)); 257 EXPECT_TRUE(property->GetInteger("insets_left", &left));
248 EXPECT_TRUE(overscan->GetInteger("bottom", &bottom)); 258 EXPECT_TRUE(property->GetInteger("insets_bottom", &bottom));
249 EXPECT_TRUE(overscan->GetInteger("right", &right)); 259 EXPECT_TRUE(property->GetInteger("insets_right", &right));
250 EXPECT_EQ(10, top); 260 EXPECT_EQ(10, top);
251 EXPECT_EQ(11, left); 261 EXPECT_EQ(11, left);
252 EXPECT_EQ(12, bottom); 262 EXPECT_EQ(12, bottom);
253 EXPECT_EQ(13, right); 263 EXPECT_EQ(13, right);
254 264
255 GetDisplayController()->SetPrimaryDisplayId(id2); 265 EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id2), &property));
266 EXPECT_TRUE(property->GetInteger("rotation", &rotation));
267 EXPECT_TRUE(property->GetInteger("ui-scale", &ui_scale));
268 EXPECT_EQ(0, rotation);
269 // ui_scale works only on 2x scale factor/1st display.
270 EXPECT_EQ(1000, ui_scale);
271 EXPECT_FALSE(property->GetInteger("insets_top", &top));
272 EXPECT_FALSE(property->GetInteger("insets_left", &left));
273 EXPECT_FALSE(property->GetInteger("insets_bottom", &bottom));
274 EXPECT_FALSE(property->GetInteger("insets_right", &right));
275
276 display_controller->SetPrimaryDisplayId(id2);
256 EXPECT_EQ(id2, local_state()->GetInt64(prefs::kPrimaryDisplayID)); 277 EXPECT_EQ(id2, local_state()->GetInt64(prefs::kPrimaryDisplayID));
257 // The layout remains the same. 278 // The layout remains the same.
258 EXPECT_TRUE(displays->GetDictionary(key, &display_layout)); 279 EXPECT_TRUE(displays->GetDictionary(key, &display_layout));
259 EXPECT_TRUE(serialized_value->Equals(display_layout)); 280 EXPECT_TRUE(serialized_value->Equals(display_layout));
260 // Default value should changte. 281 // Default value should changte.
261 EXPECT_EQ(ash::DisplayLayout::TOP, 282 EXPECT_EQ(ash::DisplayLayout::TOP,
262 local_state()->GetInteger(prefs::kSecondaryDisplayLayout)); 283 local_state()->GetInteger(prefs::kSecondaryDisplayLayout));
263 EXPECT_EQ(10, local_state()->GetInteger(prefs::kSecondaryDisplayOffset)); 284 EXPECT_EQ(10, local_state()->GetInteger(prefs::kSecondaryDisplayOffset));
264 285
265 SetCurrentAndDefaultDisplayLayout( 286 SetCurrentAndDefaultDisplayLayout(
(...skipping 29 matching lines...) Expand all
295 std::string key = base::Int64ToString(id1) + "," + base::Int64ToString(id2); 316 std::string key = base::Int64ToString(id1) + "," + base::Int64ToString(id2);
296 EXPECT_TRUE(displays->GetDictionary(key, &new_value)); 317 EXPECT_TRUE(displays->GetDictionary(key, &new_value));
297 EXPECT_TRUE(layout_value->Equals(new_value)); 318 EXPECT_TRUE(layout_value->Equals(new_value));
298 319
299 display_controller->SwapPrimaryDisplay(); 320 display_controller->SwapPrimaryDisplay();
300 EXPECT_TRUE(displays->GetDictionary(key, &new_value)); 321 EXPECT_TRUE(displays->GetDictionary(key, &new_value));
301 EXPECT_TRUE(layout_value->Equals(new_value)); 322 EXPECT_TRUE(layout_value->Equals(new_value));
302 } 323 }
303 324
304 TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) { 325 TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) {
305 UpdateDisplay("100x100,200x200"); 326 ash::DisplayController* display_controller =
327 ash::Shell::GetInstance()->display_controller();
328 ash::internal::DisplayManager* display_manager =
329 ash::Shell::GetInstance()->display_manager();
330
331 UpdateDisplay("200x200*2,200x200");
306 332
307 LoggedInAsGuest(); 333 LoggedInAsGuest();
334 int64 id1 = ash::ScreenAsh::GetNativeScreen()->GetPrimaryDisplay().id();
308 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id(); 335 int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id();
309 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 336 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10);
310 SetCurrentAndDefaultDisplayLayout(layout); 337 SetCurrentAndDefaultDisplayLayout(layout);
311 GetDisplayController()->SetPrimaryDisplayId(id2); 338 display_manager->SetDisplayUIScale(id1, 1.25f);
312 SetAndStoreDisplayOverscan( 339 display_controller->SetPrimaryDisplayId(id2);
313 ash::ScreenAsh::GetNativeScreen()->GetPrimaryDisplay(), 340 int64 new_primary =
341 ash::ScreenAsh::GetNativeScreen()->GetPrimaryDisplay().id();
342 display_controller->SetOverscanInsets(
343 new_primary,
314 gfx::Insets(10, 11, 12, 13)); 344 gfx::Insets(10, 11, 12, 13));
345 display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90);
315 346
316 // Does not store the preferences locally. 347 // Does not store the preferences locally.
317 EXPECT_FALSE(local_state()->FindPreference( 348 EXPECT_FALSE(local_state()->FindPreference(
318 prefs::kSecondaryDisplays)->HasUserSetting()); 349 prefs::kSecondaryDisplays)->HasUserSetting());
319 EXPECT_FALSE(local_state()->FindPreference( 350 EXPECT_FALSE(local_state()->FindPreference(
320 prefs::kSecondaryDisplayLayout)->HasUserSetting()); 351 prefs::kSecondaryDisplayLayout)->HasUserSetting());
321 EXPECT_FALSE(local_state()->FindPreference( 352 EXPECT_FALSE(local_state()->FindPreference(
322 prefs::kSecondaryDisplayOffset)->HasUserSetting()); 353 prefs::kSecondaryDisplayOffset)->HasUserSetting());
323 EXPECT_FALSE(local_state()->FindPreference( 354 EXPECT_FALSE(local_state()->FindPreference(
324 prefs::kPrimaryDisplayID)->HasUserSetting()); 355 prefs::kPrimaryDisplayID)->HasUserSetting());
325 EXPECT_FALSE(local_state()->FindPreference( 356 EXPECT_FALSE(local_state()->FindPreference(
326 prefs::kDisplayOverscans)->HasUserSetting()); 357 prefs::kDisplayProperties)->HasUserSetting());
327 358
328 // Settings are still notified to the system. 359 // Settings are still notified to the system.
329 ash::DisplayController* display_controller =
330 ash::Shell::GetInstance()->display_controller();
331 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); 360 gfx::Screen* screen = gfx::Screen::GetNativeScreen();
332 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id()); 361 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id());
333 EXPECT_EQ(ash::DisplayLayout::BOTTOM, 362 EXPECT_EQ(ash::DisplayLayout::BOTTOM,
334 display_controller->GetCurrentDisplayLayout().position); 363 display_controller->GetCurrentDisplayLayout().position);
335 EXPECT_EQ(-10, display_controller->GetCurrentDisplayLayout().offset); 364 EXPECT_EQ(-10, display_controller->GetCurrentDisplayLayout().offset);
336 EXPECT_EQ("176x178", screen->GetPrimaryDisplay().bounds().size().ToString()); 365 const gfx::Display& primary_display = screen->GetPrimaryDisplay();
366 EXPECT_EQ("178x176", primary_display.bounds().size().ToString());
367 EXPECT_EQ(gfx::Display::ROTATE_90, primary_display.rotation());
368
369 const ash::internal::DisplayInfo& info1 =
370 display_manager->GetDisplayInfo(id1);
371 EXPECT_EQ(1.25f, info1.ui_scale());
372
373 const ash::internal::DisplayInfo& info_primary =
374 display_manager->GetDisplayInfo(new_primary);
375 EXPECT_EQ(gfx::Display::ROTATE_90, info_primary.rotation());
376 EXPECT_EQ(1.0f, info_primary.ui_scale());
337 } 377 }
338 378
339 } // namespace 379 } // namespace
340 } // namespace chromeos 380 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698