| 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/common/wm/maximize_mode/maximize_mode_controller.h" | 5 #include "ash/common/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/common/ash_switches.h" | 11 #include "ash/common/ash_switches.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/test/test_system_tray_delegate.h" | 13 #include "ash/common/test/test_system_tray_delegate.h" |
| 14 #include "ash/common/wm/overview/window_selector_controller.h" | 14 #include "ash/common/wm/overview/window_selector_controller.h" |
| 15 #include "ash/common/wm_shell.h" | |
| 16 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 17 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
| 18 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 19 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 20 #include "base/test/simple_test_tick_clock.h" | 19 #include "base/test/simple_test_tick_clock.h" |
| 21 #include "base/test/user_action_tester.h" | 20 #include "base/test/user_action_tester.h" |
| 22 #include "chromeos/accelerometer/accelerometer_reader.h" | 21 #include "chromeos/accelerometer/accelerometer_reader.h" |
| 23 #include "chromeos/accelerometer/accelerometer_types.h" | 22 #include "chromeos/accelerometer/accelerometer_types.h" |
| 24 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
| 25 #include "chromeos/dbus/fake_power_manager_client.h" | 24 #include "chromeos/dbus/fake_power_manager_client.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // Test if this case does not crash. See http://crbug.com/462806 | 475 // Test if this case does not crash. See http://crbug.com/462806 |
| 477 TEST_F(MaximizeModeControllerTest, DisplayDisconnectionDuringOverview) { | 476 TEST_F(MaximizeModeControllerTest, DisplayDisconnectionDuringOverview) { |
| 478 UpdateDisplay("800x600,800x600"); | 477 UpdateDisplay("800x600,800x600"); |
| 479 std::unique_ptr<aura::Window> w1( | 478 std::unique_ptr<aura::Window> w1( |
| 480 CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 100, 100))); | 479 CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 100, 100))); |
| 481 std::unique_ptr<aura::Window> w2( | 480 std::unique_ptr<aura::Window> w2( |
| 482 CreateTestWindowInShellWithBounds(gfx::Rect(800, 0, 100, 100))); | 481 CreateTestWindowInShellWithBounds(gfx::Rect(800, 0, 100, 100))); |
| 483 ASSERT_NE(w1->GetRootWindow(), w2->GetRootWindow()); | 482 ASSERT_NE(w1->GetRootWindow(), w2->GetRootWindow()); |
| 484 | 483 |
| 485 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 484 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
| 486 EXPECT_TRUE(WmShell::Get()->window_selector_controller()->ToggleOverview()); | 485 EXPECT_TRUE(Shell::Get()->window_selector_controller()->ToggleOverview()); |
| 487 | 486 |
| 488 UpdateDisplay("800x600"); | 487 UpdateDisplay("800x600"); |
| 489 EXPECT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); | 488 EXPECT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); |
| 490 EXPECT_EQ(w1->GetRootWindow(), w2->GetRootWindow()); | 489 EXPECT_EQ(w1->GetRootWindow(), w2->GetRootWindow()); |
| 491 } | 490 } |
| 492 | 491 |
| 493 // Test that the disabling of the internal display exits maximize mode, and that | 492 // Test that the disabling of the internal display exits maximize mode, and that |
| 494 // while disabled we do not re-enter maximize mode. | 493 // while disabled we do not re-enter maximize mode. |
| 495 TEST_F(MaximizeModeControllerTest, NoMaximizeModeWithDisabledInternalDisplay) { | 494 TEST_F(MaximizeModeControllerTest, NoMaximizeModeWithDisabledInternalDisplay) { |
| 496 UpdateDisplay("200x200, 200x200"); | 495 UpdateDisplay("200x200, 200x200"); |
| 497 const int64_t internal_display_id = | 496 const int64_t internal_display_id = |
| 498 display::test::DisplayManagerTestApi(display_manager()) | 497 display::test::DisplayManagerTestApi(display_manager()) |
| 499 .SetFirstDisplayAsInternalDisplay(); | 498 .SetFirstDisplayAsInternalDisplay(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 power_manager_client->set_tablet_mode( | 596 power_manager_client->set_tablet_mode( |
| 598 chromeos::PowerManagerClient::TabletMode::ON); | 597 chromeos::PowerManagerClient::TabletMode::ON); |
| 599 MaximizeModeController controller; | 598 MaximizeModeController controller; |
| 600 EXPECT_FALSE(controller.IsMaximizeModeWindowManagerEnabled()); | 599 EXPECT_FALSE(controller.IsMaximizeModeWindowManagerEnabled()); |
| 601 // PowerManagerClient callback is a posted task. | 600 // PowerManagerClient callback is a posted task. |
| 602 base::RunLoop().RunUntilIdle(); | 601 base::RunLoop().RunUntilIdle(); |
| 603 EXPECT_TRUE(controller.IsMaximizeModeWindowManagerEnabled()); | 602 EXPECT_TRUE(controller.IsMaximizeModeWindowManagerEnabled()); |
| 604 } | 603 } |
| 605 | 604 |
| 606 } // namespace ash | 605 } // namespace ash |
| OLD | NEW |