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/common/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/common/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/shelf/shelf_constants.h" | 8 #include "ash/common/shelf/shelf_constants.h" |
9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 return; | 594 return; |
595 | 595 |
596 // Restore the window to clear snapped state. | 596 // Restore the window to clear snapped state. |
597 window_state->Restore(); | 597 window_state->Restore(); |
598 | 598 |
599 UpdateDisplay("800x600,500x600"); | 599 UpdateDisplay("800x600,500x600"); |
600 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 600 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
601 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); | 601 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); |
602 // Window is wide enough not to get docked right away. | 602 // Window is wide enough not to get docked right away. |
603 window_->SetBoundsInScreen(gfx::Rect(800, 10, 400, 60), | 603 window_->SetBoundsInScreen(gfx::Rect(800, 10, 400, 60), |
604 ScreenUtil::GetSecondaryDisplay()); | 604 display_manager()->GetSecondaryDisplay()); |
605 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); | 605 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); |
606 { | 606 { |
607 EXPECT_EQ("800,10 400x60", window_->GetBoundsInScreen().ToString()); | 607 EXPECT_EQ("800,10 400x60", window_->GetBoundsInScreen().ToString()); |
608 | 608 |
609 std::unique_ptr<WindowResizer> resizer( | 609 std::unique_ptr<WindowResizer> resizer( |
610 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); | 610 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); |
611 ASSERT_TRUE(resizer.get()); | 611 ASSERT_TRUE(resizer.get()); |
612 resizer->Drag(CalculateDragPoint(*resizer, 499, 0), 0); | 612 resizer->Drag(CalculateDragPoint(*resizer, 499, 0), 0); |
613 int bottom = | 613 int bottom = |
614 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom(); | 614 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom(); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 return; | 811 return; |
812 | 812 |
813 UpdateDisplay("800x600,800x600"); | 813 UpdateDisplay("800x600,800x600"); |
814 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); | 814 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); |
815 | 815 |
816 Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), | 816 Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), |
817 gfx::Insets(0, 0, 10, 0)); | 817 gfx::Insets(0, 0, 10, 0)); |
818 | 818 |
819 // Positions the secondary display at the bottom the primary display. | 819 // Positions the secondary display at the bottom the primary display. |
820 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 820 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
821 test::CreateDisplayLayout(display::DisplayPlacement::BOTTOM, 0)); | 821 test::CreateDisplayLayout(display_manager(), |
| 822 display::DisplayPlacement::BOTTOM, 0)); |
822 | 823 |
823 { | 824 { |
824 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); | 825 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); |
825 DCHECK_LT(window_->bounds().height(), | 826 DCHECK_LT(window_->bounds().height(), |
826 WorkspaceWindowResizer::kMinOnscreenHeight); | 827 WorkspaceWindowResizer::kMinOnscreenHeight); |
827 // Drag down avoiding dragging along the edge as that would side-snap. | 828 // Drag down avoiding dragging along the edge as that would side-snap. |
828 std::unique_ptr<WindowResizer> resizer( | 829 std::unique_ptr<WindowResizer> resizer( |
829 CreateResizerForTest(window_.get(), gfx::Point(10, 0), HTCAPTION)); | 830 CreateResizerForTest(window_.get(), gfx::Point(10, 0), HTCAPTION)); |
830 ASSERT_TRUE(resizer.get()); | 831 ASSERT_TRUE(resizer.get()); |
831 resizer->Drag(CalculateDragPoint(*resizer, 0, 400), 0); | 832 resizer->Drag(CalculateDragPoint(*resizer, 0, 400), 0); |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 touch_resize_window_->bounds().ToString()); | 1881 touch_resize_window_->bounds().ToString()); |
1881 // Drag even more to snap to the edge. | 1882 // Drag even more to snap to the edge. |
1882 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1883 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
1883 gfx::Point(400, kRootHeight - 25), | 1884 gfx::Point(400, kRootHeight - 25), |
1884 base::TimeDelta::FromMilliseconds(10), 5); | 1885 base::TimeDelta::FromMilliseconds(10), 5); |
1885 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1886 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
1886 touch_resize_window_->bounds().ToString()); | 1887 touch_resize_window_->bounds().ToString()); |
1887 } | 1888 } |
1888 | 1889 |
1889 } // namespace ash | 1890 } // namespace ash |
OLD | NEW |