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

Unified Diff: ash/display/display_controller_unittest.cc

Issue 1071353003: Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 6945fac2c30fc4e3803f5fda559d3646d8eabe95..ba41952bf386574e3dcb289eca3568eb7f0c48d6 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -353,7 +353,8 @@ class TestEventHandler : public ui::EventHandler {
};
gfx::Display::Rotation GetStoredRotation(int64 id) {
- return Shell::GetInstance()->display_manager()->GetDisplayInfo(id).rotation();
+ return Shell::GetInstance()->display_manager()->GetDisplayInfo(id).Rotation(
+ gfx::Display::ROTATION_SOURCE_ACTIVE);
}
float GetStoredUIScale(int64 id) {
@@ -557,7 +558,7 @@ DisplayInfo CreateDisplayInfo(int64 id,
gfx::Display::Rotation rotation) {
DisplayInfo info(id, "", false);
info.SetBounds(gfx::Rect(0, y, 500, 500));
- info.set_rotation(rotation);
+ info.SetRotation(rotation, gfx::Display::ROTATION_SOURCE_ACTIVE);
return info;
}
@@ -686,12 +687,14 @@ TEST_F(DisplayControllerTest, BoundsUpdated) {
// Rotation
observer.GetRotationChangedCountAndReset(); // we only want to reset.
int64 primary_id = GetPrimaryDisplay().id();
- display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_90);
+ display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_90,
+ gfx::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ(1, observer.GetRotationChangedCountAndReset());
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
- display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_90);
+ display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_90,
+ gfx::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ(0, observer.GetRotationChangedCountAndReset());
EXPECT_EQ(0, observer.CountAndReset());
EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
@@ -1050,8 +1053,8 @@ TEST_F(DisplayControllerTest, Rotate) {
EXPECT_EQ(gfx::Display::ROTATE_0, GetStoredRotation(display2_id));
EXPECT_EQ(0, observer.GetRotationChangedCountAndReset());
- display_manager->SetDisplayRotation(display1.id(),
- gfx::Display::ROTATE_90);
+ display_manager->SetDisplayRotation(display1.id(), gfx::Display::ROTATE_90,
+ gfx::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString());
EXPECT_EQ("150x200", root_windows[1]->bounds().size().ToString());
EXPECT_EQ("200,0 150x200",
@@ -1067,8 +1070,8 @@ TEST_F(DisplayControllerTest, Rotate) {
EXPECT_EQ("50,120 150x200",
ScreenUtil::GetSecondaryDisplay().bounds().ToString());
- display_manager->SetDisplayRotation(display2_id,
- gfx::Display::ROTATE_270);
+ display_manager->SetDisplayRotation(display2_id, gfx::Display::ROTATE_270,
+ gfx::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString());
EXPECT_EQ("200x150", root_windows[1]->bounds().size().ToString());
EXPECT_EQ("50,120 200x150",
@@ -1081,8 +1084,8 @@ TEST_F(DisplayControllerTest, Rotate) {
ui::test::EventGenerator generator2(root_windows[1]);
generator2.MoveMouseToInHost(50, 40);
EXPECT_EQ("179,25", event_handler.GetLocationAndReset());
- display_manager->SetDisplayRotation(display1.id(),
- gfx::Display::ROTATE_180);
+ display_manager->SetDisplayRotation(display1.id(), gfx::Display::ROTATE_180,
+ gfx::Display::ROTATION_SOURCE_ACTIVE);
EXPECT_EQ("120x200", root_windows[0]->bounds().size().ToString());
EXPECT_EQ("200x150", root_windows[1]->bounds().size().ToString());

Powered by Google App Engine
This is Rietveld 408576698