From 756767450156ac5de94caaa9c92ac54c4dd7fdb7 Mon Sep 17 00:00:00 2001 From: "sadrul@chromium.org" Date: Wed, 6 Feb 2013 22:04:53 +0000 Subject: aura-x11: Make sure the touch event with the native event gets dispatched. BUG=none Review URL: https://codereview.chromium.org/12211048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181062 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/aura/gestures/gesture_recognizer_unittest.cc | 52 ++++++++++++++----------- 1 file changed, 30 insertions(+), 22 deletions(-) (limited to 'ui/aura/gestures/gesture_recognizer_unittest.cc') diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc index 433fb93..48ede7a 100644 --- a/ui/aura/gestures/gesture_recognizer_unittest.cc +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc @@ -2074,34 +2074,42 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) { delegate.get(), -1234, bounds, root_window())); delegate->set_window(window.get()); - delegate->Reset(); + { + delegate->Reset(); + ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(15, 25), kTouchId1, + tes.Now()); + ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 95), kTouchId1, + tes.LeapForward(200)); + ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(15, 25), kTouchId1, + tes.LeapForward(50)); + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + delegate->Reset(); + + // Ack the press event. + delegate->ReceivedAck(); + EXPECT_TRUE(delegate->tap_down()); + delegate->Reset(); + + // Ack the move event. + delegate->ReceivedAck(); + EXPECT_TRUE(delegate->tap_cancel()); + EXPECT_TRUE(delegate->scroll_begin()); + delegate->Reset(); + + // Ack the release event. Although the release event has been processed, it + // should still generate a scroll-end event. + delegate->ReceivedAckPreventDefaulted(); + EXPECT_TRUE(delegate->scroll_end()); + } + ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(15, 25), kTouchId1, tes.Now()); ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 95), kTouchId1, tes.LeapForward(200)); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(15, 25), kTouchId1, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); - delegate->Reset(); - - // Ack the press event. - delegate->ReceivedAck(); - EXPECT_TRUE(delegate->tap_down()); - delegate->Reset(); - - // Ack the move event. - delegate->ReceivedAck(); - EXPECT_TRUE(delegate->tap_cancel()); - EXPECT_TRUE(delegate->scroll_begin()); - delegate->Reset(); - - // Ack the release event. Although the release event has been processed, it - // should still generate a scroll-end event. - delegate->ReceivedAckPreventDefaulted(); - EXPECT_TRUE(delegate->scroll_end()); - ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(55, 25), kTouchId2, tes.Now()); ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(45, 85), kTouchId2, -- cgit v1.1