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

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

Issue 628763003: Support InputRouter recycling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 2 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/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

Powered by Google App Engine
This is Rietveld 408576698