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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc

Issue 2811153002: Restore bounds after the screen is restored in clamshell (Closed)
Patch Set: Restore bounds after completely transitioned to clamshell. Created 3 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 unified diff | Download patch
OLDNEW
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/shell.h" 13 #include "ash/shell.h"
13 #include "ash/system/tray/system_tray_delegate.h" 14 #include "ash/system/tray/system_tray_delegate.h"
14 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
15 #include "ash/test/test_system_tray_delegate.h" 16 #include "ash/test/test_system_tray_delegate.h"
16 #include "ash/wm/overview/window_selector_controller.h" 17 #include "ash/wm/overview/window_selector_controller.h"
17 #include "base/command_line.h" 18 #include "base/command_line.h"
18 #include "base/run_loop.h" 19 #include "base/run_loop.h"
19 #include "base/test/simple_test_tick_clock.h" 20 #include "base/test/simple_test_tick_clock.h"
20 #include "base/test/user_action_tester.h" 21 #include "base/test/user_action_tester.h"
21 #include "chromeos/accelerometer/accelerometer_reader.h" 22 #include "chromeos/accelerometer/accelerometer_reader.h"
22 #include "chromeos/accelerometer/accelerometer_types.h" 23 #include "chromeos/accelerometer/accelerometer_types.h"
23 #include "chromeos/dbus/dbus_thread_manager.h" 24 #include "chromeos/dbus/dbus_thread_manager.h"
24 #include "chromeos/dbus/fake_power_manager_client.h" 25 #include "chromeos/dbus/fake_power_manager_client.h"
25 #include "ui/display/manager/display_manager.h" 26 #include "ui/display/manager/display_manager.h"
27 #include "ui/display/screen.h"
26 #include "ui/display/test/display_manager_test_api.h" 28 #include "ui/display/test/display_manager_test_api.h"
27 #include "ui/events/event_handler.h" 29 #include "ui/events/event_handler.h"
28 #include "ui/events/test/event_generator.h" 30 #include "ui/events/test/event_generator.h"
29 #include "ui/gfx/geometry/vector3d_f.h" 31 #include "ui/gfx/geometry/vector3d_f.h"
30 #include "ui/message_center/message_center.h" 32 #include "ui/message_center/message_center.h"
31 33
32 #if defined(USE_X11) 34 #if defined(USE_X11)
33 #include "ui/events/test/events_test_utils_x11.h" 35 #include "ui/events/test/events_test_utils_x11.h"
34 #endif 36 #endif
35 37
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 640
639 OpenLidToAngle(30.0f); 641 OpenLidToAngle(30.0f);
640 EXPECT_TRUE(IsMaximizeModeStarted()); 642 EXPECT_TRUE(IsMaximizeModeStarted());
641 EXPECT_TRUE(AreEventsBlocked()); 643 EXPECT_TRUE(AreEventsBlocked());
642 644
643 SetTabletMode(false); 645 SetTabletMode(false);
644 EXPECT_TRUE(IsMaximizeModeStarted()); 646 EXPECT_TRUE(IsMaximizeModeStarted());
645 EXPECT_TRUE(AreEventsBlocked()); 647 EXPECT_TRUE(AreEventsBlocked());
646 } 648 }
647 649
650 TEST_F(MaximizeModeControllerTest, RestoreAfterExit) {
651 UpdateDisplay("1000x600");
652 std::unique_ptr<aura::Window> w1(
653 CreateTestWindowInShellWithBounds(gfx::Rect(10, 10, 900, 300)));
654 maximize_mode_controller()->EnableMaximizeModeWindowManager(true);
655 Shell::Get()->screen_orientation_controller()->SetLockToRotation(
656 display::Display::ROTATE_90);
657 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
658 EXPECT_EQ(display::Display::ROTATE_90, display.rotation());
659 EXPECT_LT(display.size().width(), display.size().height());
660 maximize_mode_controller()->EnableMaximizeModeWindowManager(false);
661 display = display::Screen::GetScreen()->GetPrimaryDisplay();
662 // Sanity checks.
663 EXPECT_EQ(display::Display::ROTATE_0, display.rotation());
664 EXPECT_GT(display.size().width(), display.size().height());
665
666 // The bounds should be restored to the original bounds, and
667 // should not be clamped by the portrait display in touch view.
668 EXPECT_EQ(gfx::Rect(10, 10, 900, 300), w1->bounds());
669 }
670
648 } // namespace ash 671 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.cc ('k') | ash/wm/maximize_mode/maximize_mode_window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698