| 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/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
| 6 #include "ash/root_window_controller.h" | 6 #include "ash/root_window_controller.h" |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); | 721 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); |
| 722 } | 722 } |
| 723 | 723 |
| 724 // Tests that windows with modal child windows are transformed with the modal | 724 // Tests that windows with modal child windows are transformed with the modal |
| 725 // child even though not activatable themselves. | 725 // child even though not activatable themselves. |
| 726 TEST_F(WindowSelectorTest, ModalChild) { | 726 TEST_F(WindowSelectorTest, ModalChild) { |
| 727 gfx::Rect bounds(0, 0, 400, 400); | 727 gfx::Rect bounds(0, 0, 400, 400); |
| 728 scoped_ptr<aura::Window> window1(CreateWindow(bounds)); | 728 scoped_ptr<aura::Window> window1(CreateWindow(bounds)); |
| 729 scoped_ptr<aura::Window> child1(CreateWindow(bounds)); | 729 scoped_ptr<aura::Window> child1(CreateWindow(bounds)); |
| 730 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); | 730 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); |
| 731 views::corewm::AddTransientChild(window1.get(), child1.get()); | 731 ::wm::AddTransientChild(window1.get(), child1.get()); |
| 732 EXPECT_EQ(window1->parent(), child1->parent()); | 732 EXPECT_EQ(window1->parent(), child1->parent()); |
| 733 ToggleOverview(); | 733 ToggleOverview(); |
| 734 EXPECT_TRUE(window1->IsVisible()); | 734 EXPECT_TRUE(window1->IsVisible()); |
| 735 EXPECT_TRUE(child1->IsVisible()); | 735 EXPECT_TRUE(child1->IsVisible()); |
| 736 EXPECT_EQ(ToEnclosingRect(GetTransformedTargetBounds(child1.get())), | 736 EXPECT_EQ(ToEnclosingRect(GetTransformedTargetBounds(child1.get())), |
| 737 ToEnclosingRect(GetTransformedTargetBounds(window1.get()))); | 737 ToEnclosingRect(GetTransformedTargetBounds(window1.get()))); |
| 738 ToggleOverview(); | 738 ToggleOverview(); |
| 739 } | 739 } |
| 740 | 740 |
| 741 // Tests that clicking a modal window's parent activates the modal window in | 741 // Tests that clicking a modal window's parent activates the modal window in |
| 742 // overview. | 742 // overview. |
| 743 TEST_F(WindowSelectorTest, ClickModalWindowParent) { | 743 TEST_F(WindowSelectorTest, ClickModalWindowParent) { |
| 744 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 180, 180))); | 744 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 180, 180))); |
| 745 scoped_ptr<aura::Window> child1(CreateWindow(gfx::Rect(200, 0, 180, 180))); | 745 scoped_ptr<aura::Window> child1(CreateWindow(gfx::Rect(200, 0, 180, 180))); |
| 746 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); | 746 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); |
| 747 views::corewm::AddTransientChild(window1.get(), child1.get()); | 747 ::wm::AddTransientChild(window1.get(), child1.get()); |
| 748 EXPECT_FALSE(WindowsOverlapping(window1.get(), child1.get())); | 748 EXPECT_FALSE(WindowsOverlapping(window1.get(), child1.get())); |
| 749 EXPECT_EQ(window1->parent(), child1->parent()); | 749 EXPECT_EQ(window1->parent(), child1->parent()); |
| 750 ToggleOverview(); | 750 ToggleOverview(); |
| 751 // Given that their relative positions are preserved, the windows should still | 751 // Given that their relative positions are preserved, the windows should still |
| 752 // not overlap. | 752 // not overlap. |
| 753 EXPECT_FALSE(WindowsOverlapping(window1.get(), child1.get())); | 753 EXPECT_FALSE(WindowsOverlapping(window1.get(), child1.get())); |
| 754 ClickWindow(window1.get()); | 754 ClickWindow(window1.get()); |
| 755 EXPECT_FALSE(IsSelecting()); | 755 EXPECT_FALSE(IsSelecting()); |
| 756 | 756 |
| 757 // Clicking on window1 should activate child1. | 757 // Clicking on window1 should activate child1. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 gfx::Rect root1_rect(0, 0, 100, 100); | 858 gfx::Rect root1_rect(0, 0, 100, 100); |
| 859 gfx::Rect root2_rect(450, 0, 100, 100); | 859 gfx::Rect root2_rect(450, 0, 100, 100); |
| 860 scoped_ptr<aura::Window> unmoved1(CreateWindow(root2_rect)); | 860 scoped_ptr<aura::Window> unmoved1(CreateWindow(root2_rect)); |
| 861 scoped_ptr<aura::Window> unmoved2(CreateWindow(root2_rect)); | 861 scoped_ptr<aura::Window> unmoved2(CreateWindow(root2_rect)); |
| 862 scoped_ptr<aura::Window> moved1_trans_parent(CreateWindow(root1_rect)); | 862 scoped_ptr<aura::Window> moved1_trans_parent(CreateWindow(root1_rect)); |
| 863 scoped_ptr<aura::Window> moved1(CreateWindow(root1_rect)); | 863 scoped_ptr<aura::Window> moved1(CreateWindow(root1_rect)); |
| 864 unmoved1->SetName("unmoved1"); | 864 unmoved1->SetName("unmoved1"); |
| 865 unmoved2->SetName("unmoved2"); | 865 unmoved2->SetName("unmoved2"); |
| 866 moved1->SetName("moved1"); | 866 moved1->SetName("moved1"); |
| 867 moved1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); | 867 moved1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); |
| 868 views::corewm::AddTransientChild(moved1_trans_parent.get(), moved1.get()); | 868 ::wm::AddTransientChild(moved1_trans_parent.get(), moved1.get()); |
| 869 moved1_trans_parent->SetName("moved1_trans_parent"); | 869 moved1_trans_parent->SetName("moved1_trans_parent"); |
| 870 | 870 |
| 871 EXPECT_EQ(root_windows[0], moved1->GetRootWindow()); | 871 EXPECT_EQ(root_windows[0], moved1->GetRootWindow()); |
| 872 EXPECT_EQ(root_windows[0], moved1_trans_parent->GetRootWindow()); | 872 EXPECT_EQ(root_windows[0], moved1_trans_parent->GetRootWindow()); |
| 873 EXPECT_EQ(root_windows[1], unmoved1->GetRootWindow()); | 873 EXPECT_EQ(root_windows[1], unmoved1->GetRootWindow()); |
| 874 EXPECT_EQ(root_windows[1], unmoved2->GetRootWindow()); | 874 EXPECT_EQ(root_windows[1], unmoved2->GetRootWindow()); |
| 875 wm::ActivateWindow(unmoved2.get()); | 875 wm::ActivateWindow(unmoved2.get()); |
| 876 wm::ActivateWindow(unmoved1.get()); | 876 wm::ActivateWindow(unmoved1.get()); |
| 877 | 877 |
| 878 Cycle(WindowSelector::FORWARD); | 878 Cycle(WindowSelector::FORWARD); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 ui::MouseEvent event(ui::ET_MOUSE_MOVED, points[p], points[p], | 1084 ui::MouseEvent event(ui::ET_MOUSE_MOVED, points[p], points[p], |
| 1085 ui::EF_NONE, ui::EF_NONE); | 1085 ui::EF_NONE, ui::EF_NONE); |
| 1086 EXPECT_EQ(windows[w], | 1086 EXPECT_EQ(windows[w], |
| 1087 targeter->FindTargetForEvent(root_target, &event)); | 1087 targeter->FindTargetForEvent(root_target, &event)); |
| 1088 } | 1088 } |
| 1089 } | 1089 } |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 } // namespace internal | 1092 } // namespace internal |
| 1093 } // namespace ash | 1093 } // namespace ash |
| OLD | NEW |