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

Unified Diff: chrome/browser/chromeos/display/display_preferences_unittest.cc

Issue 1108343002: Revert of Merge Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2357
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: chrome/browser/chromeos/display/display_preferences_unittest.cc
diff --git a/chrome/browser/chromeos/display/display_preferences_unittest.cc b/chrome/browser/chromeos/display/display_preferences_unittest.cc
index 96c08ad7371f9dcae752b9e22fa8c145fb486fe6..d38e5723c070cac4bee2579337c74c09e1ed7b69 100644
--- a/chrome/browser/chromeos/display/display_preferences_unittest.cc
+++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc
@@ -245,8 +245,7 @@
EXPECT_NE(dummy_id, ash::Shell::GetScreen()->GetPrimaryDisplay().id());
display_controller->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13));
- display_manager->SetDisplayRotation(id1, gfx::Display::ROTATE_90,
- gfx::Display::ROTATION_SOURCE_USER);
+ display_manager->SetDisplayRotation(id1, gfx::Display::ROTATE_90);
EXPECT_TRUE(display_manager->SetDisplayUIScale(id1, 1.25f));
EXPECT_FALSE(display_manager->SetDisplayUIScale(id2, 1.25f));
@@ -577,8 +576,7 @@
display_controller->SetOverscanInsets(
new_primary,
gfx::Insets(10, 11, 12, 13));
- display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90,
- gfx::Display::ROTATION_SOURCE_USER);
+ display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90);
// Does not store the preferences locally.
EXPECT_FALSE(local_state()->FindPreference(
@@ -601,7 +599,7 @@
const ash::DisplayInfo& info_primary =
display_manager->GetDisplayInfo(new_primary);
- EXPECT_EQ(gfx::Display::ROTATE_90, info_primary.GetActiveRotation());
+ EXPECT_EQ(gfx::Display::ROTATE_90, info_primary.rotation());
EXPECT_EQ(1.0f, info_primary.configured_ui_scale());
}
@@ -671,12 +669,10 @@
LoggedInAsUser();
// Populate the properties.
display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
- gfx::Display::ROTATE_180,
- gfx::Display::ROTATION_SOURCE_USER);
+ gfx::Display::ROTATE_180);
// Reset property to avoid rotation lock
display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
- gfx::Display::ROTATE_0,
- gfx::Display::ROTATION_SOURCE_USER);
+ gfx::Display::ROTATE_0);
// Open up 270 degrees to trigger maximize mode
scoped_refptr<chromeos::AccelerometerUpdate> update(
@@ -694,7 +690,8 @@
update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, -kMeanGravity, 0.0f, 0.0f);
controller->OnAccelerometerUpdated(update);
shell->screen_orientation_controller()->OnAccelerometerUpdated(update);
- EXPECT_EQ(gfx::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
+ EXPECT_EQ(gfx::Display::ROTATE_90, display_manager->
+ GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation());
const base::DictionaryValue* properties =
local_state()->GetDictionary(prefs::kDisplayProperties);
@@ -704,17 +701,6 @@
int rotation = -1;
EXPECT_TRUE(property->GetInteger("rotation", &rotation));
EXPECT_EQ(gfx::Display::ROTATE_0, rotation);
-
- // Trigger a save, the acceleration rotation should not be saved as the user
- // rotation.
- StoreDisplayPrefs();
- properties = local_state()->GetDictionary(prefs::kDisplayProperties);
- property = NULL;
- EXPECT_TRUE(properties->GetDictionary(
- base::Int64ToString(gfx::Display::InternalDisplayId()), &property));
- rotation = -1;
- EXPECT_TRUE(property->GetInteger("rotation", &rotation));
- EXPECT_EQ(gfx::Display::ROTATE_0, rotation);
}
// Tests that the rotation state is saved without a user being logged in.
@@ -734,7 +720,9 @@
EXPECT_EQ(current_rotation_lock, rotation_lock);
int orientation;
- gfx::Display::Rotation current_rotation = GetCurrentInternalDisplayRotation();
+ gfx::Display::Rotation current_rotation = ash::Shell::GetInstance()->
+ display_manager()->
+ GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation();
EXPECT_TRUE(properties->GetInteger("orientation", &orientation));
EXPECT_EQ(current_rotation, orientation);
}
@@ -757,7 +745,9 @@
EXPECT_EQ(current_rotation_lock, rotation_lock);
int orientation;
- gfx::Display::Rotation current_rotation = GetCurrentInternalDisplayRotation();
+ gfx::Display::Rotation current_rotation = ash::Shell::GetInstance()->
+ display_manager()->
+ GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation();
EXPECT_TRUE(properties->GetInteger("orientation", &orientation));
EXPECT_EQ(current_rotation, orientation);
}
@@ -780,7 +770,9 @@
EXPECT_EQ(current_rotation_lock, rotation_lock);
int orientation;
- gfx::Display::Rotation current_rotation = GetCurrentInternalDisplayRotation();
+ gfx::Display::Rotation current_rotation = ash::Shell::GetInstance()->
+ display_manager()->
+ GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation();
EXPECT_TRUE(properties->GetInteger("orientation", &orientation));
EXPECT_EQ(current_rotation, orientation);
}
@@ -796,7 +788,8 @@
bool initial_rotation_lock = IsRotationLocked();
ASSERT_FALSE(initial_rotation_lock);
ash::DisplayManager* display_manager = shell->display_manager();
- gfx::Display::Rotation initial_rotation = GetCurrentInternalDisplayRotation();
+ gfx::Display::Rotation initial_rotation = display_manager->
+ GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation();
ASSERT_EQ(gfx::Display::ROTATE_0, initial_rotation);
StoreDisplayRotationPrefs(initial_rotation_lock);
@@ -813,8 +806,8 @@
EXPECT_EQ(gfx::Display::ROTATE_90, display_rotation);
bool rotation_lock = IsRotationLocked();
- gfx::Display::Rotation before_maximize_mode_rotation =
- GetCurrentInternalDisplayRotation();
+ gfx::Display::Rotation before_maximize_mode_rotation = display_manager->
+ GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation();
// Settings should not be applied until maximize mode activates
EXPECT_FALSE(rotation_lock);
@@ -831,8 +824,8 @@
maximize_mode_controller->OnAccelerometerUpdated(update);
EXPECT_TRUE(maximize_mode_controller->IsMaximizeModeWindowManagerEnabled());
bool screen_orientation_rotation_lock = IsRotationLocked();
- gfx::Display::Rotation maximize_mode_rotation =
- GetCurrentInternalDisplayRotation();
+ gfx::Display::Rotation maximize_mode_rotation = display_manager->
+ GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation();
EXPECT_TRUE(screen_orientation_rotation_lock);
EXPECT_EQ(gfx::Display::ROTATE_90, maximize_mode_rotation);
}
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences.cc ('k') | chrome/browser/extensions/display_info_provider_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698