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/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 DispatchEventUsingWindowDispatcher(&touch_moved_event3); | 778 DispatchEventUsingWindowDispatcher(&touch_moved_event3); |
779 DispatchEventUsingWindowDispatcher(&touch_released_event); | 779 DispatchEventUsingWindowDispatcher(&touch_released_event); |
780 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_TAP GESTURE_END", | 780 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_TAP GESTURE_END", |
781 EventTypesToString(recorder.events())); | 781 EventTypesToString(recorder.events())); |
782 recorder.Reset(); | 782 recorder.Reset(); |
783 host()->dispatcher()->ReleasePointerMoves(); | 783 host()->dispatcher()->ReleasePointerMoves(); |
784 RunAllPendingInMessageLoop(); | 784 RunAllPendingInMessageLoop(); |
785 EXPECT_TRUE(recorder.events().empty()); | 785 EXPECT_TRUE(recorder.events().empty()); |
786 } | 786 } |
787 | 787 |
| 788 // Verifies that a direct call to ProcessedTouchEvent() with a |
| 789 // TOUCH_PRESSED event does not cause a crash. |
| 790 TEST_F(WindowEventDispatcherTest, CallToProcessedTouchEvent) { |
| 791 test::TestWindowDelegate delegate; |
| 792 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
| 793 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); |
| 794 |
| 795 ui::TouchEvent touch( |
| 796 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1, ui::EventTimeForNow()); |
| 797 host()->dispatcher()->ProcessedTouchEvent( |
| 798 &touch, window.get(), ui::ER_UNHANDLED); |
| 799 } |
| 800 |
788 // This event handler requests the dispatcher to start holding pointer-move | 801 // This event handler requests the dispatcher to start holding pointer-move |
789 // events when it receives the first scroll-update gesture. | 802 // events when it receives the first scroll-update gesture. |
790 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { | 803 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { |
791 public: | 804 public: |
792 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, | 805 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, |
793 EventFilterRecorder* filter) | 806 EventFilterRecorder* filter) |
794 : dispatcher_(dispatcher), | 807 : dispatcher_(dispatcher), |
795 filter_(filter), | 808 filter_(filter), |
796 holding_moves_(false) {} | 809 holding_moves_(false) {} |
797 virtual ~HoldPointerOnScrollHandler() {} | 810 virtual ~HoldPointerOnScrollHandler() {} |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2264 ui::EF_LEFT_MOUSE_BUTTON); | 2277 ui::EF_LEFT_MOUSE_BUTTON); |
2265 DispatchEventUsingWindowDispatcher(&mouse); | 2278 DispatchEventUsingWindowDispatcher(&mouse); |
2266 EXPECT_TRUE(recorder_first.events().empty()); | 2279 EXPECT_TRUE(recorder_first.events().empty()); |
2267 ASSERT_EQ(1u, recorder_second.events().size()); | 2280 ASSERT_EQ(1u, recorder_second.events().size()); |
2268 EXPECT_EQ(ui::ET_MOUSE_PRESSED, recorder_second.events()[0]); | 2281 EXPECT_EQ(ui::ET_MOUSE_PRESSED, recorder_second.events()[0]); |
2269 EXPECT_EQ(event_location.ToString(), | 2282 EXPECT_EQ(event_location.ToString(), |
2270 recorder_second.mouse_locations()[0].ToString()); | 2283 recorder_second.mouse_locations()[0].ToString()); |
2271 } | 2284 } |
2272 | 2285 |
2273 } // namespace aura | 2286 } // namespace aura |
OLD | NEW |