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

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

Issue 289583002: Lock rotation when screen is manually rotated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix non chromeOS builds Created 6 years, 7 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
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cc48183c2bded8d8ece65547aa46adf62610b287..7d889f04103dc7d0473d4df0b2126445d946f4b7 100644
--- a/chrome/browser/chromeos/display/display_preferences_unittest.cc
+++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc
@@ -12,6 +12,7 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
+#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/prefs/testing_pref_service.h"
#include "base/strings/string_number_conversions.h"
@@ -22,6 +23,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_browser_process.h"
#include "ui/display/chromeos/display_configurator.h"
+#include "ui/gfx/vector3d_f.h"
#include "ui/message_center/message_center.h"
using ash::ResolutionNotificationController;
@@ -620,4 +622,41 @@ TEST_F(DisplayPreferencesTest, DontSaveAndRestoreAllOff) {
shell->display_configurator()->power_state());
}
+// Tests that display configuration changes caused by MaximizeModeController
+// are not saved.
+TEST_F(DisplayPreferencesTest, DontSaveMaximizeModeControllerRotations) {
+ ash::Shell* shell = ash::Shell::GetInstance();
+ ash::MaximizeModeController* controller = shell->maximize_mode_controller();
+ gfx::Display::SetInternalDisplayId(
+ gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id());
+ ash::DisplayManager* display_manager = shell->display_manager();
+ LoggedInAsUser();
+ // Populate the properties.
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
+ gfx::Display::ROTATE_180);
+ // Reset property to avoid rotation lock
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
+ gfx::Display::ROTATE_0);
+
+ // Open up 270 degrees to trigger maximize mode
+ controller->OnAccelerometerUpdated(gfx::Vector3dF(0.0f, 0.0f, -1.0f),
+ gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
+ EXPECT_TRUE(shell->IsMaximizeModeWindowManagerEnabled());
+
+ // Trigger 90 degree rotation
+ controller->OnAccelerometerUpdated(gfx::Vector3dF(0.0f, 1.0f, 0.0f),
+ gfx::Vector3dF(0.0f, 1.0f, 0.0f));
+ EXPECT_EQ(gfx::Display::ROTATE_90, display_manager->
+ GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation());
+
+ 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_0, rotation);
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698