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

Unified Diff: content/browser/renderer_host/input/touch_event_queue_unittest.cc

Issue 394523004: Revert of Don't treat first touch move differently from future touch moves (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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: content/browser/renderer_host/input/touch_event_queue_unittest.cc
diff --git a/content/browser/renderer_host/input/touch_event_queue_unittest.cc b/content/browser/renderer_host/input/touch_event_queue_unittest.cc
index da1b05cac310348d9b6acdd9d38e0c6a1e05e518..06a3a9f40f3e1113a1341b17228683afe45f76b6 100644
--- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc
+++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc
@@ -859,28 +859,15 @@
EXPECT_EQ(1U, queued_event_count());
EXPECT_EQ(1U, GetAndResetSentEventCount());
- MoveTouchPoint(0, 30, 15);
- EXPECT_EQ(2U, queued_event_count());
- EXPECT_EQ(0U, GetAndResetSentEventCount());
-
// Queue another TouchStart.
PressTouchPoint(20, 20);
- EXPECT_EQ(3U, queued_event_count());
+ EXPECT_EQ(2U, queued_event_count());
EXPECT_EQ(0U, GetAndResetSentEventCount());
EXPECT_EQ(WebInputEvent::TouchStart, latest_event().type);
+ // GestureScrollBegin inserts a synthetic TouchCancel before the TouchStart.
WebGestureEvent followup_scroll;
followup_scroll.type = WebInputEvent::GestureScrollBegin;
- SetFollowupEvent(followup_scroll);
- SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(1U, GetAndResetSentEventCount());
- EXPECT_EQ(1U, GetAndResetAckedEventCount());
- EXPECT_EQ(2U, queued_event_count());
- EXPECT_TRUE(sent_event().cancelable);
- EXPECT_EQ(WebInputEvent::TouchMove, sent_event().type);
-
- // GestureScrollUpdate inserts a synthetic TouchCancel before the TouchStart.
- followup_scroll.type = WebInputEvent::GestureScrollUpdate;
SetFollowupEvent(followup_scroll);
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(1U, GetAndResetSentEventCount());
@@ -1730,7 +1717,8 @@
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(1U, GetAndResetAckedEventCount());
- // Now send the first touch move and associated GestureScrollBegin.
+ // Now send the first touch move and associated GestureScrollBegin,
+ // but don't ACK the gesture event yet.
MoveTouchPoint(0, 0, 5);
WebGestureEvent followup_scroll;
followup_scroll.type = WebInputEvent::GestureScrollBegin;
@@ -1738,17 +1726,6 @@
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(1U, GetAndResetSentEventCount());
EXPECT_EQ(1U, GetAndResetAckedEventCount());
- SendGestureEventAck(WebInputEvent::GestureScrollBegin,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
-
- // Send the second touch move and associated GestureScrollUpdate, but don't
- // ACK the gesture event yet.
- MoveTouchPoint(0, 0, 5);
- followup_scroll.type = WebInputEvent::GestureScrollUpdate;
- SetFollowupEvent(followup_scroll);
- SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(1U, GetAndResetSentEventCount());
- EXPECT_EQ(1U, GetAndResetAckedEventCount());
// Now queue a second touchmove and verify it's not (yet) dispatched.
MoveTouchPoint(0, 0, 10);
@@ -1783,7 +1760,7 @@
// Now mark the scroll as not consumed (which would cause future
// touchmoves in the active sequence to be sent if there was one).
- SendGestureEventAck(WebInputEvent::GestureScrollUpdate,
+ SendGestureEventAck(WebInputEvent::GestureScrollBegin,
INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
// Start a new touch sequence and verify that throttling has been reset.
@@ -1793,19 +1770,10 @@
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(1U, GetAndResetAckedEventCount());
MoveTouchPoint(0, 0, 5);
- followup_scroll.type = WebInputEvent::GestureScrollBegin;
SetFollowupEvent(followup_scroll);
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(1U, GetAndResetSentEventCount());
EXPECT_EQ(1U, GetAndResetAckedEventCount());
-
- MoveTouchPoint(0, 0, 5);
- followup_scroll.type = WebInputEvent::GestureScrollUpdate;
- SetFollowupEvent(followup_scroll);
- SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(1U, GetAndResetSentEventCount());
- EXPECT_EQ(1U, GetAndResetAckedEventCount());
-
MoveTouchPoint(0, 0, 10);
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_TRUE(HasPendingAsyncTouchMove());
@@ -2024,8 +1992,6 @@
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(1U, GetAndResetAckedEventCount());
EXPECT_EQ(0U, queued_event_count());
-
- SendGestureEvent(WebInputEvent::GestureScrollUpdate);
// The async touchmove should be ack'ed immediately, but not forwarded.
// However, because the ack triggers a touchcancel, both the pending touch and
@@ -2044,7 +2010,7 @@
EXPECT_EQ(1U, GetAndResetAckedEventCount());
EXPECT_EQ(1U, GetAndResetSentEventCount());
- // The ack for the async touchmove should not reach the client, as it has
+ // The ack for the asnc touchmove should not reach the client, as it has
// already been ack'ed.
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_FALSE(sent_event().cancelable);
@@ -2060,45 +2026,4 @@
EXPECT_EQ(0U, GetAndResetSentEventCount());
}
-TEST_F(TouchEventQueueTest, TouchAbsorptionWithConsumedFirstMove) {
- SetTouchScrollingMode(TouchEventQueue::TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE);
-
- // Queue a TouchStart.
- PressTouchPoint(0, 1);
- SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(0U, queued_event_count());
- EXPECT_EQ(1U, GetAndResetAckedEventCount());
-
- MoveTouchPoint(0, 20, 5);
- SendGestureEvent(blink::WebInputEvent::GestureScrollBegin);
- SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
- EXPECT_EQ(0U, queued_event_count());
- EXPECT_EQ(2U, GetAndResetSentEventCount());
-
- // Even if the first touchmove event was consumed, subsequent unconsumed
- // touchmove events should trigger scrolling.
- MoveTouchPoint(0, 60, 5);
- SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
- EXPECT_EQ(0U, queued_event_count());
- EXPECT_TRUE(sent_event().cancelable);
- EXPECT_EQ(1U, GetAndResetSentEventCount());
-
- MoveTouchPoint(0, 20, 5);
- WebGestureEvent followup_scroll;
- followup_scroll.type = WebInputEvent::GestureScrollUpdate;
- SetFollowupEvent(followup_scroll);
- SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- SendGestureEventAck(WebInputEvent::GestureScrollUpdate,
- INPUT_EVENT_ACK_STATE_CONSUMED);
- EXPECT_EQ(0U, queued_event_count());
- EXPECT_TRUE(sent_event().cancelable);
- EXPECT_EQ(1U, GetAndResetSentEventCount());
-
- MoveTouchPoint(0, 60, 5);
- SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
- EXPECT_EQ(0U, queued_event_count());
- EXPECT_FALSE(sent_event().cancelable);
- EXPECT_EQ(1U, GetAndResetSentEventCount());
-}
-
} // namespace content
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.cc ('k') | ui/aura/gestures/gesture_recognizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698