| 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/toplevel_window_event_handler.h" | 5 #include "ash/wm/toplevel_window_event_handler.h" |
| 6 | 6 |
| 7 #include "ash/common/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
| 8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 EXPECT_EQ(old_bounds.ToString(), | 496 EXPECT_EQ(old_bounds.ToString(), |
| 497 window_state->GetRestoreBoundsInScreen().ToString()); | 497 window_state->GetRestoreBoundsInScreen().ToString()); |
| 498 } | 498 } |
| 499 | 499 |
| 500 // Tests that a gesture cannot minimize an unminimizeable window. | 500 // Tests that a gesture cannot minimize an unminimizeable window. |
| 501 TEST_F(ToplevelWindowEventHandlerTest, | 501 TEST_F(ToplevelWindowEventHandlerTest, |
| 502 GestureAttemptMinimizeUnminimizeableWindow) { | 502 GestureAttemptMinimizeUnminimizeableWindow) { |
| 503 std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); | 503 std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); |
| 504 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 504 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 505 target.get()); | 505 target.get()); |
| 506 gfx::Rect old_bounds = target->bounds(); | |
| 507 gfx::Point location(5, 5); | 506 gfx::Point location(5, 5); |
| 508 target->SetProperty(aura::client::kCanMaximizeKey, true); | 507 target->SetProperty(aura::client::kCanMaximizeKey, true); |
| 509 target->SetProperty(aura::client::kCanMinimizeKey, false); | 508 target->SetProperty(aura::client::kCanMinimizeKey, false); |
| 510 | 509 |
| 511 gfx::Point end = location; | 510 gfx::Point end = location; |
| 512 end.Offset(0, 100); | 511 end.Offset(0, 100); |
| 513 generator.GestureScrollSequence(location, end, | 512 generator.GestureScrollSequence(location, end, |
| 514 base::TimeDelta::FromMilliseconds(5), | 513 base::TimeDelta::FromMilliseconds(5), |
| 515 10); | 514 10); |
| 516 RunAllPendingInMessageLoop(); | 515 RunAllPendingInMessageLoop(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 | 590 |
| 592 // Tests that dragging multiple windows at the same time is not allowed. | 591 // Tests that dragging multiple windows at the same time is not allowed. |
| 593 TEST_F(ToplevelWindowEventHandlerTest, GestureDragMultipleWindows) { | 592 TEST_F(ToplevelWindowEventHandlerTest, GestureDragMultipleWindows) { |
| 594 std::unique_ptr<aura::Window> target(CreateTestWindowInShellWithDelegate( | 593 std::unique_ptr<aura::Window> target(CreateTestWindowInShellWithDelegate( |
| 595 new TestWindowDelegate(HTCAPTION), 0, gfx::Rect(0, 0, 100, 100))); | 594 new TestWindowDelegate(HTCAPTION), 0, gfx::Rect(0, 0, 100, 100))); |
| 596 std::unique_ptr<aura::Window> notmoved(CreateTestWindowInShellWithDelegate( | 595 std::unique_ptr<aura::Window> notmoved(CreateTestWindowInShellWithDelegate( |
| 597 new TestWindowDelegate(HTCAPTION), 1, gfx::Rect(100, 0, 100, 100))); | 596 new TestWindowDelegate(HTCAPTION), 1, gfx::Rect(100, 0, 100, 100))); |
| 598 | 597 |
| 599 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 598 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 600 target.get()); | 599 target.get()); |
| 601 gfx::Rect old_bounds = target->bounds(); | |
| 602 gfx::Point location(5, 5); | 600 gfx::Point location(5, 5); |
| 603 target->SetProperty(aura::client::kCanMaximizeKey, true); | 601 target->SetProperty(aura::client::kCanMaximizeKey, true); |
| 604 | 602 |
| 605 // Send some touch events to start dragging |target|. | 603 // Send some touch events to start dragging |target|. |
| 606 generator.MoveTouch(location); | 604 generator.MoveTouch(location); |
| 607 generator.PressTouch(); | 605 generator.PressTouch(); |
| 608 location.Offset(40, 5); | 606 location.Offset(40, 5); |
| 609 generator.MoveTouch(location); | 607 generator.MoveTouch(location); |
| 610 | 608 |
| 611 // Try to drag |notmoved| window. This should not move the window. | 609 // Try to drag |notmoved| window. This should not move the window. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 EXPECT_EQ(aura::client::MOVE_SUCCESSFUL, | 770 EXPECT_EQ(aura::client::MOVE_SUCCESSFUL, |
| 773 move_client->RunMoveLoop(window.get(), gfx::Vector2d(), | 771 move_client->RunMoveLoop(window.get(), gfx::Vector2d(), |
| 774 aura::client::WINDOW_MOVE_SOURCE_TOUCH)); | 772 aura::client::WINDOW_MOVE_SOURCE_TOUCH)); |
| 775 } | 773 } |
| 776 | 774 |
| 777 // Showing the resize shadows when the mouse is over the window edges is tested | 775 // Showing the resize shadows when the mouse is over the window edges is tested |
| 778 // in resize_shadow_and_cursor_test.cc | 776 // in resize_shadow_and_cursor_test.cc |
| 779 | 777 |
| 780 } // namespace test | 778 } // namespace test |
| 781 } // namespace ash | 779 } // namespace ash |
| OLD | NEW |