| 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/wm/mru_window_tracker.h" | 10 #include "ash/common/wm/mru_window_tracker.h" |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 std::unique_ptr<aura::Window> w3( | 764 std::unique_ptr<aura::Window> w3( |
| 765 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 765 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 766 std::unique_ptr<aura::Window> w4( | 766 std::unique_ptr<aura::Window> w4( |
| 767 CreateFixedSizeNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 767 CreateFixedSizeNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 768 std::unique_ptr<aura::Window> w5( | 768 std::unique_ptr<aura::Window> w5( |
| 769 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 769 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 770 | 770 |
| 771 // The windows should be in the reverse order of creation in the MRU list. | 771 // The windows should be in the reverse order of creation in the MRU list. |
| 772 { | 772 { |
| 773 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( | 773 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( |
| 774 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); | 774 WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); |
| 775 | 775 |
| 776 EXPECT_EQ(w1.get(), windows[4]); | 776 EXPECT_EQ(w1.get(), windows[4]); |
| 777 EXPECT_EQ(w2.get(), windows[3]); | 777 EXPECT_EQ(w2.get(), windows[3]); |
| 778 EXPECT_EQ(w3.get(), windows[2]); | 778 EXPECT_EQ(w3.get(), windows[2]); |
| 779 EXPECT_EQ(w4.get(), windows[1]); | 779 EXPECT_EQ(w4.get(), windows[1]); |
| 780 EXPECT_EQ(w5.get(), windows[0]); | 780 EXPECT_EQ(w5.get(), windows[0]); |
| 781 } | 781 } |
| 782 | 782 |
| 783 // Activating the window manager should keep the order. | 783 // Activating the window manager should keep the order. |
| 784 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); | 784 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); |
| 785 ASSERT_TRUE(manager); | 785 ASSERT_TRUE(manager); |
| 786 EXPECT_EQ(5, manager->GetNumberOfManagedWindows()); | 786 EXPECT_EQ(5, manager->GetNumberOfManagedWindows()); |
| 787 { | 787 { |
| 788 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( | 788 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( |
| 789 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); | 789 WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); |
| 790 // We do not test maximization here again since that was done already. | 790 // We do not test maximization here again since that was done already. |
| 791 EXPECT_EQ(w1.get(), windows[4]); | 791 EXPECT_EQ(w1.get(), windows[4]); |
| 792 EXPECT_EQ(w2.get(), windows[3]); | 792 EXPECT_EQ(w2.get(), windows[3]); |
| 793 EXPECT_EQ(w3.get(), windows[2]); | 793 EXPECT_EQ(w3.get(), windows[2]); |
| 794 EXPECT_EQ(w4.get(), windows[1]); | 794 EXPECT_EQ(w4.get(), windows[1]); |
| 795 EXPECT_EQ(w5.get(), windows[0]); | 795 EXPECT_EQ(w5.get(), windows[0]); |
| 796 } | 796 } |
| 797 | 797 |
| 798 // Destroying should still keep the order. | 798 // Destroying should still keep the order. |
| 799 DestroyMaximizeModeWindowManager(); | 799 DestroyMaximizeModeWindowManager(); |
| 800 { | 800 { |
| 801 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( | 801 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( |
| 802 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); | 802 WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); |
| 803 // We do not test maximization here again since that was done already. | 803 // We do not test maximization here again since that was done already. |
| 804 EXPECT_EQ(w1.get(), windows[4]); | 804 EXPECT_EQ(w1.get(), windows[4]); |
| 805 EXPECT_EQ(w2.get(), windows[3]); | 805 EXPECT_EQ(w2.get(), windows[3]); |
| 806 EXPECT_EQ(w3.get(), windows[2]); | 806 EXPECT_EQ(w3.get(), windows[2]); |
| 807 EXPECT_EQ(w4.get(), windows[1]); | 807 EXPECT_EQ(w4.get(), windows[1]); |
| 808 EXPECT_EQ(w5.get(), windows[0]); | 808 EXPECT_EQ(w5.get(), windows[0]); |
| 809 } | 809 } |
| 810 } | 810 } |
| 811 | 811 |
| 812 // Check that a restore state change does always restore to maximized. | 812 // Check that a restore state change does always restore to maximized. |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 | 1588 |
| 1589 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); | 1589 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); |
| 1590 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); | 1590 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); |
| 1591 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); | 1591 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); |
| 1592 EXPECT_EQ(0, manager->GetNumberOfManagedWindows()); | 1592 EXPECT_EQ(0, manager->GetNumberOfManagedWindows()); |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 #endif // OS_WIN | 1595 #endif // OS_WIN |
| 1596 | 1596 |
| 1597 } // namespace ash | 1597 } // namespace ash |
| OLD | NEW |