| 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_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 } | 655 } |
| 656 } | 656 } |
| 657 | 657 |
| 658 // Verifies if the resizer sets and resets DisplayController::dont_warp_mouse_ | 658 // Verifies if the resizer sets and resets DisplayController::dont_warp_mouse_ |
| 659 // as expected. | 659 // as expected. |
| 660 TEST_F(WorkspaceWindowResizerTest, WarpMousePointer) { | 660 TEST_F(WorkspaceWindowResizerTest, WarpMousePointer) { |
| 661 DisplayController* controller = Shell::GetInstance()->display_controller(); | 661 DisplayController* controller = Shell::GetInstance()->display_controller(); |
| 662 ASSERT_TRUE(controller); | 662 ASSERT_TRUE(controller); |
| 663 window_->SetBounds(gfx::Rect(0, 0, 50, 60)); | 663 window_->SetBounds(gfx::Rect(0, 0, 50, 60)); |
| 664 | 664 |
| 665 EXPECT_FALSE(controller->dont_warp_mouse_); | 665 EXPECT_FALSE(controller->dont_warp_mouse_for_testing()); |
| 666 { | 666 { |
| 667 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 667 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 668 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); | 668 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); |
| 669 // While dragging a window, warp should be allowed. | 669 // While dragging a window, warp should be allowed. |
| 670 EXPECT_FALSE(controller->dont_warp_mouse_); | 670 EXPECT_FALSE(controller->dont_warp_mouse_for_testing()); |
| 671 resizer->CompleteDrag(0); | 671 resizer->CompleteDrag(0); |
| 672 } | 672 } |
| 673 EXPECT_FALSE(controller->dont_warp_mouse_); | 673 EXPECT_FALSE(controller->dont_warp_mouse_for_testing()); |
| 674 | 674 |
| 675 { | 675 { |
| 676 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 676 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 677 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); | 677 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); |
| 678 EXPECT_FALSE(controller->dont_warp_mouse_); | 678 EXPECT_FALSE(controller->dont_warp_mouse_for_testing()); |
| 679 resizer->RevertDrag(); | 679 resizer->RevertDrag(); |
| 680 } | 680 } |
| 681 EXPECT_FALSE(controller->dont_warp_mouse_); | 681 EXPECT_FALSE(controller->dont_warp_mouse_for_testing()); |
| 682 | 682 |
| 683 { | 683 { |
| 684 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 684 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 685 window_.get(), gfx::Point(), HTRIGHT, empty_windows())); | 685 window_.get(), gfx::Point(), HTRIGHT, empty_windows())); |
| 686 // While resizing a window, warp should NOT be allowed. | 686 // While resizing a window, warp should NOT be allowed. |
| 687 EXPECT_TRUE(controller->dont_warp_mouse_); | 687 EXPECT_TRUE(controller->dont_warp_mouse_for_testing()); |
| 688 resizer->CompleteDrag(0); | 688 resizer->CompleteDrag(0); |
| 689 } | 689 } |
| 690 EXPECT_FALSE(controller->dont_warp_mouse_); | 690 EXPECT_FALSE(controller->dont_warp_mouse_for_testing()); |
| 691 | 691 |
| 692 { | 692 { |
| 693 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 693 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 694 window_.get(), gfx::Point(), HTRIGHT, empty_windows())); | 694 window_.get(), gfx::Point(), HTRIGHT, empty_windows())); |
| 695 EXPECT_TRUE(controller->dont_warp_mouse_); | 695 EXPECT_TRUE(controller->dont_warp_mouse_for_testing()); |
| 696 resizer->RevertDrag(); | 696 resizer->RevertDrag(); |
| 697 } | 697 } |
| 698 EXPECT_FALSE(controller->dont_warp_mouse_); | 698 EXPECT_FALSE(controller->dont_warp_mouse_for_testing()); |
| 699 } | 699 } |
| 700 | 700 |
| 701 // Verifies windows are correctly restacked when reordering multiple windows. | 701 // Verifies windows are correctly restacked when reordering multiple windows. |
| 702 TEST_F(WorkspaceWindowResizerTest, RestackAttached) { | 702 TEST_F(WorkspaceWindowResizerTest, RestackAttached) { |
| 703 window_->SetBounds(gfx::Rect( 0, 0, 200, 300)); | 703 window_->SetBounds(gfx::Rect( 0, 0, 200, 300)); |
| 704 window2_->SetBounds(gfx::Rect(200, 0, 100, 200)); | 704 window2_->SetBounds(gfx::Rect(200, 0, 100, 200)); |
| 705 window3_->SetBounds(gfx::Rect(300, 0, 100, 100)); | 705 window3_->SetBounds(gfx::Rect(300, 0, 100, 100)); |
| 706 | 706 |
| 707 { | 707 { |
| 708 std::vector<aura::Window*> windows; | 708 std::vector<aura::Window*> windows; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 ASSERT_TRUE(resizer.get()); | 889 ASSERT_TRUE(resizer.get()); |
| 890 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, | 890 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, |
| 891 // the window should move to the exact position. | 891 // the window should move to the exact position. |
| 892 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); | 892 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); |
| 893 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); | 893 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); |
| 894 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); | 894 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); |
| 895 } | 895 } |
| 896 | 896 |
| 897 } // namespace test | 897 } // namespace test |
| 898 } // namespace ash | 898 } // namespace ash |
| OLD | NEW |