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/wm/window_positioning_utils.h" | 10 #include "ash/common/wm/window_positioning_utils.h" |
11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
12 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
13 #include "ash/common/wm/workspace/phantom_window_controller.h" | 13 #include "ash/common/wm/workspace/phantom_window_controller.h" |
14 #include "ash/common/wm/workspace_controller.h" | 14 #include "ash/common/wm/workspace_controller.h" |
15 #include "ash/display/display_manager.h" | |
16 #include "ash/public/cpp/shell_window_ids.h" | 15 #include "ash/public/cpp/shell_window_ids.h" |
17 #include "ash/screen_util.h" | 16 #include "ash/screen_util.h" |
18 #include "ash/shell.h" | 17 #include "ash/shell.h" |
19 #include "ash/test/ash_md_test_base.h" | 18 #include "ash/test/ash_md_test_base.h" |
20 #include "ash/test/display_manager_test_api.h" | |
21 #include "ash/wm/window_state_aura.h" | 19 #include "ash/wm/window_state_aura.h" |
22 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
23 #include "base/command_line.h" | 21 #include "base/command_line.h" |
24 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
25 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
26 #include "ui/aura/client/aura_constants.h" | 24 #include "ui/aura/client/aura_constants.h" |
27 #include "ui/aura/test/test_window_delegate.h" | 25 #include "ui/aura/test/test_window_delegate.h" |
28 #include "ui/aura/window_event_dispatcher.h" | 26 #include "ui/aura/window_event_dispatcher.h" |
29 #include "ui/base/hit_test.h" | 27 #include "ui/base/hit_test.h" |
30 #include "ui/display/manager/display_layout.h" | 28 #include "ui/display/manager/display_layout.h" |
| 29 #include "ui/display/manager/display_manager.h" |
31 #include "ui/display/screen.h" | 30 #include "ui/display/screen.h" |
| 31 #include "ui/display/test/display_manager_test_api.h" |
32 #include "ui/events/gesture_detection/gesture_configuration.h" | 32 #include "ui/events/gesture_detection/gesture_configuration.h" |
33 #include "ui/events/test/event_generator.h" | 33 #include "ui/events/test/event_generator.h" |
34 #include "ui/gfx/geometry/insets.h" | 34 #include "ui/gfx/geometry/insets.h" |
35 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
36 | 36 |
37 namespace ash { | 37 namespace ash { |
38 namespace { | 38 namespace { |
39 | 39 |
40 const int kRootHeight = 600; | 40 const int kRootHeight = 600; |
41 | 41 |
(...skipping 769 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_manager(), | 821 display::test::CreateDisplayLayout(display_manager(), |
822 display::DisplayPlacement::BOTTOM, 0)); | 822 display::DisplayPlacement::BOTTOM, 0)); |
823 | 823 |
824 { | 824 { |
825 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); | 825 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); |
826 DCHECK_LT(window_->bounds().height(), | 826 DCHECK_LT(window_->bounds().height(), |
827 WorkspaceWindowResizer::kMinOnscreenHeight); | 827 WorkspaceWindowResizer::kMinOnscreenHeight); |
828 // 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. |
829 std::unique_ptr<WindowResizer> resizer( | 829 std::unique_ptr<WindowResizer> resizer( |
830 CreateResizerForTest(window_.get(), gfx::Point(10, 0), HTCAPTION)); | 830 CreateResizerForTest(window_.get(), gfx::Point(10, 0), HTCAPTION)); |
831 ASSERT_TRUE(resizer.get()); | 831 ASSERT_TRUE(resizer.get()); |
832 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... |
1881 touch_resize_window_->bounds().ToString()); | 1881 touch_resize_window_->bounds().ToString()); |
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), 5); | 1885 base::TimeDelta::FromMilliseconds(10), 5); |
1886 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1886 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
1887 touch_resize_window_->bounds().ToString()); | 1887 touch_resize_window_->bounds().ToString()); |
1888 } | 1888 } |
1889 | 1889 |
1890 } // namespace ash | 1890 } // namespace ash |
OLD | NEW |