| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 12 #include "ash/display/screen_orientation_controller_chromeos.h" | 12 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
| 15 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 16 #include "ash/test/display_configuration_controller_test_api.h" |
| 16 #include "ash/test/test_system_tray_delegate.h" | 17 #include "ash/test/test_system_tray_delegate.h" |
| 17 #include "ash/wm/overview/window_selector_controller.h" | 18 #include "ash/wm/overview/window_selector_controller.h" |
| 18 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 19 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
| 20 #include "base/test/simple_test_tick_clock.h" | 21 #include "base/test/simple_test_tick_clock.h" |
| 21 #include "base/test/user_action_tester.h" | 22 #include "base/test/user_action_tester.h" |
| 22 #include "chromeos/accelerometer/accelerometer_reader.h" | 23 #include "chromeos/accelerometer/accelerometer_reader.h" |
| 23 #include "chromeos/accelerometer/accelerometer_types.h" | 24 #include "chromeos/accelerometer/accelerometer_types.h" |
| 24 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
| 25 #include "chromeos/dbus/fake_power_manager_client.h" | 26 #include "chromeos/dbus/fake_power_manager_client.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 SetTabletMode(false); | 646 SetTabletMode(false); |
| 646 EXPECT_TRUE(IsMaximizeModeStarted()); | 647 EXPECT_TRUE(IsMaximizeModeStarted()); |
| 647 EXPECT_TRUE(AreEventsBlocked()); | 648 EXPECT_TRUE(AreEventsBlocked()); |
| 648 } | 649 } |
| 649 | 650 |
| 650 TEST_F(MaximizeModeControllerTest, RestoreAfterExit) { | 651 TEST_F(MaximizeModeControllerTest, RestoreAfterExit) { |
| 651 UpdateDisplay("1000x600"); | 652 UpdateDisplay("1000x600"); |
| 652 std::unique_ptr<aura::Window> w1( | 653 std::unique_ptr<aura::Window> w1( |
| 653 CreateTestWindowInShellWithBounds(gfx::Rect(10, 10, 900, 300))); | 654 CreateTestWindowInShellWithBounds(gfx::Rect(10, 10, 900, 300))); |
| 654 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 655 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
| 656 display::Screen* screen = display::Screen::GetScreen(); |
| 657 test::DisplayConfigurationControllerTestApi display_config_controller_testapi( |
| 658 Shell::Get()->display_configuration_controller()); |
| 659 display_config_controller_testapi.SetEnableScreenRotationAnimator( |
| 660 screen->GetPrimaryDisplay().id(), false); |
| 655 Shell::Get()->screen_orientation_controller()->SetLockToRotation( | 661 Shell::Get()->screen_orientation_controller()->SetLockToRotation( |
| 656 display::Display::ROTATE_90); | 662 display::Display::ROTATE_90); |
| 657 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 663 display::Display display = screen->GetPrimaryDisplay(); |
| 658 EXPECT_EQ(display::Display::ROTATE_90, display.rotation()); | 664 EXPECT_EQ(display::Display::ROTATE_90, display.rotation()); |
| 659 EXPECT_LT(display.size().width(), display.size().height()); | 665 EXPECT_LT(display.size().width(), display.size().height()); |
| 660 maximize_mode_controller()->EnableMaximizeModeWindowManager(false); | 666 maximize_mode_controller()->EnableMaximizeModeWindowManager(false); |
| 661 display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 667 display = screen->GetPrimaryDisplay(); |
| 662 // Sanity checks. | 668 // Sanity checks. |
| 663 EXPECT_EQ(display::Display::ROTATE_0, display.rotation()); | 669 EXPECT_EQ(display::Display::ROTATE_0, display.rotation()); |
| 664 EXPECT_GT(display.size().width(), display.size().height()); | 670 EXPECT_GT(display.size().width(), display.size().height()); |
| 665 | 671 |
| 666 // The bounds should be restored to the original bounds, and | 672 // The bounds should be restored to the original bounds, and |
| 667 // should not be clamped by the portrait display in touch view. | 673 // should not be clamped by the portrait display in touch view. |
| 668 EXPECT_EQ(gfx::Rect(10, 10, 900, 300), w1->bounds()); | 674 EXPECT_EQ(gfx::Rect(10, 10, 900, 300), w1->bounds()); |
| 675 display_config_controller_testapi.SetEnableScreenRotationAnimator( |
| 676 screen->GetPrimaryDisplay().id(), true); |
| 669 } | 677 } |
| 670 | 678 |
| 671 } // namespace ash | 679 } // namespace ash |
| OLD | NEW |