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 21895d2935c7f0150262eba792821ee9be57ca4a..6d75aedd09189aca8cabd2a36978d1e5e765e4c3 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc |
+++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc |
@@ -1936,6 +1936,45 @@ TEST_F(TouchEventQueueTest, AsyncTouchThrottledAfterScroll) { |
EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
} |
+TEST_F(TouchEventQueueTest, AsyncTouchDeferredDuringTouchAck) { |
+ SetTouchScrollingMode(TouchEventQueue::TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE); |
+ |
+ // Initiate scroll-induced touch throttling. |
+ PressTouchPoint(0, 0); |
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+ EXPECT_EQ(1U, GetAndResetSentEventCount()); |
+ EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
+ |
+ MoveTouchPoint(0, 0, 5); |
+ EXPECT_EQ(1U, queued_event_count()); |
+ EXPECT_EQ(1U, GetAndResetSentEventCount()); |
+ EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
+ SendGestureEvent(WebInputEvent::GestureScrollBegin); |
+ SendGestureEvent(WebInputEvent::GestureScrollUpdate); |
+ |
+ // Now queue a touchmove that exceeds the application slop region. |
+ MoveTouchPoint(0, 0, 20); |
+ EXPECT_FALSE(HasPendingAsyncTouchMove()); |
+ EXPECT_EQ(2U, queued_event_count()); |
+ EXPECT_EQ(0U, GetAndResetSentEventCount()); |
+ EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
+ |
+ // Despite the second touchmove exceeding the application slop region, its |
+ // sending will be deferred until after the original touch was ack'ed. |
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+ EXPECT_TRUE(HasPendingAsyncTouchMove()); |
+ EXPECT_EQ(0U, queued_event_count()); |
+ EXPECT_EQ(0U, GetAndResetSentEventCount()); |
+ EXPECT_EQ(2U, GetAndResetAckedEventCount()); |
+ |
+ // A subsequent touchmove will flush the deferred async touchmove, |
Rick Byers
2015/01/27 17:59:15
coalescing means it's more like 'replace' than 'fl
|
+ MoveTouchPoint(0, 0, 25); |
+ EXPECT_FALSE(HasPendingAsyncTouchMove()); |
+ EXPECT_FALSE(sent_event().cancelable); |
+ EXPECT_EQ(1U, GetAndResetSentEventCount()); |
+ EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
+} |
+ |
// Ensure that async touch dispatch and touch ack timeout interactions work |
// appropriately. |
TEST_F(TouchEventQueueTest, AsyncTouchWithAckTimeout) { |