| 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/common/ash_switches.h" | 7 #include "ash/common/ash_switches.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/common/wm_shell.h" |
| 15 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
| 16 #include "ash/public/cpp/shell_window_ids.h" | 17 #include "ash/public/cpp/shell_window_ids.h" |
| 17 #include "ash/screen_util.h" | 18 #include "ash/screen_util.h" |
| 18 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 19 #include "ash/test/ash_test_base.h" | 20 #include "ash/test/ash_test_base.h" |
| 20 #include "ash/wm/window_state_aura.h" | 21 #include "ash/wm/window_state_aura.h" |
| 21 #include "ash/wm/window_util.h" | 22 #include "ash/wm/window_util.h" |
| 22 #include "base/command_line.h" | 23 #include "base/command_line.h" |
| 23 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 ASSERT_TRUE(resizer.get()); | 791 ASSERT_TRUE(resizer.get()); |
| 791 resizer->Drag(CalculateDragPoint(*resizer, 0, 600), 0); | 792 resizer->Drag(CalculateDragPoint(*resizer, 0, 600), 0); |
| 792 int expected_y = | 793 int expected_y = |
| 793 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10; | 794 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10; |
| 794 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400", | 795 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400", |
| 795 window_->bounds().ToString()); | 796 window_->bounds().ToString()); |
| 796 } | 797 } |
| 797 | 798 |
| 798 // Makes sure we don't allow dragging on the work area with multidisplay. | 799 // Makes sure we don't allow dragging on the work area with multidisplay. |
| 799 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) { | 800 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) { |
| 801 // TODO: SetLayoutForCurrentDisplays() needs to ported to mash. |
| 802 // http://crbug.com/698043. |
| 803 if (WmShell::Get()->IsRunningInMash()) |
| 804 return; |
| 805 |
| 800 UpdateDisplay("800x600,800x600"); | 806 UpdateDisplay("800x600,800x600"); |
| 801 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); | 807 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); |
| 802 | 808 |
| 803 Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), | 809 Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), |
| 804 gfx::Insets(0, 0, 10, 0)); | 810 gfx::Insets(0, 0, 10, 0)); |
| 805 | 811 |
| 806 // Positions the secondary display at the bottom the primary display. | 812 // Positions the secondary display at the bottom the primary display. |
| 807 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 813 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| 808 display::test::CreateDisplayLayout(display_manager(), | 814 display::test::CreateDisplayLayout(display_manager(), |
| 809 display::DisplayPlacement::BOTTOM, 0)); | 815 display::DisplayPlacement::BOTTOM, 0)); |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 touch_resize_window_->bounds().ToString()); | 1874 touch_resize_window_->bounds().ToString()); |
| 1869 // Drag even more to snap to the edge. | 1875 // Drag even more to snap to the edge. |
| 1870 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1876 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
| 1871 gfx::Point(400, kRootHeight - 25), | 1877 gfx::Point(400, kRootHeight - 25), |
| 1872 base::TimeDelta::FromMilliseconds(10), 5); | 1878 base::TimeDelta::FromMilliseconds(10), 5); |
| 1873 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1879 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
| 1874 touch_resize_window_->bounds().ToString()); | 1880 touch_resize_window_->bounds().ToString()); |
| 1875 } | 1881 } |
| 1876 | 1882 |
| 1877 } // namespace ash | 1883 } // namespace ash |
| OLD | NEW |