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

Unified Diff: ash/display/display_controller_unittest.cc

Issue 10870036: Allow storing display preferences per device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 4 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 055ca4b3e2bb2cb87411ab32c0b195cfce301f03..fba03905454bc325ea37c9e77ec5aa4283084d78 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -26,6 +26,14 @@ gfx::Display GetSecondaryDisplay() {
Shell::GetAllRootWindows()[1]);
}
+void SetSecondaryDisplayLayout(DisplayLayout::Position position) {
+ DisplayController* display_controller =
+ Shell::GetInstance()->display_controller();
+ DisplayLayout layout = display_controller->default_display_layout();
+ layout.position = position;
+ display_controller->SetDefaultDisplayLayout(layout);
+}
+
} // namespace
typedef test::AshTestBase DisplayControllerTest;
@@ -51,22 +59,19 @@ TEST_F(DisplayControllerTest, MAYBE_SecondaryDisplayLayout) {
EXPECT_EQ("505,5 390x390", GetSecondaryDisplay().work_area().ToString());
// Layout the secondary display to the bottom of the primary.
- Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
- internal::DisplayController::BOTTOM);
+ SetSecondaryDisplayLayout(DisplayLayout::BOTTOM);
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,500 400x400", GetSecondaryDisplay().bounds().ToString());
EXPECT_EQ("5,505 390x390", GetSecondaryDisplay().work_area().ToString());
// Layout the secondary display to the left of the primary.
- Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
- internal::DisplayController::LEFT);
+ SetSecondaryDisplayLayout(DisplayLayout::LEFT);
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("-400,0 400x400", GetSecondaryDisplay().bounds().ToString());
EXPECT_EQ("-395,5 390x390", GetSecondaryDisplay().work_area().ToString());
// Layout the secondary display to the top of the primary.
- Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
- internal::DisplayController::TOP);
+ SetSecondaryDisplayLayout(DisplayLayout::TOP);
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,-400 400x400", GetSecondaryDisplay().bounds().ToString());
EXPECT_EQ("5,-395 390x390", GetSecondaryDisplay().work_area().ToString());
@@ -77,8 +82,7 @@ TEST_F(DisplayControllerTest, MAYBE_SecondaryDisplayLayout) {
// always been incorrect, but is now visibly broken now that we're processing
// X11 configuration events while waiting for the MapNotify.
TEST_F(DisplayControllerTest, DISABLED_BoundsUpdated) {
- Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
- internal::DisplayController::BOTTOM);
+ SetSecondaryDisplayLayout(DisplayLayout::BOTTOM);
UpdateDisplay("500x500,400x400");
gfx::Display* secondary_display =
aura::Env::GetInstance()->display_manager()->GetDisplayAt(1);
@@ -114,10 +118,10 @@ TEST_F(DisplayControllerTest, DISABLED_BoundsUpdated) {
TEST_F(DisplayControllerTest, WarpMouse) {
UpdateDisplay("500x500,500x500");
- ash::internal::DisplayController* controller =
+ ash::DisplayController* controller =
Shell::GetInstance()->display_controller();
- EXPECT_EQ(internal::DisplayController::RIGHT,
- controller->secondary_display_layout());
+ EXPECT_EQ(DisplayLayout::RIGHT,
+ controller->default_display_layout().position);
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
bool is_warped = controller->WarpMouseCursorIfNecessary(root_windows[0],
@@ -172,10 +176,10 @@ TEST_F(DisplayControllerTest, WarpMouse) {
TEST_F(DisplayControllerTest, WarpMouseDifferentSizeDisplays) {
UpdateDisplay("500x500,600x600"); // the second one is larger.
- ash::internal::DisplayController* controller =
+ ash::DisplayController* controller =
Shell::GetInstance()->display_controller();
- EXPECT_EQ(internal::DisplayController::RIGHT,
- controller->secondary_display_layout());
+ EXPECT_EQ(DisplayLayout::RIGHT,
+ controller->default_display_layout().position);
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
aura::Env::GetInstance()->SetLastMouseLocation(*root_windows[1],
@@ -202,7 +206,7 @@ TEST_F(DisplayControllerTest, WarpMouseDifferentSizeDisplays) {
TEST_F(DisplayControllerTest, SetUnsetDontWarpMousedFlag) {
UpdateDisplay("500x500,500x500");
- ash::internal::DisplayController* controller =
+ ash::DisplayController* controller =
Shell::GetInstance()->display_controller();
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();

Powered by Google App Engine
This is Rietveld 408576698