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 | 788 // Verifies that a direct call to ProcessedTouchEvent() does not cause a crash. |
789 // TOUCH_PRESSED event does not cause a crash. | |
790 TEST_F(WindowEventDispatcherTest, CallToProcessedTouchEvent) { | 789 TEST_F(WindowEventDispatcherTest, CallToProcessedTouchEvent) { |
791 test::TestWindowDelegate delegate; | 790 test::TestWindowDelegate delegate; |
792 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 791 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
793 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); | 792 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); |
794 | 793 |
795 ui::TouchEvent touch( | 794 host()->dispatcher()->ProcessedTouchEvent(window.get(), ui::ER_UNHANDLED); |
796 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1, ui::EventTimeForNow()); | |
797 host()->dispatcher()->ProcessedTouchEvent( | |
798 &touch, window.get(), ui::ER_UNHANDLED); | |
799 } | 795 } |
800 | 796 |
801 // This event handler requests the dispatcher to start holding pointer-move | 797 // This event handler requests the dispatcher to start holding pointer-move |
802 // events when it receives the first scroll-update gesture. | 798 // events when it receives the first scroll-update gesture. |
803 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { | 799 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { |
804 public: | 800 public: |
805 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, | 801 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, |
806 EventFilterRecorder* filter) | 802 EventFilterRecorder* filter) |
807 : dispatcher_(dispatcher), | 803 : dispatcher_(dispatcher), |
808 filter_(filter), | 804 filter_(filter), |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2277 ui::EF_LEFT_MOUSE_BUTTON); | 2273 ui::EF_LEFT_MOUSE_BUTTON); |
2278 DispatchEventUsingWindowDispatcher(&mouse); | 2274 DispatchEventUsingWindowDispatcher(&mouse); |
2279 EXPECT_TRUE(recorder_first.events().empty()); | 2275 EXPECT_TRUE(recorder_first.events().empty()); |
2280 ASSERT_EQ(1u, recorder_second.events().size()); | 2276 ASSERT_EQ(1u, recorder_second.events().size()); |
2281 EXPECT_EQ(ui::ET_MOUSE_PRESSED, recorder_second.events()[0]); | 2277 EXPECT_EQ(ui::ET_MOUSE_PRESSED, recorder_second.events()[0]); |
2282 EXPECT_EQ(event_location.ToString(), | 2278 EXPECT_EQ(event_location.ToString(), |
2283 recorder_second.mouse_locations()[0].ToString()); | 2279 recorder_second.mouse_locations()[0].ToString()); |
2284 } | 2280 } |
2285 | 2281 |
2286 } // namespace aura | 2282 } // namespace aura |
OLD | NEW |