| 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/aura/wm_window_aura.h" |
| 9 #include "ash/common/wm/switchable_windows.h" | 10 #include "ash/common/wm/switchable_windows.h" |
| 10 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 11 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
| 12 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
| 13 #include "ash/screen_util.h" | 14 #include "ash/screen_util.h" |
| 14 #include "ash/shelf/shelf.h" | 15 #include "ash/shelf/shelf.h" |
| 15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 16 #include "ash/test/ash_test_base.h" | 17 #include "ash/test/ash_test_base.h" |
| 17 #include "ash/test/shell_test_api.h" | 18 #include "ash/test/shell_test_api.h" |
| 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 19 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 764 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 764 std::unique_ptr<aura::Window> w3( | 765 std::unique_ptr<aura::Window> w3( |
| 765 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 766 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 766 std::unique_ptr<aura::Window> w4( | 767 std::unique_ptr<aura::Window> w4( |
| 767 CreateFixedSizeNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 768 CreateFixedSizeNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 768 std::unique_ptr<aura::Window> w5( | 769 std::unique_ptr<aura::Window> w5( |
| 769 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 770 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 770 | 771 |
| 771 // The windows should be in the reverse order of creation in the MRU list. | 772 // The windows should be in the reverse order of creation in the MRU list. |
| 772 { | 773 { |
| 773 MruWindowTracker::WindowList windows = ash::Shell::GetInstance()-> | 774 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( |
| 774 mru_window_tracker()->BuildMruWindowList(); | 775 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); |
| 776 |
| 775 EXPECT_EQ(w1.get(), windows[4]); | 777 EXPECT_EQ(w1.get(), windows[4]); |
| 776 EXPECT_EQ(w2.get(), windows[3]); | 778 EXPECT_EQ(w2.get(), windows[3]); |
| 777 EXPECT_EQ(w3.get(), windows[2]); | 779 EXPECT_EQ(w3.get(), windows[2]); |
| 778 EXPECT_EQ(w4.get(), windows[1]); | 780 EXPECT_EQ(w4.get(), windows[1]); |
| 779 EXPECT_EQ(w5.get(), windows[0]); | 781 EXPECT_EQ(w5.get(), windows[0]); |
| 780 } | 782 } |
| 781 | 783 |
| 782 // Activating the window manager should keep the order. | 784 // Activating the window manager should keep the order. |
| 783 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); | 785 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); |
| 784 ASSERT_TRUE(manager); | 786 ASSERT_TRUE(manager); |
| 785 EXPECT_EQ(5, manager->GetNumberOfManagedWindows()); | 787 EXPECT_EQ(5, manager->GetNumberOfManagedWindows()); |
| 786 { | 788 { |
| 787 MruWindowTracker::WindowList windows = ash::Shell::GetInstance()-> | 789 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( |
| 788 mru_window_tracker()->BuildMruWindowList(); | 790 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); |
| 789 // We do not test maximization here again since that was done already. | 791 // We do not test maximization here again since that was done already. |
| 790 EXPECT_EQ(w1.get(), windows[4]); | 792 EXPECT_EQ(w1.get(), windows[4]); |
| 791 EXPECT_EQ(w2.get(), windows[3]); | 793 EXPECT_EQ(w2.get(), windows[3]); |
| 792 EXPECT_EQ(w3.get(), windows[2]); | 794 EXPECT_EQ(w3.get(), windows[2]); |
| 793 EXPECT_EQ(w4.get(), windows[1]); | 795 EXPECT_EQ(w4.get(), windows[1]); |
| 794 EXPECT_EQ(w5.get(), windows[0]); | 796 EXPECT_EQ(w5.get(), windows[0]); |
| 795 } | 797 } |
| 796 | 798 |
| 797 // Destroying should still keep the order. | 799 // Destroying should still keep the order. |
| 798 DestroyMaximizeModeWindowManager(); | 800 DestroyMaximizeModeWindowManager(); |
| 799 { | 801 { |
| 800 MruWindowTracker::WindowList windows = ash::Shell::GetInstance()-> | 802 aura::Window::Windows windows = WmWindowAura::ToAuraWindows( |
| 801 mru_window_tracker()->BuildMruWindowList(); | 803 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); |
| 802 // We do not test maximization here again since that was done already. | 804 // We do not test maximization here again since that was done already. |
| 803 EXPECT_EQ(w1.get(), windows[4]); | 805 EXPECT_EQ(w1.get(), windows[4]); |
| 804 EXPECT_EQ(w2.get(), windows[3]); | 806 EXPECT_EQ(w2.get(), windows[3]); |
| 805 EXPECT_EQ(w3.get(), windows[2]); | 807 EXPECT_EQ(w3.get(), windows[2]); |
| 806 EXPECT_EQ(w4.get(), windows[1]); | 808 EXPECT_EQ(w4.get(), windows[1]); |
| 807 EXPECT_EQ(w5.get(), windows[0]); | 809 EXPECT_EQ(w5.get(), windows[0]); |
| 808 } | 810 } |
| 809 } | 811 } |
| 810 | 812 |
| 811 // Check that a restore state change does always restore to maximized. | 813 // Check that a restore state change does always restore to maximized. |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 | 1445 |
| 1444 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); | 1446 ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); |
| 1445 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); | 1447 EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked()); |
| 1446 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); | 1448 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); |
| 1447 EXPECT_EQ(0, manager->GetNumberOfManagedWindows()); | 1449 EXPECT_EQ(0, manager->GetNumberOfManagedWindows()); |
| 1448 } | 1450 } |
| 1449 | 1451 |
| 1450 #endif // OS_WIN | 1452 #endif // OS_WIN |
| 1451 | 1453 |
| 1452 } // namespace ash | 1454 } // namespace ash |
| OLD | NEW |