| 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_window_manager.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/switchable_windows.h" | 11 #include "ash/switchable_windows.h" |
| 12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/test/shell_test_api.h" | 13 #include "ash/test/shell_test_api.h" |
| 14 #include "ash/wm/mru_window_tracker.h" | 14 #include "ash/wm/mru_window_tracker.h" |
| 15 #include "ash/wm/overview/window_selector_controller.h" |
| 15 #include "ash/wm/window_state.h" | 16 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm/wm_event.h" | 17 #include "ash/wm/wm_event.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 #include "ui/aura/client/aura_constants.h" | 20 #include "ui/aura/client/aura_constants.h" |
| 20 #include "ui/aura/test/event_generator.h" | 21 #include "ui/aura/test/event_generator.h" |
| 21 #include "ui/aura/test/test_window_delegate.h" | 22 #include "ui/aura/test/test_window_delegate.h" |
| 22 #include "ui/aura/test/test_windows.h" | 23 #include "ui/aura/test/test_windows.h" |
| 23 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 24 #include "ui/base/hit_test.h" | 25 #include "ui/base/hit_test.h" |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 generator.MoveMouseTo(gfx::Point(first_dragged_origin.x() + 1, | 822 generator.MoveMouseTo(gfx::Point(first_dragged_origin.x() + 1, |
| 822 first_dragged_origin.y() + 1)); | 823 first_dragged_origin.y() + 1)); |
| 823 generator.PressLeftButton(); | 824 generator.PressLeftButton(); |
| 824 generator.MoveMouseBy(10, 5); | 825 generator.MoveMouseBy(10, 5); |
| 825 RunAllPendingInMessageLoop(); | 826 RunAllPendingInMessageLoop(); |
| 826 generator.ReleaseLeftButton(); | 827 generator.ReleaseLeftButton(); |
| 827 EXPECT_EQ(first_dragged_origin.x() + 10, window->bounds().x()); | 828 EXPECT_EQ(first_dragged_origin.x() + 10, window->bounds().x()); |
| 828 EXPECT_EQ(first_dragged_origin.y() + 5, window->bounds().y()); | 829 EXPECT_EQ(first_dragged_origin.y() + 5, window->bounds().y()); |
| 829 } | 830 } |
| 830 | 831 |
| 832 // Test that overview is exited before entering / exiting maximize mode so that |
| 833 // the window changes made by MaximizeModeWindowManager do not conflict with |
| 834 // those made in WindowOverview. |
| 835 TEST_F(MaximizeModeWindowManagerTest, ExitsOverview) { |
| 836 // Bounds for windows we know can be controlled. |
| 837 gfx::Rect rect1(10, 10, 200, 50); |
| 838 gfx::Rect rect2(10, 60, 200, 50); |
| 839 scoped_ptr<aura::Window> w1(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect1)); |
| 840 scoped_ptr<aura::Window> w2(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect2)); |
| 841 |
| 842 WindowSelectorController* window_selector_controller = |
| 843 Shell::GetInstance()->window_selector_controller(); |
| 844 window_selector_controller->ToggleOverview(); |
| 845 ASSERT_TRUE(window_selector_controller->IsSelecting()); |
| 846 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); |
| 847 ASSERT_TRUE(manager); |
| 848 EXPECT_FALSE(window_selector_controller->IsSelecting()); |
| 849 |
| 850 window_selector_controller->ToggleOverview(); |
| 851 ASSERT_TRUE(window_selector_controller->IsSelecting()); |
| 852 // Destroy the manager again and check that the windows return to their |
| 853 // previous state. |
| 854 DestroyMaximizeModeWindowManager(); |
| 855 EXPECT_FALSE(window_selector_controller->IsSelecting()); |
| 856 } |
| 857 |
| 831 #endif // OS_WIN | 858 #endif // OS_WIN |
| 832 | 859 |
| 833 } // namespace ash | 860 } // namespace ash |
| OLD | NEW |