| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/launcher/launcher.h" | 5 #include "ash/launcher/launcher.h" |
| 6 #include "ash/root_window_controller.h" | 6 #include "ash/root_window_controller.h" |
| 7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
| 8 #include "ash/shelf/shelf_widget.h" | 8 #include "ash/shelf/shelf_widget.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 EXPECT_TRUE(wm::IsActiveWindow(child1.get())); | 684 EXPECT_TRUE(wm::IsActiveWindow(child1.get())); |
| 685 } | 685 } |
| 686 | 686 |
| 687 // Tests that windows remain on the display they are currently on in overview | 687 // Tests that windows remain on the display they are currently on in overview |
| 688 // mode. | 688 // mode. |
| 689 TEST_F(WindowSelectorTest, MultipleDisplays) { | 689 TEST_F(WindowSelectorTest, MultipleDisplays) { |
| 690 if (!SupportsMultipleDisplays()) | 690 if (!SupportsMultipleDisplays()) |
| 691 return; | 691 return; |
| 692 | 692 |
| 693 UpdateDisplay("600x400,600x400"); | 693 UpdateDisplay("600x400,600x400"); |
| 694 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 694 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 695 gfx::Rect bounds1(0, 0, 400, 400); | 695 gfx::Rect bounds1(0, 0, 400, 400); |
| 696 gfx::Rect bounds2(650, 0, 400, 400); | 696 gfx::Rect bounds2(650, 0, 400, 400); |
| 697 | 697 |
| 698 scoped_ptr<aura::Window> window1(CreateWindow(bounds1)); | 698 scoped_ptr<aura::Window> window1(CreateWindow(bounds1)); |
| 699 scoped_ptr<aura::Window> window2(CreateWindow(bounds1)); | 699 scoped_ptr<aura::Window> window2(CreateWindow(bounds1)); |
| 700 scoped_ptr<aura::Window> window3(CreateWindow(bounds2)); | 700 scoped_ptr<aura::Window> window3(CreateWindow(bounds2)); |
| 701 scoped_ptr<aura::Window> window4(CreateWindow(bounds2)); | 701 scoped_ptr<aura::Window> window4(CreateWindow(bounds2)); |
| 702 scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds1)); | 702 scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds1)); |
| 703 scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds1)); | 703 scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds1)); |
| 704 scoped_ptr<aura::Window> panel3(CreatePanelWindow(bounds2)); | 704 scoped_ptr<aura::Window> panel3(CreatePanelWindow(bounds2)); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 EXPECT_FALSE(WindowsOverlapping(panel1.get(), panel3.get())); | 746 EXPECT_FALSE(WindowsOverlapping(panel1.get(), panel3.get())); |
| 747 } | 747 } |
| 748 | 748 |
| 749 // Verifies that the single display overview used during alt tab cycling uses | 749 // Verifies that the single display overview used during alt tab cycling uses |
| 750 // the display of the initial window by default. | 750 // the display of the initial window by default. |
| 751 TEST_F(WindowSelectorTest, CycleOverviewUsesInitialDisplay) { | 751 TEST_F(WindowSelectorTest, CycleOverviewUsesInitialDisplay) { |
| 752 if (!SupportsMultipleDisplays()) | 752 if (!SupportsMultipleDisplays()) |
| 753 return; | 753 return; |
| 754 | 754 |
| 755 UpdateDisplay("400x400,400x400"); | 755 UpdateDisplay("400x400,400x400"); |
| 756 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 756 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 757 | 757 |
| 758 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 100, 100))); | 758 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 100, 100))); |
| 759 scoped_ptr<aura::Window> window2(CreateWindow(gfx::Rect(450, 0, 100, 100))); | 759 scoped_ptr<aura::Window> window2(CreateWindow(gfx::Rect(450, 0, 100, 100))); |
| 760 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); | 760 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); |
| 761 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); | 761 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); |
| 762 wm::ActivateWindow(window2.get()); | 762 wm::ActivateWindow(window2.get()); |
| 763 wm::ActivateWindow(window1.get()); | 763 wm::ActivateWindow(window1.get()); |
| 764 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); | 764 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); |
| 765 | 765 |
| 766 Cycle(WindowSelector::FORWARD); | 766 Cycle(WindowSelector::FORWARD); |
| 767 FireOverviewStartTimer(); | 767 FireOverviewStartTimer(); |
| 768 | 768 |
| 769 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( | 769 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( |
| 770 ToEnclosingRect(GetTransformedTargetBounds(window1.get())))); | 770 ToEnclosingRect(GetTransformedTargetBounds(window1.get())))); |
| 771 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( | 771 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( |
| 772 ToEnclosingRect(GetTransformedTargetBounds(window2.get())))); | 772 ToEnclosingRect(GetTransformedTargetBounds(window2.get())))); |
| 773 StopCycling(); | 773 StopCycling(); |
| 774 } | 774 } |
| 775 | 775 |
| 776 // Verifies that the windows being shown on another display are copied. | 776 // Verifies that the windows being shown on another display are copied. |
| 777 TEST_F(WindowSelectorTest, CycleMultipleDisplaysCopiesWindows) { | 777 TEST_F(WindowSelectorTest, CycleMultipleDisplaysCopiesWindows) { |
| 778 if (!SupportsMultipleDisplays()) | 778 if (!SupportsMultipleDisplays()) |
| 779 return; | 779 return; |
| 780 | 780 |
| 781 UpdateDisplay("400x400,400x400"); | 781 UpdateDisplay("400x400,400x400"); |
| 782 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 782 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 783 | 783 |
| 784 gfx::Rect root1_rect(0, 0, 100, 100); | 784 gfx::Rect root1_rect(0, 0, 100, 100); |
| 785 gfx::Rect root2_rect(450, 0, 100, 100); | 785 gfx::Rect root2_rect(450, 0, 100, 100); |
| 786 scoped_ptr<aura::Window> unmoved1(CreateWindow(root2_rect)); | 786 scoped_ptr<aura::Window> unmoved1(CreateWindow(root2_rect)); |
| 787 scoped_ptr<aura::Window> unmoved2(CreateWindow(root2_rect)); | 787 scoped_ptr<aura::Window> unmoved2(CreateWindow(root2_rect)); |
| 788 scoped_ptr<aura::Window> moved1_trans_parent(CreateWindow(root1_rect)); | 788 scoped_ptr<aura::Window> moved1_trans_parent(CreateWindow(root1_rect)); |
| 789 scoped_ptr<aura::Window> moved1(CreateWindow(root1_rect)); | 789 scoped_ptr<aura::Window> moved1(CreateWindow(root1_rect)); |
| 790 unmoved1->SetName("unmoved1"); | 790 unmoved1->SetName("unmoved1"); |
| 791 unmoved2->SetName("unmoved2"); | 791 unmoved2->SetName("unmoved2"); |
| 792 moved1->SetName("moved1"); | 792 moved1->SetName("moved1"); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 EXPECT_TRUE(!GetCopyWindow(moved1_trans_parent.get())); | 841 EXPECT_TRUE(!GetCopyWindow(moved1_trans_parent.get())); |
| 842 } | 842 } |
| 843 | 843 |
| 844 // Tests that beginning to cycle from overview mode moves windows to the | 844 // Tests that beginning to cycle from overview mode moves windows to the |
| 845 // active display. | 845 // active display. |
| 846 TEST_F(WindowSelectorTest, MultipleDisplaysOverviewTransitionToCycle) { | 846 TEST_F(WindowSelectorTest, MultipleDisplaysOverviewTransitionToCycle) { |
| 847 if (!SupportsMultipleDisplays()) | 847 if (!SupportsMultipleDisplays()) |
| 848 return; | 848 return; |
| 849 | 849 |
| 850 UpdateDisplay("400x400,400x400"); | 850 UpdateDisplay("400x400,400x400"); |
| 851 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 851 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 852 | 852 |
| 853 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 100, 100))); | 853 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 100, 100))); |
| 854 scoped_ptr<aura::Window> window2(CreateWindow(gfx::Rect(450, 0, 100, 100))); | 854 scoped_ptr<aura::Window> window2(CreateWindow(gfx::Rect(450, 0, 100, 100))); |
| 855 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); | 855 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); |
| 856 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); | 856 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); |
| 857 wm::ActivateWindow(window2.get()); | 857 wm::ActivateWindow(window2.get()); |
| 858 wm::ActivateWindow(window1.get()); | 858 wm::ActivateWindow(window1.get()); |
| 859 | 859 |
| 860 ToggleOverview(); | 860 ToggleOverview(); |
| 861 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( | 861 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( |
| 862 ToEnclosingRect(GetTransformedTargetBounds(window1.get())))); | 862 ToEnclosingRect(GetTransformedTargetBounds(window1.get())))); |
| 863 EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains( | 863 EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains( |
| 864 ToEnclosingRect(GetTransformedTargetBounds(window2.get())))); | 864 ToEnclosingRect(GetTransformedTargetBounds(window2.get())))); |
| 865 | 865 |
| 866 Cycle(WindowSelector::FORWARD); | 866 Cycle(WindowSelector::FORWARD); |
| 867 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( | 867 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( |
| 868 ToEnclosingRect(GetTransformedTargetBounds(window1.get())))); | 868 ToEnclosingRect(GetTransformedTargetBounds(window1.get())))); |
| 869 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( | 869 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( |
| 870 ToEnclosingRect(GetTransformedTargetBounds(window2.get())))); | 870 ToEnclosingRect(GetTransformedTargetBounds(window2.get())))); |
| 871 StopCycling(); | 871 StopCycling(); |
| 872 } | 872 } |
| 873 | 873 |
| 874 // Tests that a bounds change during overview is corrected for. | 874 // Tests that a bounds change during overview is corrected for. |
| 875 TEST_F(WindowSelectorTest, BoundsChangeDuringCycleOnOtherDisplay) { | 875 TEST_F(WindowSelectorTest, BoundsChangeDuringCycleOnOtherDisplay) { |
| 876 if (!SupportsMultipleDisplays()) | 876 if (!SupportsMultipleDisplays()) |
| 877 return; | 877 return; |
| 878 | 878 |
| 879 UpdateDisplay("400x400,400x400"); | 879 UpdateDisplay("400x400,400x400"); |
| 880 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 880 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 881 | 881 |
| 882 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 100, 100))); | 882 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 100, 100))); |
| 883 scoped_ptr<aura::Window> window2(CreateWindow(gfx::Rect(450, 0, 100, 100))); | 883 scoped_ptr<aura::Window> window2(CreateWindow(gfx::Rect(450, 0, 100, 100))); |
| 884 scoped_ptr<aura::Window> window3(CreateWindow(gfx::Rect(450, 0, 100, 100))); | 884 scoped_ptr<aura::Window> window3(CreateWindow(gfx::Rect(450, 0, 100, 100))); |
| 885 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); | 885 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); |
| 886 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); | 886 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); |
| 887 EXPECT_EQ(root_windows[1], window3->GetRootWindow()); | 887 EXPECT_EQ(root_windows[1], window3->GetRootWindow()); |
| 888 wm::ActivateWindow(window1.get()); | 888 wm::ActivateWindow(window1.get()); |
| 889 wm::ActivateWindow(window2.get()); | 889 wm::ActivateWindow(window2.get()); |
| 890 wm::ActivateWindow(window3.get()); | 890 wm::ActivateWindow(window3.get()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 903 ToEnclosingRect(GetTransformedTargetBounds(window1.get())); | 903 ToEnclosingRect(GetTransformedTargetBounds(window1.get())); |
| 904 EXPECT_EQ(overview_bounds.x(), new_overview_bounds.x()); | 904 EXPECT_EQ(overview_bounds.x(), new_overview_bounds.x()); |
| 905 EXPECT_EQ(overview_bounds.y(), new_overview_bounds.y()); | 905 EXPECT_EQ(overview_bounds.y(), new_overview_bounds.y()); |
| 906 EXPECT_EQ(overview_bounds.width(), new_overview_bounds.width()); | 906 EXPECT_EQ(overview_bounds.width(), new_overview_bounds.width()); |
| 907 EXPECT_EQ(overview_bounds.height(), new_overview_bounds.height()); | 907 EXPECT_EQ(overview_bounds.height(), new_overview_bounds.height()); |
| 908 StopCycling(); | 908 StopCycling(); |
| 909 } | 909 } |
| 910 | 910 |
| 911 } // namespace internal | 911 } // namespace internal |
| 912 } // namespace ash | 912 } // namespace ash |
| OLD | NEW |