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/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 643 |
644 TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) { | 644 TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) { |
645 if (!SupportsMultipleDisplays()) | 645 if (!SupportsMultipleDisplays()) |
646 return; | 646 return; |
647 | 647 |
648 UpdateDisplay("800x600,800x600"); | 648 UpdateDisplay("800x600,800x600"); |
649 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 649 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
650 ASSERT_EQ(2U, root_windows.size()); | 650 ASSERT_EQ(2U, root_windows.size()); |
651 | 651 |
652 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), | 652 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), |
653 Shell::GetScreen()->GetPrimaryDisplay()); | 653 gfx::Screen::GetScreen()->GetPrimaryDisplay()); |
654 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); | 654 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); |
655 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); | 655 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); |
656 { | 656 { |
657 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( | 657 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( |
658 window_.get(), gfx::Point(), HTCAPTION)); | 658 window_.get(), gfx::Point(), HTCAPTION)); |
659 ASSERT_TRUE(resizer.get()); | 659 ASSERT_TRUE(resizer.get()); |
660 EXPECT_FALSE(snap_phantom_window_controller()); | 660 EXPECT_FALSE(snap_phantom_window_controller()); |
661 | 661 |
662 // The pointer is on the edge but not shared. The snap phantom window | 662 // The pointer is on the edge but not shared. The snap phantom window |
663 // controller should be non-NULL. | 663 // controller should be non-NULL. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 // 2 should be topmost since it's initially the highest in the stack. | 788 // 2 should be topmost since it's initially the highest in the stack. |
789 EXPECT_EQ("2 3 1", WindowOrderAsString(window_->parent())); | 789 EXPECT_EQ("2 3 1", WindowOrderAsString(window_->parent())); |
790 } | 790 } |
791 } | 791 } |
792 | 792 |
793 // Makes sure we don't allow dragging below the work area. | 793 // Makes sure we don't allow dragging below the work area. |
794 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) { | 794 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) { |
795 Shell::GetInstance()->SetDisplayWorkAreaInsets( | 795 Shell::GetInstance()->SetDisplayWorkAreaInsets( |
796 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); | 796 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); |
797 | 797 |
798 ASSERT_EQ(1, Shell::GetScreen()->GetNumDisplays()); | 798 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); |
799 | 799 |
800 window_->SetBounds(gfx::Rect(100, 200, 300, 400)); | 800 window_->SetBounds(gfx::Rect(100, 200, 300, 400)); |
801 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( | 801 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( |
802 window_.get(), gfx::Point(), HTCAPTION)); | 802 window_.get(), gfx::Point(), HTCAPTION)); |
803 ASSERT_TRUE(resizer.get()); | 803 ASSERT_TRUE(resizer.get()); |
804 resizer->Drag(CalculateDragPoint(*resizer, 0, 600), 0); | 804 resizer->Drag(CalculateDragPoint(*resizer, 0, 600), 0); |
805 int expected_y = | 805 int expected_y = |
806 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10; | 806 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10; |
807 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400", | 807 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400", |
808 window_->bounds().ToString()); | 808 window_->bounds().ToString()); |
809 } | 809 } |
810 | 810 |
811 // Makes sure we don't allow dragging on the work area with multidisplay. | 811 // Makes sure we don't allow dragging on the work area with multidisplay. |
812 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) { | 812 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) { |
813 if (!SupportsMultipleDisplays()) | 813 if (!SupportsMultipleDisplays()) |
814 return; | 814 return; |
815 | 815 |
816 UpdateDisplay("800x600,800x600"); | 816 UpdateDisplay("800x600,800x600"); |
817 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); | 817 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); |
818 | 818 |
819 Shell::GetInstance()->SetDisplayWorkAreaInsets( | 819 Shell::GetInstance()->SetDisplayWorkAreaInsets( |
820 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); | 820 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); |
821 | 821 |
822 // Positions the secondary display at the bottom the primary display. | 822 // Positions the secondary display at the bottom the primary display. |
823 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 823 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
824 ash::DisplayLayout(ash::DisplayLayout::BOTTOM, 0)); | 824 ash::DisplayLayout(ash::DisplayLayout::BOTTOM, 0)); |
825 | 825 |
826 { | 826 { |
827 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); | 827 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 // Drag even more to snap to the edge. | 1882 // Drag even more to snap to the edge. |
1883 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1883 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
1884 gfx::Point(400, kRootHeight - 25), | 1884 gfx::Point(400, kRootHeight - 25), |
1885 base::TimeDelta::FromMilliseconds(10), | 1885 base::TimeDelta::FromMilliseconds(10), |
1886 5); | 1886 5); |
1887 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1887 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
1888 touch_resize_window_->bounds().ToString()); | 1888 touch_resize_window_->bounds().ToString()); |
1889 } | 1889 } |
1890 | 1890 |
1891 } // namespace ash | 1891 } // namespace ash |
OLD | NEW |