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

Unified Diff: ash/display/display_controller_unittest.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 8 years, 2 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_controller_unittest.cc
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc
index 97d7707730fb5131bf5925460bba13e4cbe61d1a..167ba1c4455466ae30a8ea76b07dd150f9b2ec7a 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -47,12 +47,12 @@ class TestObserver : public DisplayController::Observer {
};
gfx::Display GetPrimaryDisplay() {
- return gfx::Screen::GetDisplayNearestWindow(
+ return ash::Shell::GetAshScreen()->GetDisplayNearestWindow(
Shell::GetAllRootWindows()[0]);
}
gfx::Display GetSecondaryDisplay() {
- return gfx::Screen::GetDisplayNearestWindow(
+ return ash::Shell::GetAshScreen()->GetDisplayNearestWindow(
Shell::GetAllRootWindows()[1]);
}
@@ -146,11 +146,11 @@ TEST_F(DisplayControllerTest, MAYBE_BoundsUpdated) {
UpdateDisplay("400x400");
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString());
- EXPECT_EQ(1, gfx::Screen::GetNumDisplays());
+ EXPECT_EQ(1, ash::Shell::GetAshScreen()->GetNumDisplays());
UpdateDisplay("500x500,700x700");
EXPECT_EQ(2, observer.CountAndReset());
- ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
+ ASSERT_EQ(2, ash::Shell::GetAshScreen()->GetNumDisplays());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,500 700x700", GetSecondaryDisplay().bounds().ToString());
}
@@ -190,7 +190,8 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
Shell::GetInstance()->display_controller();
UpdateDisplay("200x200,300x300");
- gfx::Display primary_display = gfx::Screen::GetPrimaryDisplay();
+ gfx::Display primary_display =
+ ash::Shell::GetAshScreen()->GetPrimaryDisplay();
gfx::Display secondary_display = ScreenAsh::GetSecondaryDisplay();
std::string secondary_name = aura::Env::GetInstance()->
@@ -209,18 +210,21 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
EXPECT_TRUE(primary_root->Contains(launcher_window));
EXPECT_FALSE(secondary_root->Contains(launcher_window));
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetDisplayNearestPoint(gfx::Point(-100, -100)).id());
+ ash::Shell::GetAshScreen()->GetDisplayNearestPoint(
+ gfx::Point(-100, -100)).id());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetDisplayNearestWindow(NULL).id());
+ ash::Shell::GetAshScreen()->GetDisplayNearestWindow(NULL).id());
// Switch primary and secondary
display_controller->SetPrimaryDisplay(secondary_display);
- EXPECT_EQ(secondary_display.id(), gfx::Screen::GetPrimaryDisplay().id());
+ EXPECT_EQ(secondary_display.id(),
+ ash::Shell::GetAshScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(primary_display.id(), ScreenAsh::GetSecondaryDisplay().id());
EXPECT_EQ(secondary_display.id(),
- gfx::Screen::GetDisplayNearestPoint(gfx::Point(-100, -100)).id());
+ ash::Shell::GetAshScreen()->GetDisplayNearestPoint(
+ gfx::Point(-100, -100)).id());
EXPECT_EQ(secondary_display.id(),
- gfx::Screen::GetDisplayNearestWindow(NULL).id());
+ ash::Shell::GetAshScreen()->GetDisplayNearestWindow(NULL).id());
EXPECT_EQ(
primary_root,
@@ -243,12 +247,14 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
// Deleting 2nd display should move the primary to original primary display.
UpdateDisplay("200x200");
RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task.
- EXPECT_EQ(1, gfx::Screen::GetNumDisplays());
- EXPECT_EQ(primary_display.id(), gfx::Screen::GetPrimaryDisplay().id());
+ EXPECT_EQ(1, ash::Shell::GetAshScreen()->GetNumDisplays());
+ EXPECT_EQ(primary_display.id(),
+ ash::Shell::GetAshScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetDisplayNearestPoint(gfx::Point(-100, -100)).id());
+ ash::Shell::GetAshScreen()->GetDisplayNearestPoint(
+ gfx::Point(-100, -100)).id());
EXPECT_EQ(primary_display.id(),
- gfx::Screen::GetDisplayNearestWindow(NULL).id());
+ ash::Shell::GetAshScreen()->GetDisplayNearestWindow(NULL).id());
EXPECT_TRUE(tracker.Contains(primary_root));
EXPECT_FALSE(tracker.Contains(secondary_root));
EXPECT_TRUE(primary_root->Contains(launcher_window));
@@ -256,7 +262,7 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
TEST_F(DisplayControllerTest, MAYBE_UpdateDisplayWithHostOrigin) {
UpdateDisplay("100x200,300x400");
- ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
+ ASSERT_EQ(2, ash::Shell::GetAshScreen()->GetNumDisplays());
Shell::RootWindowList root_windows =
Shell::GetInstance()->GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
@@ -267,21 +273,21 @@ TEST_F(DisplayControllerTest, MAYBE_UpdateDisplayWithHostOrigin) {
EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString());
UpdateDisplay("100x200,200+300-300x400");
- ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
+ ASSERT_EQ(2, ash::Shell::GetAshScreen()->GetNumDisplays());
EXPECT_EQ("0,0", root_windows[0]->GetHostOrigin().ToString());
EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString());
EXPECT_EQ("200,300", root_windows[1]->GetHostOrigin().ToString());
EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString());
UpdateDisplay("400+500-200x300,300x400");
- ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
+ ASSERT_EQ(2, ash::Shell::GetAshScreen()->GetNumDisplays());
EXPECT_EQ("400,500", root_windows[0]->GetHostOrigin().ToString());
EXPECT_EQ("200x300", root_windows[0]->GetHostSize().ToString());
EXPECT_EQ("0,0", root_windows[1]->GetHostOrigin().ToString());
EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString());
UpdateDisplay("100+200-100x200,300+500-200x300");
- ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
+ ASSERT_EQ(2, ash::Shell::GetAshScreen()->GetNumDisplays());
EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString());
EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString());
EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString());

Powered by Google App Engine
This is Rietveld 408576698