Chromium Code Reviews| 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 01865db4dbfbf1a8e4174e01d54c5817d18cb1ff..206b6a84b7a76d3129a3bf11850cef96c751f2c5 100644 |
| --- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc |
| +++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc |
| @@ -235,6 +235,10 @@ class TouchEventQueueTest : public testing::Test, |
| SendTouchEvent(); |
| } |
| + void PrependTouchScrollNotification() { |
| + queue_->PrependTouchScrollNotification(); |
| + } |
| + |
| void AdvanceTouchTime(double seconds) { |
| touch_event_.timeStampSeconds += seconds; |
| } |
| @@ -2617,4 +2621,54 @@ TEST_F(TouchEventQueueTest, FilterTouchMovesWhenNoPointerChanged) { |
| EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| } |
| +// Tests that touch-scroll-notification event is placed at the correct position |
| +// in the queue. |
| +TEST_F(TouchEventQueueTest, TouchScrollNotificationOrder) { |
|
tdresser
2016/04/01 14:50:24
Aren't there a few cases we should test?
1. Queue
mustaq
2016/04/01 18:31:05
Added all, including #2 where the notification is
|
| + PressTouchPoint(1, 1); |
| + MoveTouchPoint(0, 5, 5); |
| + ReleaseTouchPoint(0); |
| + |
| + EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
| + EXPECT_EQ(3U, queued_event_count()); |
| + |
| + // Send the touch-scroll-notification when 3 events are in the queue. |
| + PrependTouchScrollNotification(); |
| + |
| + EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
| + EXPECT_EQ(4U, queued_event_count()); |
| + |
| + // Receive an ACK for the touchstart. |
| + SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); |
| + |
| + EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| + EXPECT_EQ(WebInputEvent::TouchStart, acked_event().type); |
| + EXPECT_EQ(3U, queued_event_count()); |
| + |
| + // Receive an ACK for the touch-scroll-notification. |
| + SendTouchEventAck(INPUT_EVENT_ACK_STATE_IGNORED); |
| + |
| + EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
| + EXPECT_EQ(2U, queued_event_count()); |
| + |
| + // Receive an ACK for the touchmove. |
| + SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); |
| + |
| + EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| + EXPECT_EQ(WebInputEvent::TouchMove, acked_event().type); |
| + EXPECT_EQ(1U, queued_event_count()); |
| + |
| + // Receive an ACK for the touchend. |
| + SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); |
| + |
| + EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| + EXPECT_EQ(WebInputEvent::TouchEnd, acked_event().type); |
| + EXPECT_EQ(0U, queued_event_count()); |
| + |
| + EXPECT_EQ(4U, all_sent_events().size()); |
| + EXPECT_EQ(WebInputEvent::TouchStart, all_sent_events()[0].type); |
| + EXPECT_EQ(WebInputEvent::TouchScrollStarted, all_sent_events()[1].type); |
| + EXPECT_EQ(WebInputEvent::TouchMove, all_sent_events()[2].type); |
| + EXPECT_EQ(WebInputEvent::TouchEnd, all_sent_events()[3].type); |
| +} |
| + |
| } // namespace content |