Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: ui/aura/gestures/gesture_recognizer_unittest.cc

Issue 10928066: Add GestureTapCancel gesture type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the gesture_event_filter portions of this change since we don't have the WebKit side yet Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 85dac461049c4b3d41c6f9bee2794e08f37d891c..8aaa21b5e4e00a7ebc24c9c413addf9ef48b76a6 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -36,6 +36,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
GestureEventConsumeDelegate()
: tap_(false),
tap_down_(false),
+ tap_cancel_(false),
begin_(false),
end_(false),
double_tap_(false),
@@ -66,6 +67,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
void Reset() {
tap_ = false;
tap_down_ = false;
+ tap_cancel_ = false;
begin_ = false;
end_ = false;
double_tap_ = false;
@@ -97,6 +99,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
bool tap() const { return tap_; }
bool tap_down() const { return tap_down_; }
+ bool tap_cancel() const { return tap_cancel_; }
bool begin() const { return begin_; }
bool end() const { return end_; }
bool double_tap() const { return double_tap_; }
@@ -144,6 +147,9 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
case ui::ET_GESTURE_TAP_DOWN:
tap_down_ = true;
break;
+ case ui::ET_GESTURE_TAP_CANCEL:
+ tap_cancel_ = true;
+ break;
case ui::ET_GESTURE_BEGIN:
begin_ = true;
break;
@@ -207,6 +213,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
private:
bool tap_;
bool tap_down_;
+ bool tap_cancel_;
bool begin_;
bool end_;
bool double_tap_;
@@ -453,6 +460,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -470,6 +478,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -502,6 +511,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -521,6 +531,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -546,6 +557,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -563,6 +575,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -588,7 +601,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -604,6 +619,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -621,6 +637,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -646,6 +663,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -662,6 +680,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -678,6 +697,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -694,6 +714,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -711,6 +732,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -744,6 +766,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -757,6 +780,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_TRUE(delegate->scroll_begin());
@@ -777,6 +801,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -789,6 +814,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -806,6 +832,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -1012,6 +1039,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
+ EXPECT_FALSE(delegate->tap_cancel());
// We haven't pressed long enough for a long press to occur
EXPECT_FALSE(delegate->long_press());
@@ -1020,12 +1048,16 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) {
gesture_sequence->ForceTimeout();
EXPECT_TRUE(delegate->long_press());
EXPECT_EQ(0, delegate->touch_id());
+ EXPECT_FALSE(delegate->tap_cancel());
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, GetTime());
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->long_press());
+
+ // Note the tap down isn't cancelled until the release
+ EXPECT_TRUE(delegate->tap_cancel());
}
// Check that scrolling cancels a long press
@@ -1056,18 +1088,21 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
// We haven't pressed long enough for a long press to occur
EXPECT_FALSE(delegate->long_press());
+ EXPECT_FALSE(delegate->tap_cancel());
// Scroll around, to cancel the long press
SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
// Wait until the timer runs out
gesture_sequence->ForceTimeout();
EXPECT_FALSE(delegate->long_press());
+ EXPECT_TRUE(delegate->tap_cancel());
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, GetTime());
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->long_press());
+ EXPECT_FALSE(delegate->tap_cancel());
}
// Check that second tap cancels a long press
@@ -1106,6 +1141,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
kTouchId2, GetTime());
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
// Wait until the timer runs out
@@ -1120,6 +1156,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->long_press());
EXPECT_TRUE(delegate->two_finger_tap());
+ EXPECT_FALSE(delegate->tap_cancel());
}
// Check that horizontal scroll gestures cause scrolls on horizontal rails.
@@ -1233,6 +1270,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1247,6 +1285,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1261,6 +1300,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1276,6 +1316,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
@@ -1290,6 +1331,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
@@ -1303,6 +1345,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
@@ -1317,6 +1360,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1343,6 +1387,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->begin());
EXPECT_FALSE(queued_delegate->double_tap());
EXPECT_FALSE(queued_delegate->scroll_begin());
@@ -1358,6 +1403,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->begin());
EXPECT_FALSE(queued_delegate->end());
EXPECT_FALSE(queued_delegate->double_tap());
@@ -1377,6 +1423,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->begin());
EXPECT_FALSE(queued_delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -1394,6 +1441,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
EXPECT_FALSE(queued_delegate->tap());
EXPECT_TRUE(queued_delegate->tap_down());
EXPECT_TRUE(queued_delegate->begin());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->end());
EXPECT_FALSE(queued_delegate->double_tap());
EXPECT_FALSE(queued_delegate->scroll_begin());
@@ -1405,6 +1453,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
queued_delegate->ReceivedAck();
EXPECT_TRUE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->begin());
EXPECT_TRUE(queued_delegate->end());
EXPECT_FALSE(queued_delegate->double_tap());
@@ -1420,6 +1469,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->begin());
EXPECT_FALSE(queued_delegate->end());
EXPECT_FALSE(queued_delegate->begin());
@@ -1436,6 +1486,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press4);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -1444,6 +1495,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
EXPECT_FALSE(delegate->scroll_end());
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->begin());
EXPECT_FALSE(queued_delegate->end());
EXPECT_FALSE(queued_delegate->double_tap());
@@ -1461,6 +1513,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -1468,6 +1521,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
EXPECT_FALSE(delegate->scroll_end());
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->begin());
EXPECT_FALSE(queued_delegate->double_tap());
EXPECT_FALSE(queued_delegate->scroll_begin());
@@ -1479,6 +1533,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
EXPECT_FALSE(queued_delegate->tap());
EXPECT_TRUE(queued_delegate->tap_down());
EXPECT_TRUE(queued_delegate->begin());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->end());
EXPECT_FALSE(queued_delegate->double_tap());
EXPECT_FALSE(queued_delegate->scroll_begin());
@@ -1489,6 +1544,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
queued_delegate->ReceivedAck();
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down()); // no touch down for second tap.
+ EXPECT_TRUE(queued_delegate->tap_cancel());
EXPECT_TRUE(queued_delegate->begin());
EXPECT_FALSE(queued_delegate->end());
EXPECT_FALSE(queued_delegate->double_tap());
@@ -1503,6 +1559,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
queued_delegate->ReceivedAck();
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
+ EXPECT_FALSE(queued_delegate->tap_cancel());
EXPECT_FALSE(queued_delegate->begin());
EXPECT_FALSE(queued_delegate->end());
EXPECT_FALSE(queued_delegate->double_tap());
@@ -1534,6 +1591,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1547,6 +1605,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
@@ -1560,6 +1619,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1575,6 +1635,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1591,6 +1652,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1608,6 +1670,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1623,6 +1686,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move5);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
@@ -1702,6 +1766,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1716,6 +1781,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1731,6 +1797,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1747,6 +1814,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1764,6 +1832,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1779,6 +1848,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move5);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
@@ -1939,6 +2009,7 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
delegate->Reset();
delegate->ReceivedAckPreventDefaulted();
EXPECT_FALSE(delegate->tap());
+ EXPECT_TRUE(delegate->tap_cancel());
}
TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
@@ -1970,6 +2041,7 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
// Ack the move event.
delegate->ReceivedAck();
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_TRUE(delegate->scroll_begin());
delegate->Reset();
@@ -2048,6 +2120,7 @@ TEST_F(GestureRecognizerTest, CaptureSendsGestureEnd) {
RunAllPendingInMessageLoop();
EXPECT_TRUE(delegate->end());
+ EXPECT_TRUE(delegate->tap_cancel());
}
TEST_F(GestureRecognizerTest, PressDoesNotCrash) {
@@ -2074,6 +2147,7 @@ TEST_F(GestureRecognizerTest, PressDoesNotCrash) {
// This new press should not generate a tap-down.
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->scroll_begin());
}
@@ -2118,6 +2192,7 @@ TEST_F(GestureRecognizerTest, SyncTouchEventWithQueuedTouchEvents) {
queued_delegate->ReceivedAck();
RunAllPendingInMessageLoop();
+ EXPECT_TRUE(queued_delegate->tap_cancel());
EXPECT_TRUE(queued_delegate->scroll_begin());
EXPECT_TRUE(queued_delegate->scroll_update());
EXPECT_TRUE(queued_delegate->scroll_end());
@@ -2141,6 +2216,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -2154,6 +2230,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -2171,6 +2248,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -2188,6 +2266,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -2205,6 +2284,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -2459,6 +2539,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -2472,6 +2553,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->double_tap());
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -2578,6 +2660,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -2586,10 +2669,14 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
// Move the touch-point enough so that it would normally be considered a
// scroll. But since the touch-moves will be consumed, the scroll should not
- // start.
+ // start. We should, however, get the TAP_CANCEL event now (since it's now
+ // impossible for the gesture to become a tap).
SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ // TODO(rbyers): Really we should get the TapCancel here instead of below,
+ // but this is a symptom of a larger issue: crbug.com/146397.
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -2601,6 +2688,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
SendScrollEvent(root_window(), 159, 259, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_TRUE(delegate->scroll_begin());
@@ -2620,6 +2708,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -2631,6 +2720,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->double_tap());
EXPECT_FALSE(delegate->scroll_begin());
@@ -2647,6 +2737,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->double_tap());
@@ -2688,6 +2779,7 @@ TEST_F(GestureRecognizerTest, GestureEventDoubleTap) {
EXPECT_TRUE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
EXPECT_TRUE(delegate->end());
EXPECT_TRUE(delegate->double_tap());
@@ -2731,6 +2823,7 @@ TEST_F(GestureRecognizerTest, TwoTapsFarApart) {
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->double_tap());
@@ -2775,6 +2868,7 @@ TEST_F(GestureRecognizerTest, TwoTapsWithDelayBetween) {
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->double_tap());
@@ -2830,6 +2924,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
move2.set_radius_y(60);
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
+ EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->pinch_update());

Powered by Google App Engine
This is Rietveld 408576698