Chromium Code Reviews| Index: 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 02de6385673292262e8ff6b9062ad02b3ed2413c..2477638989fac6ef30f42d494810c146084f1d6f 100644 |
| --- a/ui/aura/gestures/gesture_recognizer_unittest.cc |
| +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc |
| @@ -2939,6 +2939,56 @@ TEST_F(GestureRecognizerTest, GestureEventDoubleTap) { |
| EXPECT_EQ(2, delegate->tap_count()); |
| } |
| +// Check that appropriate touch events generate triple tap gesture events. |
| +TEST_F(GestureRecognizerTest, GestureEventTripleTap) { |
| + scoped_ptr<GestureEventConsumeDelegate> delegate( |
| + new GestureEventConsumeDelegate()); |
| + const int kWindowWidth = 123; |
| + const int kWindowHeight = 45; |
| + const int kTouchId = 2; |
| + gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
| + scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
| + delegate.get(), -1234, bounds, root_window())); |
| + TimedEvents tes; |
| + |
| + // First tap (tested in GestureEventTap) |
| + ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201), |
| + kTouchId, tes.Now()); |
| + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); |
| + ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201), |
| + kTouchId, tes.LeapForward(50)); |
| + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); |
| + delegate->Reset(); |
| + |
| + // Second tap (tested in GestureEventDoubleTap) |
| + ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 203), |
| + kTouchId, tes.LeapForward(200)); |
| + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); |
| + ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206), |
| + kTouchId, tes.LeapForward(50)); |
| + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); |
|
sadrul
2013/05/28 17:48:46
check tap_count here and after the first tap
Yufeng Shen (Slow to review)
2013/05/28 19:31:44
Done.
|
| + |
| + // Third tap |
| + ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(102, 206), |
| + kTouchId, tes.LeapForward(200)); |
| + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3); |
| + ui::TouchEvent release3(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206), |
| + kTouchId, tes.LeapForward(50)); |
| + root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release3); |
| + |
| + |
| + EXPECT_TRUE(delegate->tap()); |
| + EXPECT_TRUE(delegate->tap_down()); |
| + EXPECT_FALSE(delegate->tap_cancel()); |
| + EXPECT_TRUE(delegate->begin()); |
| + EXPECT_TRUE(delegate->end()); |
| + EXPECT_FALSE(delegate->scroll_begin()); |
| + EXPECT_FALSE(delegate->scroll_update()); |
| + EXPECT_FALSE(delegate->scroll_end()); |
| + |
| + EXPECT_EQ(3, delegate->tap_count()); |
| +} |
| + |
| // Check that we don't get a double tap when the two taps are far apart. |
| TEST_F(GestureRecognizerTest, TwoTapsFarApart) { |
| scoped_ptr<GestureEventConsumeDelegate> delegate( |