Chromium Code Reviews| Index: ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc |
| diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc |
| index eb77e64859b1f21aa3c89c3fd1afaae85e188e85..30d5c3f00ccb47bc086dad6947e8f89bd6377bbe 100644 |
| --- a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc |
| +++ b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc |
| @@ -134,13 +134,25 @@ class TouchDispositionGestureFilterTest |
| } |
| void SendTouchEventAck(bool event_consumed) { |
| - queue_->OnTouchEventAck(event_consumed); |
| + queue_->OnTouchEventAckForQueueFront(event_consumed); |
| } |
| void SendTouchConsumedAck() { SendTouchEventAck(true); } |
| void SendTouchNotConsumedAck() { SendTouchEventAck(false); } |
| + void SendTouchEventAckForQueueBack(bool event_consumed) { |
| + queue_->OnTouchEventAckForQueueBack(event_consumed); |
| + } |
| + |
| + void SendTouchConsumedAckForQueueBack() { |
| + SendTouchEventAckForQueueBack(true); |
| + } |
| + |
| + void SendTouchNotConsumedAckForQueueBack() { |
| + SendTouchEventAckForQueueBack(false); |
| + } |
| + |
| void PushGesture(EventType type) { |
| pending_gesture_packet_.Push(CreateGesture(type)); |
| } |
| @@ -1189,4 +1201,49 @@ TEST_F(TouchDispositionGestureFilterTest, PreviousScrollPrevented) { |
| .details.previous_scroll_update_in_sequence_prevented()); |
| } |
| +TEST_F(TouchDispositionGestureFilterTest, AckQueueBack) { |
| + PushGesture(ET_GESTURE_BEGIN); |
| + PressTouchPoint(1, 1); |
| + SendTouchNotConsumedAck(); |
| + GetAndResetSentGestures(); |
| + |
| + // Pending touch move. |
| + PushGesture(ET_GESTURE_SCROLL_UPDATE); |
| + MoveTouchPoint(0, 2, 2); |
| + EXPECT_FALSE(GesturesSent()); |
| + |
| + // Ack back of the queue consumed. |
| + PushGesture(ET_GESTURE_SCROLL_UPDATE); |
|
jdduke (slow)
2014/11/25 16:21:36
Can you make this a different gesture type (than t
tdresser
2014/12/02 21:29:27
Gave the events different locations, which accompl
|
| + MoveTouchPoint(0, 2, 2); |
| + SendTouchConsumedAckForQueueBack(); |
| + |
| + // Ack the pending touch. |
| + GetAndResetSentGestures(); |
| + SendTouchNotConsumedAck(); |
| + |
| + // Consumed touch doesn't produce gesture. |
| + EXPECT_TRUE(GesturesMatch( |
| + Gestures(ET_GESTURE_SCROLL_UPDATE), |
| + GetAndResetSentGestures())); |
| + |
| + // Pending touch move. |
| + PushGesture(ET_GESTURE_SCROLL_UPDATE); |
| + MoveTouchPoint(0, 2, 2); |
| + EXPECT_FALSE(GesturesSent()); |
| + |
| + // Ack back of the queue unconsumed. |
| + PushGesture(ET_GESTURE_SCROLL_UPDATE); |
| + MoveTouchPoint(0, 2, 2); |
| + SendTouchNotConsumedAckForQueueBack(); |
| + |
| + // Ack the pending touch. |
| + GetAndResetSentGestures(); |
| + SendTouchNotConsumedAck(); |
| + |
| + // Both touches have now been acked. |
|
jdduke (slow)
2014/11/25 16:21:36
Ideally we'd also have coverage for the case where
tdresser
2014/12/02 21:29:27
Done.
|
| + EXPECT_TRUE(GesturesMatch( |
| + Gestures(ET_GESTURE_SCROLL_UPDATE, ET_GESTURE_SCROLL_UPDATE), |
| + GetAndResetSentGestures())); |
| +} |
| + |
| } // namespace ui |