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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Yet another Rebase ... Created 3 years, 10 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/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 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 // The always-on-top windows should not change when leaving maximize mode. 1564 // The always-on-top windows should not change when leaving maximize mode.
1565 DestroyMaximizeModeWindowManager(); 1565 DestroyMaximizeModeWindowManager();
1566 EXPECT_FALSE(wm::GetWindowState(w1.get())->IsMaximized()); 1566 EXPECT_FALSE(wm::GetWindowState(w1.get())->IsMaximized());
1567 EXPECT_FALSE(wm::GetWindowState(w2.get())->IsMaximized()); 1567 EXPECT_FALSE(wm::GetWindowState(w2.get())->IsMaximized());
1568 EXPECT_EQ(rect1.ToString(), w1->bounds().ToString()); 1568 EXPECT_EQ(rect1.ToString(), w1->bounds().ToString());
1569 EXPECT_EQ(rect2.ToString(), w2->bounds().ToString()); 1569 EXPECT_EQ(rect2.ToString(), w2->bounds().ToString());
1570 EXPECT_TRUE(wm::GetWindowState(w1.get())->can_be_dragged()); 1570 EXPECT_TRUE(wm::GetWindowState(w1.get())->can_be_dragged());
1571 EXPECT_TRUE(wm::GetWindowState(w2.get())->can_be_dragged()); 1571 EXPECT_TRUE(wm::GetWindowState(w2.get())->can_be_dragged());
1572 } 1572 }
1573 1573
1574 // Tests that docked windows are not maximized, and not tracked.
1575 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeDockedWindows) {
1576 // Enable window docking for this test.
1577 base::CommandLine::ForCurrentProcess()->AppendSwitch(
1578 ash::switches::kAshEnableDockedWindows);
1579
1580 gfx::Rect rect(10, 10, 200, 50);
1581 std::unique_ptr<aura::Window> window(
1582 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1583
1584 wm::WMEvent dock_event(wm::WM_EVENT_DOCK);
1585 wm::GetWindowState(window.get())->OnWMEvent(&dock_event);
1586 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked());
1587 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
1588
1589 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
1590 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked());
1591 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
1592 EXPECT_EQ(0, manager->GetNumberOfManagedWindows());
1593 }
1594
1595 // Tests that windows that can control maximized bounds are not maximized 1574 // Tests that windows that can control maximized bounds are not maximized
1596 // and not tracked. 1575 // and not tracked.
1597 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeClientManagedWindows) { 1576 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeClientManagedWindows) {
1598 gfx::Rect rect(10, 10, 200, 50); 1577 gfx::Rect rect(10, 10, 200, 50);
1599 std::unique_ptr<aura::Window> window( 1578 std::unique_ptr<aura::Window> window(
1600 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1579 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1601 1580
1602 wm::GetWindowState(window.get())->set_allow_set_bounds_in_maximized(true); 1581 wm::GetWindowState(window.get())->set_allow_set_bounds_in_maximized(true);
1603 1582
1604 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); 1583 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 EXPECT_EQ(1, observer.GetPostCountAndReset()); 1681 EXPECT_EQ(1, observer.GetPostCountAndReset());
1703 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, 1682 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED,
1704 observer.GetLastOldStateAndReset()); 1683 observer.GetLastOldStateAndReset());
1705 1684
1706 window_state->RemoveObserver(&observer); 1685 window_state->RemoveObserver(&observer);
1707 1686
1708 DestroyMaximizeModeWindowManager(); 1687 DestroyMaximizeModeWindowManager();
1709 } 1688 }
1710 1689
1711 } // namespace ash 1690 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698