OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/wm/core/focus_controller.h" | 5 #include "ui/wm/core/focus_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 EXPECT_EQ(to_delete, observer1.GetDeletedWindow()); | 837 EXPECT_EQ(to_delete, observer1.GetDeletedWindow()); |
838 EXPECT_FALSE(observer2.was_notified_with_deleted_window()); | 838 EXPECT_FALSE(observer2.was_notified_with_deleted_window()); |
839 } | 839 } |
840 } | 840 } |
841 | 841 |
842 // Test that the activation of the current active window will bring the window | 842 // Test that the activation of the current active window will bring the window |
843 // to the top of the window stack. | 843 // to the top of the window stack. |
844 void StackWindowAtTopOnActivation() override { | 844 void StackWindowAtTopOnActivation() override { |
845 // Create a window, show it and then activate it. | 845 // Create a window, show it and then activate it. |
846 std::unique_ptr<aura::Window> window1 = | 846 std::unique_ptr<aura::Window> window1 = |
847 base::WrapUnique(new aura::Window(nullptr)); | 847 base::MakeUnique<aura::Window>(nullptr); |
848 window1->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 848 window1->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
849 window1->Init(ui::LAYER_TEXTURED); | 849 window1->Init(ui::LAYER_TEXTURED); |
850 root_window()->AddChild(window1.get()); | 850 root_window()->AddChild(window1.get()); |
851 window1->Show(); | 851 window1->Show(); |
852 ActivateWindow(window1.get()); | 852 ActivateWindow(window1.get()); |
853 EXPECT_EQ(window1.get(), root_window()->children().back()); | 853 EXPECT_EQ(window1.get(), root_window()->children().back()); |
854 EXPECT_EQ(window1.get(), GetActiveWindow()); | 854 EXPECT_EQ(window1.get(), GetActiveWindow()); |
855 | 855 |
856 // Create another window, show it but don't activate it. The window is not | 856 // Create another window, show it but don't activate it. The window is not |
857 // the active window but is placed on top of window stack. | 857 // the active window but is placed on top of window stack. |
858 std::unique_ptr<aura::Window> window2 = | 858 std::unique_ptr<aura::Window> window2 = |
859 base::WrapUnique(new aura::Window(nullptr)); | 859 base::MakeUnique<aura::Window>(nullptr); |
860 window2->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 860 window2->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
861 window2->Init(ui::LAYER_TEXTURED); | 861 window2->Init(ui::LAYER_TEXTURED); |
862 root_window()->AddChild(window2.get()); | 862 root_window()->AddChild(window2.get()); |
863 window2->Show(); | 863 window2->Show(); |
864 EXPECT_EQ(window2.get(), root_window()->children().back()); | 864 EXPECT_EQ(window2.get(), root_window()->children().back()); |
865 EXPECT_EQ(window1.get(), GetActiveWindow()); | 865 EXPECT_EQ(window1.get(), GetActiveWindow()); |
866 | 866 |
867 // Try to reactivate the active window. It should bring the active window | 867 // Try to reactivate the active window. It should bring the active window |
868 // to the top of the window stack. | 868 // to the top of the window stack. |
869 ActivateWindow(window1.get()); | 869 ActivateWindow(window1.get()); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, StackWindowAtTopOnActivation); | 1321 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, StackWindowAtTopOnActivation); |
1322 | 1322 |
1323 // See description above TransientChildWindowActivationTest() for details. | 1323 // See description above TransientChildWindowActivationTest() for details. |
1324 FOCUS_CONTROLLER_TEST(FocusControllerParentHideTest, | 1324 FOCUS_CONTROLLER_TEST(FocusControllerParentHideTest, |
1325 TransientChildWindowActivationTest); | 1325 TransientChildWindowActivationTest); |
1326 | 1326 |
1327 // If a mouse event was handled, it should not activate a window. | 1327 // If a mouse event was handled, it should not activate a window. |
1328 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); | 1328 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); |
1329 | 1329 |
1330 } // namespace wm | 1330 } // namespace wm |
OLD | NEW |