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

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

Issue 1608053002: Remove now-unnecessary wrappers around gfx::Screen::GetScreen() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-5
Patch Set: cros Created 4 years, 11 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 display_manager->SetColorCalibrationProfile(id1, ui::COLOR_PROFILE_DYNAMIC); 262 display_manager->SetColorCalibrationProfile(id1, ui::COLOR_PROFILE_DYNAMIC);
263 display_manager->SetColorCalibrationProfile(id2, ui::COLOR_PROFILE_DYNAMIC); 263 display_manager->SetColorCalibrationProfile(id2, ui::COLOR_PROFILE_DYNAMIC);
264 264
265 LoggedInAsUser(); 265 LoggedInAsUser();
266 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 266 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10);
267 display_manager->SetLayoutForCurrentDisplays(layout); 267 display_manager->SetLayoutForCurrentDisplays(layout);
268 StoreDisplayLayoutPrefForTest( 268 StoreDisplayLayoutPrefForTest(
269 id1, dummy_id, ash::DisplayLayout(ash::DisplayLayout::LEFT, 20)); 269 id1, dummy_id, ash::DisplayLayout(ash::DisplayLayout::LEFT, 20));
270 // Can't switch to a display that does not exist. 270 // Can't switch to a display that does not exist.
271 window_tree_host_manager->SetPrimaryDisplayId(dummy_id); 271 window_tree_host_manager->SetPrimaryDisplayId(dummy_id);
272 EXPECT_NE(dummy_id, ash::Shell::GetScreen()->GetPrimaryDisplay().id()); 272 EXPECT_NE(dummy_id, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
273 273
274 window_tree_host_manager->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13)); 274 window_tree_host_manager->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13));
275 display_manager->SetDisplayRotation(id1, gfx::Display::ROTATE_90, 275 display_manager->SetDisplayRotation(id1, gfx::Display::ROTATE_90,
276 gfx::Display::ROTATION_SOURCE_USER); 276 gfx::Display::ROTATION_SOURCE_USER);
277 EXPECT_TRUE(ash::SetDisplayUIScale(id1, 1.25f)); 277 EXPECT_TRUE(ash::SetDisplayUIScale(id1, 1.25f));
278 EXPECT_FALSE(ash::SetDisplayUIScale(id2, 1.25f)); 278 EXPECT_FALSE(ash::SetDisplayUIScale(id2, 1.25f));
279 279
280 const base::DictionaryValue* displays = 280 const base::DictionaryValue* displays =
281 local_state()->GetDictionary(prefs::kSecondaryDisplays); 281 local_state()->GetDictionary(prefs::kSecondaryDisplays);
282 const base::DictionaryValue* layout_value = NULL; 282 const base::DictionaryValue* layout_value = NULL;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 EXPECT_TRUE(property->GetInteger("width", &width)); 467 EXPECT_TRUE(property->GetInteger("width", &width));
468 EXPECT_TRUE(property->GetInteger("height", &height)); 468 EXPECT_TRUE(property->GetInteger("height", &height));
469 EXPECT_EQ(500, width); 469 EXPECT_EQ(500, width);
470 EXPECT_EQ(400, height); 470 EXPECT_EQ(400, height);
471 } 471 }
472 472
473 TEST_F(DisplayPreferencesTest, PreventStore) { 473 TEST_F(DisplayPreferencesTest, PreventStore) {
474 ResolutionNotificationController::SuppressTimerForTest(); 474 ResolutionNotificationController::SuppressTimerForTest();
475 LoggedInAsUser(); 475 LoggedInAsUser();
476 UpdateDisplay("400x300#500x400|400x300|300x200"); 476 UpdateDisplay("400x300#500x400|400x300|300x200");
477 int64_t id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); 477 int64_t id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
478 // 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
479 // display preferences should not stored meanwhile. 479 // display preferences should not stored meanwhile.
480 ash::Shell* shell = ash::Shell::GetInstance(); 480 ash::Shell* shell = ash::Shell::GetInstance();
481 ash::DisplayMode old_mode; 481 ash::DisplayMode old_mode;
482 ash::DisplayMode new_mode; 482 ash::DisplayMode new_mode;
483 old_mode.size = gfx::Size(400, 300); 483 old_mode.size = gfx::Size(400, 300);
484 new_mode.size = gfx::Size(500, 400); 484 new_mode.size = gfx::Size(500, 400);
485 if (shell->display_manager()->SetDisplayMode(id, new_mode)) { 485 if (shell->display_manager()->SetDisplayMode(id, new_mode)) {
486 shell->resolution_notification_controller()->PrepareNotification( 486 shell->resolution_notification_controller()->PrepareNotification(
487 id, old_mode, new_mode, base::Closure()); 487 id, old_mode, new_mode, base::Closure());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 display_manager->GetDisplayInfo(id1).color_profile()); 583 display_manager->GetDisplayInfo(id1).color_profile());
584 } 584 }
585 585
586 TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) { 586 TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) {
587 ash::WindowTreeHostManager* window_tree_host_manager = 587 ash::WindowTreeHostManager* window_tree_host_manager =
588 ash::Shell::GetInstance()->window_tree_host_manager(); 588 ash::Shell::GetInstance()->window_tree_host_manager();
589 589
590 UpdateDisplay("200x200*2,200x200"); 590 UpdateDisplay("200x200*2,200x200");
591 591
592 LoggedInAsGuest(); 592 LoggedInAsGuest();
593 int64_t id1 = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); 593 int64_t id1 = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
594 ash::test::ScopedSetInternalDisplayId set_internal(id1); 594 ash::test::ScopedSetInternalDisplayId set_internal(id1);
595 int64_t id2 = ash::ScreenUtil::GetSecondaryDisplay().id(); 595 int64_t id2 = ash::ScreenUtil::GetSecondaryDisplay().id();
596 ash::DisplayManager* display_manager = 596 ash::DisplayManager* display_manager =
597 ash::Shell::GetInstance()->display_manager(); 597 ash::Shell::GetInstance()->display_manager();
598 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10); 598 ash::DisplayLayout layout(ash::DisplayLayout::TOP, 10);
599 display_manager->SetLayoutForCurrentDisplays(layout); 599 display_manager->SetLayoutForCurrentDisplays(layout);
600 ash::SetDisplayUIScale(id1, 1.25f); 600 ash::SetDisplayUIScale(id1, 1.25f);
601 window_tree_host_manager->SetPrimaryDisplayId(id2); 601 window_tree_host_manager->SetPrimaryDisplayId(id2);
602 int64_t new_primary = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); 602 int64_t new_primary = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
603 window_tree_host_manager->SetOverscanInsets(new_primary, 603 window_tree_host_manager->SetOverscanInsets(new_primary,
604 gfx::Insets(10, 11, 12, 13)); 604 gfx::Insets(10, 11, 12, 13));
605 display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90, 605 display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90,
606 gfx::Display::ROTATION_SOURCE_USER); 606 gfx::Display::ROTATION_SOURCE_USER);
607 607
608 // Does not store the preferences locally. 608 // Does not store the preferences locally.
609 EXPECT_FALSE(local_state()->FindPreference( 609 EXPECT_FALSE(local_state()->FindPreference(
610 prefs::kSecondaryDisplays)->HasUserSetting()); 610 prefs::kSecondaryDisplays)->HasUserSetting());
611 EXPECT_FALSE(local_state()->FindPreference( 611 EXPECT_FALSE(local_state()->FindPreference(
612 prefs::kDisplayProperties)->HasUserSetting()); 612 prefs::kDisplayProperties)->HasUserSetting());
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 // Sanity check. Restore to extended. 974 // Sanity check. Restore to extended.
975 StoreDisplayBoolPropertyForPair(pair, "default_unified", false); 975 StoreDisplayBoolPropertyForPair(pair, "default_unified", false);
976 StoreDisplayBoolPropertyForPair(pair, "mirrored", false); 976 StoreDisplayBoolPropertyForPair(pair, "mirrored", false);
977 LoadDisplayPreferences(false); 977 LoadDisplayPreferences(false);
978 UpdateDisplay("100x100,200x200"); 978 UpdateDisplay("100x100,200x200");
979 EXPECT_FALSE(display_manager->IsInMirrorMode()); 979 EXPECT_FALSE(display_manager->IsInMirrorMode());
980 EXPECT_FALSE(display_manager->IsInUnifiedMode()); 980 EXPECT_FALSE(display_manager->IsInUnifiedMode());
981 } 981 }
982 982
983 } // namespace chromeos 983 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698