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/wm/maximize_mode/maximize_mode_window_manager.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/public/cpp/config.h" | 10 #include "ash/public/cpp/config.h" |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 763 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
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 = WmWindow::ToAuraWindows( | 773 aura::Window::Windows windows = |
774 Shell::Get()->mru_window_tracker()->BuildMruWindowList()); | 774 Shell::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 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); | 784 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 = WmWindow::ToAuraWindows( | 788 aura::Window::Windows windows = |
789 Shell::Get()->mru_window_tracker()->BuildMruWindowList()); | 789 Shell::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 = WmWindow::ToAuraWindows( | 801 aura::Window::Windows windows = |
802 Shell::Get()->mru_window_tracker()->BuildMruWindowList()); | 802 Shell::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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 EXPECT_EQ(1, observer.GetPostCountAndReset()); | 1697 EXPECT_EQ(1, observer.GetPostCountAndReset()); |
1698 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, | 1698 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, |
1699 observer.GetLastOldStateAndReset()); | 1699 observer.GetLastOldStateAndReset()); |
1700 | 1700 |
1701 window_state->RemoveObserver(&observer); | 1701 window_state->RemoveObserver(&observer); |
1702 | 1702 |
1703 DestroyMaximizeModeWindowManager(); | 1703 DestroyMaximizeModeWindowManager(); |
1704 } | 1704 } |
1705 | 1705 |
1706 } // namespace ash | 1706 } // namespace ash |
OLD | NEW |