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

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

Issue 2264443002: Do not automatically maximize the window if the maximized bounds can be controlled by the client in… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_window_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/wm/mru_window_tracker.h" 10 #include "ash/common/wm/mru_window_tracker.h"
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 wm::GetWindowState(window.get())->OnWMEvent(&dock_event); 1582 wm::GetWindowState(window.get())->OnWMEvent(&dock_event);
1583 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); 1583 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked());
1584 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); 1584 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
1585 1585
1586 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); 1586 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
1587 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); 1587 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked());
1588 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); 1588 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
1589 EXPECT_EQ(0, manager->GetNumberOfManagedWindows()); 1589 EXPECT_EQ(0, manager->GetNumberOfManagedWindows());
1590 } 1590 }
1591 1591
1592 // Tests that windows that can control maximized bounds are not maximized
1593 // and not tracked.
1594 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeClientManagedWindows) {
1595 gfx::Rect rect(10, 10, 200, 50);
1596 std::unique_ptr<aura::Window> window(
1597 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1598
1599 wm::GetWindowState(window.get())->set_allow_set_bounds_in_maximized(true);
1600
1601 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
1602 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
1603 EXPECT_EQ(0, manager->GetNumberOfManagedWindows());
1604 }
1605
1592 namespace { 1606 namespace {
1593 1607
1594 class TestObserver : public wm::WindowStateObserver { 1608 class TestObserver : public wm::WindowStateObserver {
1595 public: 1609 public:
1596 TestObserver(){}; 1610 TestObserver(){};
1597 ~TestObserver() override{}; 1611 ~TestObserver() override{};
1598 1612
1599 // wm::WindowStateObserver: 1613 // wm::WindowStateObserver:
1600 void OnPreWindowStateTypeChange(wm::WindowState* window_state, 1614 void OnPreWindowStateTypeChange(wm::WindowState* window_state,
1601 wm::WindowStateType old_type) override { 1615 wm::WindowStateType old_type) override {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 EXPECT_EQ(1, observer.GetPostCountAndReset()); 1699 EXPECT_EQ(1, observer.GetPostCountAndReset());
1686 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, 1700 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED,
1687 observer.GetLastOldStateAndReset()); 1701 observer.GetLastOldStateAndReset());
1688 1702
1689 window_state->RemoveObserver(&observer); 1703 window_state->RemoveObserver(&observer);
1690 1704
1691 DestroyMaximizeModeWindowManager(); 1705 DestroyMaximizeModeWindowManager();
1692 } 1706 }
1693 1707
1694 } // namespace ash 1708 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_window_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698