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

Unified Diff: ash/display/display_manager_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: . 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index a073bb39f8bd29e072e6781b82d12fdbae153870..d488856632932c0b22e7d23debdd4f61df4b6aec 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -59,12 +59,12 @@ class DisplayManagerTest : public test::AshTestBase,
void SetUp() override {
AshTestBase::SetUp();
- Shell::GetScreen()->AddObserver(this);
+ gfx::Screen::GetScreen()->AddObserver(this);
Shell::GetPrimaryRootWindow()->AddObserver(this);
}
void TearDown() override {
Shell::GetPrimaryRootWindow()->RemoveObserver(this);
- Shell::GetScreen()->RemoveObserver(this);
+ gfx::Screen::GetScreen()->RemoveObserver(this);
AshTestBase::TearDown();
}
@@ -403,31 +403,32 @@ TEST_F(DisplayManagerTest, OverscanInsetsTest) {
GetDisplayInfo(ScreenUtil::GetSecondaryDisplay()).
bounds_in_native().ToString());
EXPECT_EQ("0,501 400x400",
- GetDisplayInfo(Shell::GetScreen()->GetPrimaryDisplay()).
- bounds_in_native().ToString());
+ GetDisplayInfo(gfx::Screen::GetScreen()->GetPrimaryDisplay())
+ .bounds_in_native()
+ .ToString());
EXPECT_EQ("0,0 188x190",
- Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString());
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
// Make sure just moving the overscan area should property notify observers.
UpdateDisplay("0+0-500x500");
- int64_t primary_id = Shell::GetScreen()->GetPrimaryDisplay().id();
+ int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 20, 20));
EXPECT_EQ("0,0 480x480",
- Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString());
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
reset();
display_manager()->SetOverscanInsets(primary_id, gfx::Insets(10, 10, 10, 10));
EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
EXPECT_TRUE(
changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
EXPECT_EQ("0,0 480x480",
- Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString());
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
reset();
display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 0, 0));
EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
EXPECT_TRUE(
changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
EXPECT_EQ("0,0 500x500",
- Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString());
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
}
TEST_F(DisplayManagerTest, ZeroOverscanInsets) {
@@ -518,7 +519,7 @@ TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) {
GetDisplayInfoForId(external_id).bounds_in_native().ToString());
EXPECT_EQ(1U, display_manager()->num_connected_displays());
EXPECT_FALSE(display_manager()->IsInMirrorMode());
- EXPECT_EQ(external_id, Shell::GetScreen()->GetPrimaryDisplay().id());
+ EXPECT_EQ(external_id, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(internal_display_id, gfx::Display::InternalDisplayId());
@@ -528,7 +529,8 @@ TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) {
display_info_list.push_back(external_display_info);
display_manager()->OnNativeDisplaysChanged(display_info_list);
EXPECT_EQ(2U, display_manager()->GetNumDisplays());
- EXPECT_EQ(internal_display_id, Shell::GetScreen()->GetPrimaryDisplay().id());
+ EXPECT_EQ(internal_display_id,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
// This combinatino is new, so internal display becomes primary.
EXPECT_EQ("0,0 500x500",
@@ -943,7 +945,7 @@ TEST_F(DisplayManagerTest, UIScale) {
test::ScopedDisable125DSFForUIScaling disable;
UpdateDisplay("1280x800");
- int64_t display_id = Shell::GetScreen()->GetPrimaryDisplay().id();
+ int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
SetDisplayUIScale(display_id, 1.125f);
EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale());
SetDisplayUIScale(display_id, 0.8f);
@@ -1000,7 +1002,7 @@ TEST_F(DisplayManagerTest, UIScale) {
EXPECT_EQ(1.125f, GetDisplayInfoAt(0).configured_ui_scale());
SetDisplayUIScale(display_id, 1.0f);
EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
- gfx::Display display = Shell::GetScreen()->GetPrimaryDisplay();
+ gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
EXPECT_EQ(2.0f, display.device_scale_factor());
EXPECT_EQ("640x425", display.bounds().size().ToString());
@@ -1018,7 +1020,7 @@ TEST_F(DisplayManagerTest, UIScale) {
SetDisplayUIScale(display_id, 2.0f);
EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale());
EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
- display = Shell::GetScreen()->GetPrimaryDisplay();
+ display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
EXPECT_EQ(1.0f, display.device_scale_factor());
EXPECT_EQ("1280x850", display.bounds().size().ToString());
@@ -1028,7 +1030,7 @@ TEST_F(DisplayManagerTest, UIScale) {
SetDisplayUIScale(display_id, 1.25f);
EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale());
EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
- display = Shell::GetScreen()->GetPrimaryDisplay();
+ display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
EXPECT_EQ(1.0f, display.device_scale_factor());
EXPECT_EQ("1280x850", display.bounds().size().ToString());
}
@@ -1093,7 +1095,7 @@ TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) {
}
TEST_F(DisplayManagerTest, Use125DSFForUIScaling) {
- int64_t display_id = Shell::GetScreen()->GetPrimaryDisplay().id();
+ int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
test::ScopedSetInternalDisplayId set_internal(display_id);
UpdateDisplay("1920x1080*1.25");
@@ -1127,7 +1129,7 @@ TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) {
UpdateDisplay("200x200, 400x400");
- int64_t unified_id = Shell::GetScreen()->GetPrimaryDisplay().id();
+ int64_t unified_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
DisplayInfo info = display_manager->GetDisplayInfo(unified_id);
ASSERT_EQ(2u, info.display_modes().size());
EXPECT_EQ("400x200", info.display_modes()[0].size.ToString());
@@ -1135,7 +1137,7 @@ TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) {
EXPECT_EQ("800x400", info.display_modes()[1].size.ToString());
EXPECT_FALSE(info.display_modes()[1].native);
EXPECT_EQ("400x200",
- Shell::GetScreen()->GetPrimaryDisplay().size().ToString());
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
DisplayMode active_mode =
display_manager->GetActiveModeForDisplayId(unified_id);
EXPECT_EQ(1.0f, active_mode.ui_scale);
@@ -1143,7 +1145,7 @@ TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) {
EXPECT_TRUE(test::SetDisplayResolution(unified_id, gfx::Size(800, 400)));
EXPECT_EQ("800x400",
- Shell::GetScreen()->GetPrimaryDisplay().size().ToString());
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
active_mode = display_manager->GetActiveModeForDisplayId(unified_id);
EXPECT_EQ(1.0f, active_mode.ui_scale);
@@ -1152,7 +1154,7 @@ TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) {
// resolution change will not persist in unified desktop mode.
UpdateDisplay("600x600, 200x200");
EXPECT_EQ("1200x600",
- Shell::GetScreen()->GetPrimaryDisplay().size().ToString());
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
active_mode = display_manager->GetActiveModeForDisplayId(unified_id);
EXPECT_EQ(1.0f, active_mode.ui_scale);
EXPECT_TRUE(active_mode.native);
@@ -1258,7 +1260,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) {
EXPECT_EQ(NULL, test_api.GetHost());
TestDisplayObserver display_observer;
- Shell::GetScreen()->AddObserver(&display_observer);
+ gfx::Screen::GetScreen()->AddObserver(&display_observer);
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING);
@@ -1267,7 +1269,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) {
EXPECT_TRUE(display_observer.changed_and_reset());
EXPECT_EQ(1U, display_manager->GetNumDisplays());
EXPECT_EQ("0,0 300x400",
- Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString());
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("400x500", test_api.GetHost()->GetBounds().size().ToString());
EXPECT_EQ("300x400",
test_api.GetHost()->window()->bounds().size().ToString());
@@ -1310,7 +1312,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) {
EXPECT_EQ("400x600",
test_api.GetHost()->window()->bounds().size().ToString());
- Shell::GetScreen()->RemoveObserver(&display_observer);
+ gfx::Screen::GetScreen()->RemoveObserver(&display_observer);
}
TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) {
@@ -1383,17 +1385,17 @@ TEST_F(DisplayManagerTest, MirroredLayout) {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
UpdateDisplay("500x500,400x400");
EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored);
- EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ(2U, display_manager->num_connected_displays());
UpdateDisplay("1+0-500x500,1+0-500x500");
EXPECT_TRUE(display_manager->GetCurrentDisplayLayout().mirrored);
- EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ(2U, display_manager->num_connected_displays());
UpdateDisplay("500x500,500x500");
EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored);
- EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ(2U, display_manager->num_connected_displays());
}
@@ -1479,7 +1481,7 @@ TEST_F(DisplayManagerTest, NotifyPrimaryChangeUndock) {
TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) {
UpdateDisplay("100x200,300x400");
- ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
+ ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
aura::Window::Windows root_windows =
Shell::GetInstance()->GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
@@ -1493,21 +1495,21 @@ TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) {
EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
UpdateDisplay("100x200,200+300-300x400");
- ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
+ ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ("0,0", host0->GetBounds().origin().ToString());
EXPECT_EQ("100x200", host0->GetBounds().size().ToString());
EXPECT_EQ("200,300", host1->GetBounds().origin().ToString());
EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
UpdateDisplay("400+500-200x300,300x400");
- ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
+ ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ("400,500", host0->GetBounds().origin().ToString());
EXPECT_EQ("200x300", host0->GetBounds().size().ToString());
EXPECT_EQ("0,0", host1->GetBounds().origin().ToString());
EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
UpdateDisplay("100+200-100x200,300+500-200x300");
- ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
+ ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
EXPECT_EQ("100,200", host0->GetBounds().origin().ToString());
EXPECT_EQ("100x200", host0->GetBounds().size().ToString());
EXPECT_EQ("300,500", host1->GetBounds().origin().ToString());

Powered by Google App Engine
This is Rietveld 408576698