| Index: ash/content/display/screen_orientation_controller_chromeos_unittest.cc
|
| diff --git a/ash/content/display/screen_orientation_controller_chromeos_unittest.cc b/ash/content/display/screen_orientation_controller_chromeos_unittest.cc
|
| index 90df6ec72279f2b81381a81dab23718d74a02778..a9611a3f754afb0a78f7708fbaa790c62487e590 100644
|
| --- a/ash/content/display/screen_orientation_controller_chromeos_unittest.cc
|
| +++ b/ash/content/display/screen_orientation_controller_chromeos_unittest.cc
|
| @@ -20,7 +20,7 @@
|
| #include "ash/test/screen_orientation_controller_test_api.h"
|
| #include "ash/test/test_shell_delegate.h"
|
| #include "ash/test/test_system_tray_delegate.h"
|
| -#include "ash/wm/maximize_mode/maximize_mode_controller.h"
|
| +#include "ash/wm/tablet_mode/tablet_mode_controller.h"
|
| #include "ash/wm/window_state.h"
|
| #include "ash/wm_window.h"
|
| #include "base/command_line.h"
|
| @@ -56,9 +56,8 @@ display::ManagedDisplayInfo CreateDisplayInfo(int64_t id,
|
| return info;
|
| }
|
|
|
| -void EnableMaximizeMode(bool enable) {
|
| - Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
|
| - enable);
|
| +void EnableTabletMode(bool enable) {
|
| + Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(enable);
|
| }
|
|
|
| bool RotationLocked() {
|
| @@ -360,7 +359,7 @@ TEST_F(ScreenOrientationControllerTest, WindowDestructionRemovesLock) {
|
| // Tests that accelerometer readings in each of the screen angles will trigger a
|
| // rotation of the internal display.
|
| TEST_F(ScreenOrientationControllerTest, DisplayRotation) {
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
| // Now test rotating in all directions.
|
| TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f));
|
| EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
|
| @@ -375,7 +374,7 @@ TEST_F(ScreenOrientationControllerTest, DisplayRotation) {
|
| // Tests that low angles are ignored by the accelerometer (i.e. when the device
|
| // is almost laying flat).
|
| TEST_F(ScreenOrientationControllerTest, RotationIgnoresLowAngles) {
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
| TriggerLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, -kMeanGravity));
|
| EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
|
| TriggerLidUpdate(gfx::Vector3dF(-2.0f, 0.0f, -kMeanGravity));
|
| @@ -391,7 +390,7 @@ TEST_F(ScreenOrientationControllerTest, RotationIgnoresLowAngles) {
|
| // Tests that the display will stick to the current orientation beyond the
|
| // halfway point, preventing frequent updates back and forth.
|
| TEST_F(ScreenOrientationControllerTest, RotationSticky) {
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
| gfx::Vector3dF gravity(0.0f, -kMeanGravity, 0.0f);
|
| TriggerLidUpdate(gravity);
|
| EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
|
| @@ -423,7 +422,7 @@ TEST_F(ScreenOrientationControllerTest, RotationSticky) {
|
| // Tests that the display will stick to its current orientation when the
|
| // rotation lock has been set.
|
| TEST_F(ScreenOrientationControllerTest, RotationLockPreventsRotation) {
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
| SetUserRotationLocked(true);
|
|
|
| // Turn past the threshold for rotation.
|
| @@ -444,7 +443,7 @@ TEST_F(ScreenOrientationControllerTest, RotationLockPreventsRotation) {
|
| // Tests that the screen rotation notifications are suppressed when
|
| // triggered by the accelerometer.
|
| TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
| Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing(
|
| true);
|
| display::test::DisplayManagerTestApi(display_manager())
|
| @@ -457,7 +456,7 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
|
| EXPECT_FALSE(message_center->HasPopupNotifications());
|
|
|
| // Make sure notifications are still displayed when
|
| - // adjusting the screen rotation directly when in maximize mode
|
| + // adjusting the screen rotation directly when in tablet mode
|
| ASSERT_NE(display::Display::ROTATE_270, GetCurrentInternalDisplayRotation());
|
| SetInternalDisplayRotation(display::Display::ROTATE_270);
|
| SetSystemRotationLocked(false);
|
| @@ -472,7 +471,7 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
|
| EXPECT_FALSE(message_center->HasPopupNotifications());
|
|
|
| // Make sure notifications are blocked when adjusting the screen rotation
|
| - // via the accelerometer while in maximize mode
|
| + // via the accelerometer while in tablet mode
|
| // Rotate the screen 90 degrees
|
| ASSERT_EQ(display::Display::ROTATE_270, GetCurrentInternalDisplayRotation());
|
| TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f));
|
| @@ -481,8 +480,8 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
|
| EXPECT_FALSE(message_center->HasPopupNotifications());
|
|
|
| // Make sure notifications are still displayed when
|
| - // adjusting the screen rotation directly when not in maximize mode
|
| - EnableMaximizeMode(false);
|
| + // adjusting the screen rotation directly when not in tablet mode
|
| + EnableTabletMode(false);
|
| // Reset the screen rotation.
|
| SetInternalDisplayRotation(display::Display::ROTATE_0);
|
| // Clear all notifications
|
| @@ -498,18 +497,18 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
|
| }
|
|
|
| // Tests that if a user has set a display rotation that it is restored upon
|
| -// exiting maximize mode.
|
| +// exiting tablet mode.
|
| TEST_F(ScreenOrientationControllerTest, ResetUserRotationUponExit) {
|
| display::test::DisplayManagerTestApi(display_manager())
|
| .SetFirstDisplayAsInternalDisplay();
|
|
|
| SetInternalDisplayRotation(display::Display::ROTATE_90);
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
|
|
| TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f));
|
| EXPECT_EQ(display::Display::ROTATE_180, GetCurrentInternalDisplayRotation());
|
|
|
| - EnableMaximizeMode(false);
|
| + EnableTabletMode(false);
|
| EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
|
| }
|
|
|
| @@ -517,22 +516,22 @@ TEST_F(ScreenOrientationControllerTest, ResetUserRotationUponExit) {
|
| // becomes locked.
|
| TEST_F(ScreenOrientationControllerTest,
|
| NonAccelerometerRotationChangesLockRotation) {
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
| ASSERT_FALSE(RotationLocked());
|
| SetInternalDisplayRotation(display::Display::ROTATE_270);
|
| EXPECT_TRUE(RotationLocked());
|
| }
|
|
|
| // Tests that if a user changes the display rotation, while rotation is locked,
|
| -// that the updates are recorded. Upon exiting maximize mode the latest user
|
| +// that the updates are recorded. Upon exiting tablet mode the latest user
|
| // rotation should be applied.
|
| TEST_F(ScreenOrientationControllerTest, UpdateUserRotationWhileRotationLocked) {
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
| SetInternalDisplayRotation(display::Display::ROTATE_270);
|
| // User sets rotation to the same rotation that the display was at when
|
| - // maximize mode was activated.
|
| + // tablet mode was activated.
|
| SetInternalDisplayRotation(display::Display::ROTATE_0);
|
| - EnableMaximizeMode(false);
|
| + EnableTabletMode(false);
|
| EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
|
| }
|
|
|
| @@ -541,7 +540,7 @@ TEST_F(ScreenOrientationControllerTest, UpdateUserRotationWhileRotationLocked) {
|
| TEST_F(ScreenOrientationControllerTest, LandscapeOrientationAllowsRotation) {
|
| std::unique_ptr<content::WebContents> content(CreateWebContents());
|
| std::unique_ptr<aura::Window> focus_window(CreateAppWindowInShellWithId(0));
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
|
|
| AttachAndActivateWebContents(content.get(), focus_window.get());
|
| delegate()->Lock(content.get(), blink::kWebScreenOrientationLockLandscape);
|
| @@ -564,7 +563,7 @@ TEST_F(ScreenOrientationControllerTest, LandscapeOrientationAllowsRotation) {
|
| TEST_F(ScreenOrientationControllerTest, PortraitOrientationAllowsRotation) {
|
| std::unique_ptr<content::WebContents> content(CreateWebContents());
|
| std::unique_ptr<aura::Window> focus_window(CreateAppWindowInShellWithId(0));
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
|
|
| AttachAndActivateWebContents(content.get(), focus_window.get());
|
| delegate()->Lock(content.get(), blink::kWebScreenOrientationLockPortrait);
|
| @@ -587,7 +586,7 @@ TEST_F(ScreenOrientationControllerTest, PortraitOrientationAllowsRotation) {
|
| TEST_F(ScreenOrientationControllerTest, OrientationLockDisallowsRotation) {
|
| std::unique_ptr<content::WebContents> content(CreateWebContents());
|
| std::unique_ptr<aura::Window> focus_window(CreateAppWindowInShellWithId(0));
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
|
|
| AttachAndActivateWebContents(content.get(), focus_window.get());
|
| delegate()->Lock(content.get(),
|
| @@ -609,7 +608,7 @@ TEST_F(ScreenOrientationControllerTest, OrientationLockDisallowsRotation) {
|
| TEST_F(ScreenOrientationControllerTest, UserRotationLockDisallowsRotation) {
|
| std::unique_ptr<content::WebContents> content(CreateWebContents());
|
| std::unique_ptr<aura::Window> focus_window(CreateAppWindowInShellWithId(0));
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
|
|
| AttachAndActivateWebContents(content.get(), focus_window.get());
|
| delegate()->Lock(content.get(), blink::kWebScreenOrientationLockLandscape);
|
| @@ -624,7 +623,7 @@ TEST_F(ScreenOrientationControllerTest, UserRotationLockDisallowsRotation) {
|
| EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
|
| }
|
|
|
| -// Tests that when MaximizeMode is triggered before the internal display is
|
| +// Tests that when TabletMode is triggered before the internal display is
|
| // ready, that ScreenOrientationController still begins listening to events,
|
| // which require an internal display to be acted upon.
|
| TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) {
|
| @@ -634,7 +633,7 @@ TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) {
|
| int64_t internal_display_id = display::Display::InternalDisplayId();
|
| display::Display::SetInternalDisplayId(display::kInvalidDisplayId);
|
|
|
| - EnableMaximizeMode(true);
|
| + EnableTabletMode(true);
|
|
|
| // Should not crash, even though there is no internal display.
|
| SetDisplayRotationById(internal_display_id, display::Display::ROTATE_180);
|
|
|