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/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 // The always-on-top windows should not change when leaving maximize mode. | 1580 // The always-on-top windows should not change when leaving maximize mode. |
1581 DestroyMaximizeModeWindowManager(); | 1581 DestroyMaximizeModeWindowManager(); |
1582 EXPECT_FALSE(wm::GetWindowState(w1.get())->IsMaximized()); | 1582 EXPECT_FALSE(wm::GetWindowState(w1.get())->IsMaximized()); |
1583 EXPECT_FALSE(wm::GetWindowState(w2.get())->IsMaximized()); | 1583 EXPECT_FALSE(wm::GetWindowState(w2.get())->IsMaximized()); |
1584 EXPECT_EQ(rect1.ToString(), w1->bounds().ToString()); | 1584 EXPECT_EQ(rect1.ToString(), w1->bounds().ToString()); |
1585 EXPECT_EQ(rect2.ToString(), w2->bounds().ToString()); | 1585 EXPECT_EQ(rect2.ToString(), w2->bounds().ToString()); |
1586 EXPECT_TRUE(wm::GetWindowState(w1.get())->can_be_dragged()); | 1586 EXPECT_TRUE(wm::GetWindowState(w1.get())->can_be_dragged()); |
1587 EXPECT_TRUE(wm::GetWindowState(w2.get())->can_be_dragged()); | 1587 EXPECT_TRUE(wm::GetWindowState(w2.get())->can_be_dragged()); |
1588 } | 1588 } |
1589 | 1589 |
1590 // Tests that docked windows are not maximized, and not tracked. | |
1591 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeDockedWindows) { | |
1592 // Enable window docking for this test. | |
1593 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
1594 ash::switches::kAshEnableDockedWindows); | |
1595 | |
1596 gfx::Rect rect(10, 10, 200, 50); | |
1597 std::unique_ptr<aura::Window> window( | |
1598 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | |
1599 | |
1600 wm::WMEvent dock_event(wm::WM_EVENT_DOCK); | |
1601 wm::GetWindowState(window.get())->OnWMEvent(&dock_event); | |
1602 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); | |
1603 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); | |
1604 | |
1605 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); | |
1606 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); | |
1607 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); | |
1608 EXPECT_EQ(0, manager->GetNumberOfManagedWindows()); | |
1609 } | |
1610 | |
1611 // Tests that windows that can control maximized bounds are not maximized | 1590 // Tests that windows that can control maximized bounds are not maximized |
1612 // and not tracked. | 1591 // and not tracked. |
1613 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeClientManagedWindows) { | 1592 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeClientManagedWindows) { |
1614 gfx::Rect rect(10, 10, 200, 50); | 1593 gfx::Rect rect(10, 10, 200, 50); |
1615 std::unique_ptr<aura::Window> window( | 1594 std::unique_ptr<aura::Window> window( |
1616 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1595 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
1617 | 1596 |
1618 wm::GetWindowState(window.get())->set_allow_set_bounds_in_maximized(true); | 1597 wm::GetWindowState(window.get())->set_allow_set_bounds_in_maximized(true); |
1619 | 1598 |
1620 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); | 1599 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 EXPECT_EQ(1, observer.GetPostCountAndReset()); | 1697 EXPECT_EQ(1, observer.GetPostCountAndReset()); |
1719 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, | 1698 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, |
1720 observer.GetLastOldStateAndReset()); | 1699 observer.GetLastOldStateAndReset()); |
1721 | 1700 |
1722 window_state->RemoveObserver(&observer); | 1701 window_state->RemoveObserver(&observer); |
1723 | 1702 |
1724 DestroyMaximizeModeWindowManager(); | 1703 DestroyMaximizeModeWindowManager(); |
1725 } | 1704 } |
1726 | 1705 |
1727 } // namespace ash | 1706 } // namespace ash |
OLD | NEW |