| 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" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 14 #include "ash/test/display_manager_test_api.h" | 14 #include "ash/test/display_manager_test_api.h" |
| 15 #include "ash/wm/window_state.h" | 15 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
| 17 #include "ash/wm/wm_event.h" | 17 #include "ash/wm/wm_event.h" |
| 18 #include "ash/wm/workspace/phantom_window_controller.h" | 18 #include "ash/wm/workspace/phantom_window_controller.h" |
| 19 #include "ash/wm/workspace_controller.h" | 19 #include "ash/wm/workspace_controller.h" |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
| 24 #include "ui/aura/test/test_window_delegate.h" | 24 #include "ui/aura/test/test_window_delegate.h" |
| 25 #include "ui/aura/window_event_dispatcher.h" | 25 #include "ui/aura/window_event_dispatcher.h" |
| 26 #include "ui/base/hit_test.h" | 26 #include "ui/base/hit_test.h" |
| 27 #include "ui/display/manager/display_layout.h" |
| 27 #include "ui/events/gesture_detection/gesture_configuration.h" | 28 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 28 #include "ui/events/test/event_generator.h" | 29 #include "ui/events/test/event_generator.h" |
| 29 #include "ui/gfx/geometry/insets.h" | 30 #include "ui/gfx/geometry/insets.h" |
| 30 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
| 31 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| 32 | 33 |
| 33 namespace ash { | 34 namespace ash { |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 const int kRootHeight = 600; | 37 const int kRootHeight = 600; |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 return; | 816 return; |
| 816 | 817 |
| 817 UpdateDisplay("800x600,800x600"); | 818 UpdateDisplay("800x600,800x600"); |
| 818 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); | 819 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); |
| 819 | 820 |
| 820 Shell::GetInstance()->SetDisplayWorkAreaInsets( | 821 Shell::GetInstance()->SetDisplayWorkAreaInsets( |
| 821 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); | 822 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); |
| 822 | 823 |
| 823 // Positions the secondary display at the bottom the primary display. | 824 // Positions the secondary display at the bottom the primary display. |
| 824 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 825 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| 825 test::CreateDisplayLayout(ash::DisplayPlacement::BOTTOM, 0)); | 826 test::CreateDisplayLayout(display::DisplayPlacement::BOTTOM, 0)); |
| 826 | 827 |
| 827 { | 828 { |
| 828 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); | 829 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); |
| 829 DCHECK_LT(window_->bounds().height(), | 830 DCHECK_LT(window_->bounds().height(), |
| 830 WorkspaceWindowResizer::kMinOnscreenHeight); | 831 WorkspaceWindowResizer::kMinOnscreenHeight); |
| 831 // Drag down avoiding dragging along the edge as that would side-snap. | 832 // Drag down avoiding dragging along the edge as that would side-snap. |
| 832 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( | 833 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( |
| 833 window_.get(), gfx::Point(10, 0), HTCAPTION)); | 834 window_.get(), gfx::Point(10, 0), HTCAPTION)); |
| 834 ASSERT_TRUE(resizer.get()); | 835 ASSERT_TRUE(resizer.get()); |
| 835 resizer->Drag(CalculateDragPoint(*resizer, 0, 400), 0); | 836 resizer->Drag(CalculateDragPoint(*resizer, 0, 400), 0); |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 // Drag even more to snap to the edge. | 1884 // Drag even more to snap to the edge. |
| 1884 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1885 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
| 1885 gfx::Point(400, kRootHeight - 25), | 1886 gfx::Point(400, kRootHeight - 25), |
| 1886 base::TimeDelta::FromMilliseconds(10), | 1887 base::TimeDelta::FromMilliseconds(10), |
| 1887 5); | 1888 5); |
| 1888 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1889 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
| 1889 touch_resize_window_->bounds().ToString()); | 1890 touch_resize_window_->bounds().ToString()); |
| 1890 } | 1891 } |
| 1891 | 1892 |
| 1892 } // namespace ash | 1893 } // namespace ash |
| OLD | NEW |