Chromium Code Reviews| 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 80b0c9b57e4eed164fe47fee8de44ff14dc94d06..e7fe481cadc2b17bb4e5d2d4091fef62c29dd9cb 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,31 @@ TEST_F(GestureEventQueueTest, DebounceDropsDeferredEvents) { |
| } |
| } |
| +TEST_F(GestureEventQueueTest, CoalescesSyntheticScrollBeginEndEvents) { |
| + // Test coalescing of only GestureScrollBegin/End events. |
| + // Simulate gesture events. |
|
tdresser
2016/05/02 13:27:15
The previous line doesn't add much information.
dtapuska
2016/05/02 13:57:25
Done.
|
| + |
| + SimulateGestureEvent(WebInputEvent::GestureScrollUpdate, |
| + blink::WebGestureDeviceTouchpad); |
| + EXPECT_EQ(1U, GetAndResetSentGestureEventCount()); |
| + EXPECT_EQ(1U, GestureEventQueueSize()); |
| + |
| + WebGestureEvent synthetic_end = SyntheticWebGestureEventBuilder::Build( |
| + WebInputEvent::GestureScrollEnd, blink::WebGestureDeviceTouchpad); |
| + synthetic_end.data.scrollEnd.synthetic = true; |
| + |
| + SimulateGestureEvent(synthetic_end); |
| + EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
| + EXPECT_EQ(2U, GestureEventQueueSize()); |
| + |
| + // Synthetic begin will remove the unsent synthetic end. |
| + WebGestureEvent synthetic_begin = SyntheticWebGestureEventBuilder::Build( |
| + WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchpad); |
| + synthetic_begin.data.scrollBegin.synthetic = true; |
| + |
| + SimulateGestureEvent(synthetic_begin); |
| + EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
| + EXPECT_EQ(1U, GestureEventQueueSize()); |
| +} |
| + |
| } // namespace content |