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/public/cpp/config.h" |
7 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
9 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
10 #include "ash/shelf/wm_shelf.h" | 11 #include "ash/shelf/wm_shelf.h" |
11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
12 #include "ash/shell_port.h" | |
13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
14 #include "ash/wm/window_positioning_utils.h" | 14 #include "ash/wm/window_positioning_utils.h" |
15 #include "ash/wm/window_state.h" | 15 #include "ash/wm/window_state.h" |
16 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
17 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
18 #include "ash/wm/wm_event.h" | 18 #include "ash/wm/wm_event.h" |
19 #include "ash/wm/workspace/phantom_window_controller.h" | 19 #include "ash/wm/workspace/phantom_window_controller.h" |
20 #include "ash/wm/workspace_controller.h" | 20 #include "ash/wm/workspace_controller.h" |
21 #include "ash/wm_window.h" | 21 #include "ash/wm_window.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 EXPECT_EQ("0,0 200x100", window_->bounds().ToString()); | 491 EXPECT_EQ("0,0 200x100", window_->bounds().ToString()); |
492 EXPECT_EQ("10,100 200x266", window2_->bounds().ToString()); | 492 EXPECT_EQ("10,100 200x266", window2_->bounds().ToString()); |
493 EXPECT_EQ("20,366 100x134", window3_->bounds().ToString()); | 493 EXPECT_EQ("20,366 100x134", window3_->bounds().ToString()); |
494 } | 494 } |
495 | 495 |
496 // Tests that touch-dragging a window does not lock the mouse cursor | 496 // Tests that touch-dragging a window does not lock the mouse cursor |
497 // and therefore shows the cursor on a mousemove. | 497 // and therefore shows the cursor on a mousemove. |
498 TEST_F(WorkspaceWindowResizerTest, MouseMoveWithTouchDrag) { | 498 TEST_F(WorkspaceWindowResizerTest, MouseMoveWithTouchDrag) { |
499 // TODO: fails because mash doesn't support CursorManager. | 499 // TODO: fails because mash doesn't support CursorManager. |
500 // http://crbug.com/631103. | 500 // http://crbug.com/631103. |
501 if (ShellPort::Get()->IsRunningInMash()) | 501 if (Shell::GetAshConfig() == Config::MASH) |
502 return; | 502 return; |
503 | 503 |
504 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); | 504 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); |
505 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); | 505 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); |
506 | 506 |
507 Shell* shell = Shell::Get(); | 507 Shell* shell = Shell::Get(); |
508 ui::test::EventGenerator generator(window_->GetRootWindow()); | 508 ui::test::EventGenerator generator(window_->GetRootWindow()); |
509 | 509 |
510 // The cursor should not be locked initially. | 510 // The cursor should not be locked initially. |
511 EXPECT_FALSE(shell->cursor_manager()->IsCursorLocked()); | 511 EXPECT_FALSE(shell->cursor_manager()->IsCursorLocked()); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 int expected_y = | 795 int expected_y = |
796 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10; | 796 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10; |
797 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400", | 797 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400", |
798 window_->bounds().ToString()); | 798 window_->bounds().ToString()); |
799 } | 799 } |
800 | 800 |
801 // Makes sure we don't allow dragging on the work area with multidisplay. | 801 // Makes sure we don't allow dragging on the work area with multidisplay. |
802 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) { | 802 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) { |
803 // TODO: SetLayoutForCurrentDisplays() needs to ported to mash. | 803 // TODO: SetLayoutForCurrentDisplays() needs to ported to mash. |
804 // http://crbug.com/698043. | 804 // http://crbug.com/698043. |
805 if (ShellPort::Get()->IsRunningInMash()) | 805 if (Shell::GetAshConfig() == Config::MASH) |
806 return; | 806 return; |
807 | 807 |
808 UpdateDisplay("800x600,800x600"); | 808 UpdateDisplay("800x600,800x600"); |
809 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); | 809 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); |
810 | 810 |
811 Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), | 811 Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), |
812 gfx::Insets(0, 0, 10, 0)); | 812 gfx::Insets(0, 0, 10, 0)); |
813 | 813 |
814 // Positions the secondary display at the bottom the primary display. | 814 // Positions the secondary display at the bottom the primary display. |
815 Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( | 815 Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 touch_resize_window_->bounds().ToString()); | 1865 touch_resize_window_->bounds().ToString()); |
1866 // Drag even more to snap to the edge. | 1866 // Drag even more to snap to the edge. |
1867 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1867 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
1868 gfx::Point(400, kRootHeight - 25), | 1868 gfx::Point(400, kRootHeight - 25), |
1869 base::TimeDelta::FromMilliseconds(10), 5); | 1869 base::TimeDelta::FromMilliseconds(10), 5); |
1870 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1870 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
1871 touch_resize_window_->bounds().ToString()); | 1871 touch_resize_window_->bounds().ToString()); |
1872 } | 1872 } |
1873 | 1873 |
1874 } // namespace ash | 1874 } // namespace ash |
OLD | NEW |