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

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

Issue 228973003: Don't treat first touch move differently from future touch moves (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests. Created 6 years, 6 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 d2c150b5ee61b76b81a01e30d42f6ef859e26c56..9ac2db522cc99c79bdb0bec05196a07af7b83a9f 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -2091,7 +2091,8 @@ scoped_ptr<GestureEventConsumeDelegate> delegate(
}
TEST_P(GestureRecognizerTest, GestureEventPinchFromTap) {
- // TODO(tdresser): enable this test with unified GR once two finger tap.
+ // Disabled under unified gesture recognizer due to behavior differences in
+ // scroll and bounding box behavior.
if (UsingUnifiedGR())
return;
@@ -3137,10 +3138,16 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
- EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
+ // With the unified gesture detector, consuming the first touch move event
+ // won't prevent all future scrolling.
+ if (UsingUnifiedGR())
+ EXPECT_TRUE(delegate->scroll_begin());
+ else
+ EXPECT_FALSE(delegate->scroll_begin());
+
// Release the touch back at the start point. This should end without causing
// a tap.
delegate->Reset();
@@ -3154,7 +3161,11 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
- EXPECT_FALSE(delegate->scroll_end());
+
+ if (UsingUnifiedGR())
+ EXPECT_TRUE(delegate->scroll_end());
+ else
+ EXPECT_FALSE(delegate->scroll_end());
}
// Tests the behavior of 2F scroll when all the touch-move events are consumed.
@@ -3301,10 +3312,16 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
- EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
+ // With the unified gesture detector, consuming the first touch move event
+ // won't prevent all future scrolling.
+ if (UsingUnifiedGR())
+ EXPECT_TRUE(delegate->scroll_begin());
+ else
+ EXPECT_FALSE(delegate->scroll_begin());
+
// Now, stop consuming touch-move events, and move the touch-point again.
delegate->set_consume_touch_move(false);
tes.SendScrollEvent(event_processor(), 159, 259, kTouchId, delegate.get());
@@ -3313,13 +3330,23 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->scroll_begin());
- EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
- // No scroll has occurred, because an early touch move was consumed.
- EXPECT_EQ(0, delegate->scroll_x());
- EXPECT_EQ(0, delegate->scroll_y());
- EXPECT_EQ(gfx::Point(0, 0).ToString(),
- delegate->scroll_begin_position().ToString());
+
+ if (UsingUnifiedGR()) {
+ // Scroll not prevented by consumed first touch move.
+ EXPECT_TRUE(delegate->scroll_update());
+ EXPECT_EQ(29, delegate->scroll_x());
+ EXPECT_EQ(29, delegate->scroll_y());
+ EXPECT_EQ(gfx::Point(0, 0).ToString(),
+ delegate->scroll_begin_position().ToString());
+ } else {
+ EXPECT_FALSE(delegate->scroll_update());
+ // No scroll has occurred, because an early touch move was consumed.
+ EXPECT_EQ(0, delegate->scroll_x());
+ EXPECT_EQ(0, delegate->scroll_y());
+ EXPECT_EQ(gfx::Point(0, 0).ToString(),
+ delegate->scroll_begin_position().ToString());
+ }
// Start consuming touch-move events again.
delegate->set_consume_touch_move(true);
@@ -3359,8 +3386,12 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
- EXPECT_FALSE(delegate->scroll_end());
EXPECT_FALSE(delegate->fling());
+
+ if (UsingUnifiedGR())
+ EXPECT_TRUE(delegate->scroll_end());
+ else
+ EXPECT_FALSE(delegate->scroll_end());
}
// Check that appropriate touch events generate double tap gesture events.
@@ -3698,14 +3729,15 @@ TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) {
delegate->set_consume_touch_move(true);
delegate->Reset();
// 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.
+ // scroll. But since the touch-moves will be consumed, no scrolling should
+ // occur.
+ // With the unified gesture detector, we will receive a scroll begin gesture,
+ // whereas with the aura gesture recognizer we won't.
tes.SendScrollEvent(event_processor(), 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->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
}
@@ -3904,8 +3936,15 @@ TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) {
DispatchEventUsingWindowDispatcher(&move2);
delegate->ReceivedAck();
- EXPECT_FALSE(delegate->scroll_begin());
- EXPECT_FALSE(delegate->scroll_update());
+ if (UsingUnifiedGR()) {
+ // With the unified gesture detector, consuming the first touch move event
+ // won't prevent all future scrolling.
+ EXPECT_TRUE(delegate->scroll_begin());
+ EXPECT_TRUE(delegate->scroll_update());
+ } else {
+ EXPECT_FALSE(delegate->scroll_begin());
+ EXPECT_FALSE(delegate->scroll_update());
+ }
}
// Test that consuming the first touch move event of a touch point doesn't

Powered by Google App Engine
This is Rietveld 408576698