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

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

Issue 44983003: Events ignoring ack disposition receive synthetic acks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jdduke's comments, and rebase. Created 7 years, 1 month 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_filter_unittest.cc
diff --git a/content/browser/renderer_host/input/gesture_event_filter_unittest.cc b/content/browser/renderer_host/input/gesture_event_filter_unittest.cc
index c852ef4ae328372eff0c385fd8a61671783d264e..d42a59b3288a5ae992b108d0dd75e7c809e14718 100644
--- a/content/browser/renderer_host/input/gesture_event_filter_unittest.cc
+++ b/content/browser/renderer_host/input/gesture_event_filter_unittest.cc
@@ -725,127 +725,6 @@ INSTANTIATE_TEST_CASE_P(AllSources,
WebGestureEvent::Touchpad));
#endif // GTEST_HAS_PARAM_TEST
-// Test that GestureShowPress, GestureTapDown and GestureTapCancel events don't
-// wait for ACKs.
jdduke (slow) 2013/11/05 05:57:18 I'd feel a bit more comfortable if we had some syn
tdresser 2013/11/05 18:57:02 I'm not sure how to test this sequence. The first
jdduke (slow) 2013/11/05 19:12:19 Hmm, right, then could you change |SimulateGesture
-TEST_F(GestureEventFilterTest, GestureTypesIgnoringAck) {
- set_debounce_interval_time_ms(0);
-
- // The show press, tap down and tap cancel events will escape the queue
- // immediately when they reach the queue head, since they ignore acks.
- SimulateGestureEvent(WebInputEvent::GestureShowPress,
- WebGestureEvent::Touchscreen);
- EXPECT_EQ(1U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(0U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GestureShowPress,
- WebGestureEvent::Touchscreen);
- EXPECT_EQ(1U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(0U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GestureTapCancel,
- WebGestureEvent::Touchscreen);
- EXPECT_EQ(1U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(0U, GestureEventQueueSize());
-
- // Interleave a few events that do and do not ignore acks, ensuring that
- // ack-ignoring events remain queued until they reach the queue head.
- SimulateGestureEvent(WebInputEvent::GesturePinchBegin,
- WebGestureEvent::Touchpad);
- ASSERT_EQ(1U, GetAndResetSentGestureEventCount());
- ASSERT_EQ(1U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GestureTapDown,
- WebGestureEvent::Touchscreen);
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(2U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GesturePinchUpdate,
- WebGestureEvent::Touchpad);
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(3U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GestureShowPress,
- WebGestureEvent::Touchscreen);
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(4U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GesturePinchEnd,
- WebGestureEvent::Touchpad);
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(5U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GestureTapCancel,
- WebGestureEvent::Touchscreen);
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(6U, GestureEventQueueSize());
-
- // Now ack each event. Ack-ignoring events should remain queued until they
- // reach the head of the queue, at which point they should be sent immediately
- // and removed from the queue, unblocking subsequent events.
- SendInputEventACK(WebInputEvent::GesturePinchBegin,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(2U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(4U, GestureEventQueueSize());
-
- SendInputEventACK(WebInputEvent::GestureTapDown,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(4U, GestureEventQueueSize());
-
- SendInputEventACK(WebInputEvent::GesturePinchUpdate,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(2U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(2U, GestureEventQueueSize());
-
- SendInputEventACK(WebInputEvent::GestureShowPress,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(2U, GestureEventQueueSize());
-
- SendInputEventACK(WebInputEvent::GesturePinchEnd,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(1U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(0U, GestureEventQueueSize());
-
- SendInputEventACK(WebInputEvent::GestureTapCancel,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(0U, GestureEventQueueSize());
-}
-
-// Test that GestureShowPress events don't get out of order due to
-// ignoring their acks.
-TEST_F(GestureEventFilterTest, GestureShowPressIsInOrder) {
- SimulateGestureEvent(WebInputEvent::GestureTap,
- WebGestureEvent::Touchscreen);
-
- EXPECT_EQ(1U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(1U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GestureShowPress,
- WebGestureEvent::Touchscreen);
-
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- // The ShowPress, though it ignores ack, is still stuck in the queue
- // behind the Tap which requires an ack.
- EXPECT_EQ(2U, GestureEventQueueSize());
-
- SimulateGestureEvent(WebInputEvent::GestureShowPress,
- WebGestureEvent::Touchscreen);
-
- EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
- // ShowPress has entered the queue.
- EXPECT_EQ(3U, GestureEventQueueSize());
-
- SendInputEventACK(WebInputEvent::GestureTap,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
-
- // Now that the Tap has been ACKed, the ShowPress events should fire
- // immediately.
- EXPECT_EQ(2U, GetAndResetSentGestureEventCount());
- EXPECT_EQ(0U, GestureEventQueueSize());
-}
-
// Test that a GestureScrollEnd | GestureFlingStart are deferred during the
// debounce interval, that Scrolls are not and that the deferred events are
// sent after that timer fires.

Powered by Google App Engine
This is Rietveld 408576698