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 "ash/aura/wm_window_aura.h" | 5 #include "ash/aura/wm_window_aura.h" |
6 #include "ash/common/shell_window_ids.h" | 6 #include "ash/common/shell_window_ids.h" |
7 #include "ash/common/system/tray/system_tray.h" | 7 #include "ash/common/system/tray/system_tray.h" |
8 #include "ash/common/wm/root_window_finder.h" | 8 #include "ash/common/wm/root_window_finder.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 if (!SupportsMultipleDisplays()) | 793 if (!SupportsMultipleDisplays()) |
794 return; | 794 return; |
795 | 795 |
796 UpdateDisplay("100x100,200x200"); | 796 UpdateDisplay("100x100,200x200"); |
797 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 797 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
798 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 50, 50)); | 798 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 50, 50)); |
799 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); | 799 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); |
800 w1->SetBounds(gfx::Rect(150, 10, 50, 50)); | 800 w1->SetBounds(gfx::Rect(150, 10, 50, 50)); |
801 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); | 801 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); |
802 | 802 |
803 // The widget stays in the same root if kStayInSameRootWindowKey is set to | 803 // The widget stays in the same root if kLockedToRootKey is set to true. |
804 // true. | 804 w1->GetNativeView()->SetProperty(kLockedToRootKey, true); |
805 w1->GetNativeView()->SetProperty(kStayInSameRootWindowKey, true); | |
806 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); | 805 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); |
807 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); | 806 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); |
808 | 807 |
809 // The widget should now move to the 1st root window without the property. | 808 // The widget should now move to the 1st root window without the property. |
810 w1->GetNativeView()->ClearProperty(kStayInSameRootWindowKey); | 809 w1->GetNativeView()->ClearProperty(kLockedToRootKey); |
811 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); | 810 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); |
812 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); | 811 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); |
813 | 812 |
814 // a window in SettingsBubbleContainer and StatusContainer should | 813 // a window in SettingsBubbleContainer and StatusContainer should |
815 // not move to another root window regardles of the bounds specified. | 814 // not move to another root window regardles of the bounds specified. |
816 aura::Window* settings_bubble_container = | 815 aura::Window* settings_bubble_container = |
817 Shell::GetPrimaryRootWindowController()->GetContainer( | 816 Shell::GetPrimaryRootWindowController()->GetContainer( |
818 kShellWindowId_SettingBubbleContainer); | 817 kShellWindowId_SettingBubbleContainer); |
819 aura::Window* window = | 818 aura::Window* window = |
820 aura::test::CreateTestWindowWithId(100, settings_bubble_container); | 819 aura::test::CreateTestWindowWithId(100, settings_bubble_container); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 generator.ReleaseLeftButton(); | 928 generator.ReleaseLeftButton(); |
930 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); | 929 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); |
931 | 930 |
932 generator.MoveMouseTo(400, 150); | 931 generator.MoveMouseTo(400, 150); |
933 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); | 932 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); |
934 | 933 |
935 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 934 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
936 } | 935 } |
937 | 936 |
938 } // namespace ash | 937 } // namespace ash |
OLD | NEW |