Index: content/browser/renderer_host/input/gesture_event_queue_unittest.cc |
diff --git a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc |
index 3fbae1ec4d27295ca5aee28a1459164cfa0c11ea..2aaf0a6584469a17d0f9185849d9f0def329c5af 100644 |
--- a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc |
+++ b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc |
@@ -1156,4 +1156,38 @@ TEST_F(GestureEventQueueTest, DebounceDropsDeferredEvents) { |
} |
} |
+TEST_F(GestureEventQueueTest, RecycleDropsAllPendingEvents) { |
+ SetUpForDebounce(3); |
+ |
+ ASSERT_EQ(0U, GestureEventQueueSize()); |
+ |
+ SimulateGestureEvent(WebInputEvent::GestureScrollUpdate, |
+ blink::WebGestureDeviceTouchscreen); |
+ EXPECT_EQ(1U, GetAndResetSentGestureEventCount()); |
+ EXPECT_EQ(1U, GestureEventQueueSize()); |
+ EXPECT_EQ(0U, GestureEventDebouncingQueueSize()); |
+ EXPECT_TRUE(ScrollingInProgress()); |
+ |
+ SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
+ blink::WebGestureDeviceTouchscreen); |
+ EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
+ EXPECT_EQ(1U, GestureEventQueueSize()); |
+ EXPECT_EQ(1U, GestureEventDebouncingQueueSize()); |
+ |
+ // Recycling the queue should clear all pending events and reset the state. |
+ queue()->Recycle(); |
+ EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
+ EXPECT_EQ(0U, GestureEventQueueSize()); |
+ EXPECT_EQ(0U, GestureEventDebouncingQueueSize()); |
+ EXPECT_FALSE(ScrollingInProgress()); |
+ |
+ // Subsequent events should work properly. |
+ SimulateGestureEvent(WebInputEvent::GestureScrollUpdate, |
+ blink::WebGestureDeviceTouchscreen); |
+ EXPECT_EQ(1U, GetAndResetSentGestureEventCount()); |
+ EXPECT_EQ(1U, GestureEventQueueSize()); |
+ EXPECT_EQ(0U, GestureEventDebouncingQueueSize()); |
+ EXPECT_TRUE(ScrollingInProgress()); |
+} |
+ |
} // namespace content |