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

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

Issue 2249953002: Do not automatically maximize the window if the maximized bounds can be controlled by the client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/maximize_mode/maximize_mode_controller.h" 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 wm::GetWindowState(window.get())->OnWMEvent(&dock_event); 1576 wm::GetWindowState(window.get())->OnWMEvent(&dock_event);
1577 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); 1577 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked());
1578 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); 1578 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
1579 1579
1580 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); 1580 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
1581 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); 1581 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked());
1582 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); 1582 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
1583 EXPECT_EQ(0, manager->GetNumberOfManagedWindows()); 1583 EXPECT_EQ(0, manager->GetNumberOfManagedWindows());
1584 } 1584 }
1585 1585
1586 // Tests that windows that can control maximized bounds are not maximized
1587 // and not tracked.
1588 TEST_F(MaximizeModeWindowManagerTest, DontMaximizeClientManagedWindows) {
1589 gfx::Rect rect(10, 10, 200, 50);
1590 std::unique_ptr<aura::Window> window(
1591 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1592
1593 wm::GetWindowState(window.get())->set_allow_set_bounds_in_maximized(true);
1594
1595 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
1596 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
1597 EXPECT_EQ(0, manager->GetNumberOfManagedWindows());
1598 }
1599
1586 namespace { 1600 namespace {
1587 1601
1588 class TestObserver : public wm::WindowStateObserver { 1602 class TestObserver : public wm::WindowStateObserver {
1589 public: 1603 public:
1590 TestObserver(){}; 1604 TestObserver(){};
1591 ~TestObserver() override{}; 1605 ~TestObserver() override{};
1592 1606
1593 // wm::WindowStateObserver: 1607 // wm::WindowStateObserver:
1594 void OnPreWindowStateTypeChange(wm::WindowState* window_state, 1608 void OnPreWindowStateTypeChange(wm::WindowState* window_state,
1595 wm::WindowStateType old_type) override { 1609 wm::WindowStateType old_type) override {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 EXPECT_EQ(1, observer.GetPostCountAndReset()); 1693 EXPECT_EQ(1, observer.GetPostCountAndReset());
1680 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, 1694 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED,
1681 observer.GetLastOldStateAndReset()); 1695 observer.GetLastOldStateAndReset());
1682 1696
1683 window_state->RemoveObserver(&observer); 1697 window_state->RemoveObserver(&observer);
1684 1698
1685 DestroyMaximizeModeWindowManager(); 1699 DestroyMaximizeModeWindowManager();
1686 } 1700 }
1687 1701
1688 } // namespace ash 1702 } // 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