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

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/cursor_window_controller_unittest.cc ('k') | ash/display/event_transformation_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index d773c084060f8821a51ac8ed17350abb801c69c8..4bad4ebfcf450d36b343de74090388599d627cf1 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();
}
@@ -415,31 +415,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) {
@@ -530,7 +531,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());
@@ -540,7 +541,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",
@@ -955,7 +957,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);
@@ -1012,7 +1014,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());
@@ -1030,7 +1032,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());
@@ -1040,7 +1042,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());
}
@@ -1105,7 +1107,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");
@@ -1139,7 +1141,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());
@@ -1147,7 +1149,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);
@@ -1155,7 +1157,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);
@@ -1164,7 +1166,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);
@@ -1270,7 +1272,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);
@@ -1279,7 +1281,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());
@@ -1322,7 +1324,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) {
@@ -1395,17 +1397,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());
}
@@ -1491,7 +1493,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());
@@ -1505,21 +1507,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());
@@ -1924,7 +1926,8 @@ typedef testing::Test DisplayManagerFontTest;
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) {
FontTestHelper helper(1.0f, FontTestHelper::INTERNAL);
ASSERT_DOUBLE_EQ(
- 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 1.0f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
@@ -1933,7 +1936,8 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) {
test::ScopedDisable125DSFForUIScaling disable;
FontTestHelper helper(1.25f, FontTestHelper::INTERNAL);
ASSERT_DOUBLE_EQ(
- 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 1.25f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
@@ -1941,14 +1945,16 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) {
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) {
FontTestHelper helper(2.0f, FontTestHelper::INTERNAL);
ASSERT_DOUBLE_EQ(
- 2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 2.0f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
- SetDisplayUIScale(Shell::GetScreen()->GetPrimaryDisplay().id(), 2.0f);
+ SetDisplayUIScale(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), 2.0f);
ASSERT_DOUBLE_EQ(
- 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 1.0f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
@@ -1956,7 +1962,8 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) {
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) {
FontTestHelper helper(1.0f, FontTestHelper::EXTERNAL);
ASSERT_DOUBLE_EQ(
- 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 1.0f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
@@ -1964,7 +1971,8 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) {
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) {
FontTestHelper helper(1.25f, FontTestHelper::EXTERNAL);
ASSERT_DOUBLE_EQ(
- 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 1.25f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
@@ -1972,7 +1980,8 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) {
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) {
FontTestHelper helper(2.0f, FontTestHelper::EXTERNAL);
ASSERT_DOUBLE_EQ(
- 2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 2.0f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
@@ -1981,14 +1990,16 @@ TEST_F(DisplayManagerFontTest,
TextSubpixelPositioningWithDsf125InternalWithScaling) {
FontTestHelper helper(1.25f, FontTestHelper::INTERNAL);
ASSERT_DOUBLE_EQ(
- 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 1.0f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
- SetDisplayUIScale(Shell::GetScreen()->GetPrimaryDisplay().id(), 0.8f);
+ SetDisplayUIScale(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), 0.8f);
ASSERT_DOUBLE_EQ(
- 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ 1.25f,
+ gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
« no previous file with comments | « ash/display/cursor_window_controller_unittest.cc ('k') | ash/display/event_transformation_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698