| 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 "ui/aura/root_window.h" | 5 #include "ui/aura/root_window.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 // Check that if the other message is another MOUSE_DRAGGED, we still coalesce | 665 // Check that if the other message is another MOUSE_DRAGGED, we still coalesce |
| 666 // them. | 666 // them. |
| 667 dispatcher()->HoldPointerMoves(); | 667 dispatcher()->HoldPointerMoves(); |
| 668 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); | 668 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
| 669 dispatcher()->ReleasePointerMoves(); | 669 dispatcher()->ReleasePointerMoves(); |
| 670 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); | 670 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); |
| 671 EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(filter->events())); | 671 EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(filter->events())); |
| 672 filter->Reset(); | 672 filter->Reset(); |
| 673 RunAllPendingInMessageLoop(); | 673 RunAllPendingInMessageLoop(); |
| 674 EXPECT_TRUE(filter->events().empty()); | 674 EXPECT_TRUE(filter->events().empty()); |
| 675 |
| 676 // Check that no events are synthesized while holding, and all held move |
| 677 // events are dropped on window changes. |
| 678 dispatcher()->HoldPointerMoves(); |
| 679 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
| 680 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); |
| 681 dispatcher()->OnWindowBoundsChanged(window.get(), true); |
| 682 RunAllPendingInMessageLoop(); |
| 683 EXPECT_TRUE(filter->events().empty()); |
| 684 dispatcher()->ReleasePointerMoves(); |
| 685 RunAllPendingInMessageLoop(); |
| 686 EXPECT_TRUE(filter->events().empty()); |
| 675 } | 687 } |
| 676 | 688 |
| 677 TEST_F(RootWindowTest, TouchMovesHeld) { | 689 TEST_F(RootWindowTest, TouchMovesHeld) { |
| 678 EventFilterRecorder* filter = new EventFilterRecorder; | 690 EventFilterRecorder* filter = new EventFilterRecorder; |
| 679 root_window()->SetEventFilter(filter); // passes ownership | 691 root_window()->SetEventFilter(filter); // passes ownership |
| 680 | 692 |
| 681 test::TestWindowDelegate delegate; | 693 test::TestWindowDelegate delegate; |
| 682 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 694 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
| 683 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); | 695 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); |
| 684 | 696 |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_SCROLL_END GESTURE_END", | 1737 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_SCROLL_END GESTURE_END", |
| 1726 EventTypesToString(events)); | 1738 EventTypesToString(events)); |
| 1727 ASSERT_EQ(2u, filter->touch_locations().size()); | 1739 ASSERT_EQ(2u, filter->touch_locations().size()); |
| 1728 EXPECT_EQ(gfx::Point(-40, 10).ToString(), | 1740 EXPECT_EQ(gfx::Point(-40, 10).ToString(), |
| 1729 filter->touch_locations()[0].ToString()); | 1741 filter->touch_locations()[0].ToString()); |
| 1730 EXPECT_EQ(gfx::Point(-40, 10).ToString(), | 1742 EXPECT_EQ(gfx::Point(-40, 10).ToString(), |
| 1731 filter->touch_locations()[1].ToString()); | 1743 filter->touch_locations()[1].ToString()); |
| 1732 } | 1744 } |
| 1733 | 1745 |
| 1734 } // namespace aura | 1746 } // namespace aura |
| OLD | NEW |