| 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_window_manager.h" | 5 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 12 #include "ash/common/wm/mru_window_tracker.h" | 13 #include "ash/common/wm/mru_window_tracker.h" |
| 13 #include "ash/common/wm/overview/window_selector_controller.h" | 14 #include "ash/common/wm/overview/window_selector_controller.h" |
| 14 #include "ash/common/wm/switchable_windows.h" | 15 #include "ash/common/wm/switchable_windows.h" |
| 15 #include "ash/common/wm/window_state.h" | 16 #include "ash/common/wm/window_state.h" |
| 16 #include "ash/common/wm/window_state_observer.h" | 17 #include "ash/common/wm/window_state_observer.h" |
| 17 #include "ash/common/wm/wm_event.h" | 18 #include "ash/common/wm/wm_event.h" |
| 18 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
| 19 #include "ash/root_window_controller.h" | 20 #include "ash/root_window_controller.h" |
| 20 #include "ash/screen_util.h" | 21 #include "ash/screen_util.h" |
| 21 #include "ash/shell.h" | 22 #include "ash/shell.h" |
| 22 #include "ash/test/ash_test_base.h" | 23 #include "ash/test/ash_test_base.h" |
| 23 #include "ash/test/shell_test_api.h" | 24 #include "ash/test/shell_test_api.h" |
| 24 #include "ash/wm/window_properties.h" | 25 #include "ash/wm/window_properties.h" |
| 25 #include "ash/wm/window_state_aura.h" | 26 #include "ash/wm/window_state_aura.h" |
| 26 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
| 28 #include "base/command_line.h" |
| 27 #include "base/strings/stringprintf.h" | 29 #include "base/strings/stringprintf.h" |
| 28 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
| 29 #include "base/values.h" | 31 #include "base/values.h" |
| 30 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 32 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 31 #include "ui/aura/client/aura_constants.h" | 33 #include "ui/aura/client/aura_constants.h" |
| 32 #include "ui/aura/test/test_window_delegate.h" | 34 #include "ui/aura/test/test_window_delegate.h" |
| 33 #include "ui/aura/test/test_windows.h" | 35 #include "ui/aura/test/test_windows.h" |
| 34 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
| 35 #include "ui/base/hit_test.h" | 37 #include "ui/base/hit_test.h" |
| 36 #include "ui/events/test/event_generator.h" | 38 #include "ui/events/test/event_generator.h" |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 EXPECT_FALSE(wm::GetWindowState(w1.get())->IsMaximized()); | 1566 EXPECT_FALSE(wm::GetWindowState(w1.get())->IsMaximized()); |
| 1565 EXPECT_FALSE(wm::GetWindowState(w2.get())->IsMaximized()); | 1567 EXPECT_FALSE(wm::GetWindowState(w2.get())->IsMaximized()); |
| 1566 EXPECT_EQ(rect1.ToString(), w1->bounds().ToString()); | 1568 EXPECT_EQ(rect1.ToString(), w1->bounds().ToString()); |
| 1567 EXPECT_EQ(rect2.ToString(), w2->bounds().ToString()); | 1569 EXPECT_EQ(rect2.ToString(), w2->bounds().ToString()); |
| 1568 EXPECT_TRUE(wm::GetWindowState(w1.get())->can_be_dragged()); | 1570 EXPECT_TRUE(wm::GetWindowState(w1.get())->can_be_dragged()); |
| 1569 EXPECT_TRUE(wm::GetWindowState(w2.get())->can_be_dragged()); | 1571 EXPECT_TRUE(wm::GetWindowState(w2.get())->can_be_dragged()); |
| 1570 } | 1572 } |
| 1571 | 1573 |
| 1572 // Tests that docked windows are not maximized, and not tracked. | 1574 // Tests that docked windows are not maximized, and not tracked. |
| 1573 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeDockedWindows) { | 1575 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeDockedWindows) { |
| 1576 // Enable window docking for this test. |
| 1577 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1578 ash::switches::kAshEnableDockedWindows); |
| 1579 |
| 1574 gfx::Rect rect(10, 10, 200, 50); | 1580 gfx::Rect rect(10, 10, 200, 50); |
| 1575 std::unique_ptr<aura::Window> window( | 1581 std::unique_ptr<aura::Window> window( |
| 1576 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1582 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1577 | 1583 |
| 1578 wm::WMEvent dock_event(wm::WM_EVENT_DOCK); | 1584 wm::WMEvent dock_event(wm::WM_EVENT_DOCK); |
| 1579 wm::GetWindowState(window.get())->OnWMEvent(&dock_event); | 1585 wm::GetWindowState(window.get())->OnWMEvent(&dock_event); |
| 1580 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); | 1586 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); |
| 1581 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); | 1587 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); |
| 1582 | 1588 |
| 1583 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); | 1589 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 EXPECT_EQ(1, observer.GetPostCountAndReset()); | 1702 EXPECT_EQ(1, observer.GetPostCountAndReset()); |
| 1697 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, | 1703 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, |
| 1698 observer.GetLastOldStateAndReset()); | 1704 observer.GetLastOldStateAndReset()); |
| 1699 | 1705 |
| 1700 window_state->RemoveObserver(&observer); | 1706 window_state->RemoveObserver(&observer); |
| 1701 | 1707 |
| 1702 DestroyMaximizeModeWindowManager(); | 1708 DestroyMaximizeModeWindowManager(); |
| 1703 } | 1709 } |
| 1704 | 1710 |
| 1705 } // namespace ash | 1711 } // namespace ash |
| OLD | NEW |