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 e546a6e787479ac2bdc6eceef6e249212ebbc48c..623e5f27eb9b338670a7120931825faa3bb07ed1 100644 |
--- a/chrome/browser/chromeos/display/display_preferences_unittest.cc |
+++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc |
@@ -221,7 +221,9 @@ TEST_F(DisplayPreferencesTest, BasicStores) { |
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); |
+ display_manager->SetDisplayRotation(id1, |
+ gfx::Display::ROTATE_90, |
+ ui::USER); |
display_manager->SetDisplayUIScale(id1, 1.25f); |
display_manager->SetDisplayUIScale(id2, 1.25f); |
@@ -538,7 +540,9 @@ TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) { |
display_controller->SetOverscanInsets( |
new_primary, |
gfx::Insets(10, 11, 12, 13)); |
- display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90); |
+ display_manager->SetDisplayRotation(new_primary, |
+ gfx::Display::ROTATE_90, |
+ ui::USER); |
// Does not store the preferences locally. |
EXPECT_FALSE(local_state()->FindPreference( |
@@ -620,4 +624,26 @@ TEST_F(DisplayPreferencesTest, DontSaveAndRestoreAllOff) { |
shell->display_configurator()->power_state()); |
} |
+// Tests that changes to display rotation caused by an accelerometer are not |
+// saved to user preferences. |
+TEST_F(DisplayPreferencesTest, DontSaveAccelerometerRotation) { |
+ ash::DisplayManager* display_manager = |
+ ash::Shell::GetInstance()->display_manager(); |
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), |
+ gfx::Display::ROTATE_180, |
+ ui::USER); |
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), |
+ gfx::Display::ROTATE_0, |
+ ui::ACCELEROMETER); |
+ const base::DictionaryValue* properties = |
+ local_state()->GetDictionary(prefs::kDisplayProperties); |
+ const base::DictionaryValue* property = NULL; |
+ EXPECT_TRUE(properties->GetDictionary( |
+ base::Int64ToString(gfx::Display::InternalDisplayId()), |
+ &property)); |
+ int rotation = -1; |
+ EXPECT_TRUE(property->GetInteger("rotation", &rotation)); |
+ EXPECT_EQ(gfx::Display::ROTATE_180, rotation); |
+} |
+ |
} // namespace chromeos |