Chromium Code Reviews| Index: content/browser/renderer_host/input/input_router_impl_unittest.cc |
| diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc |
| index 861ecaeefa8004ed06933875779aff2598ec5a36..2edf0b9b42f94c01fb29356cab001538b86a38d2 100644 |
| --- a/content/browser/renderer_host/input/input_router_impl_unittest.cc |
| +++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc |
| @@ -274,6 +274,16 @@ class InputRouterImplTest : public testing::Test { |
| return touch_event_id; |
| } |
| + // The TouchScrollStarted event doesn't need an ack from downstream, and is |
| + // acked from within the TouchEventQueue to trigger its dequeing like other |
| + // touch events. For this test, we send an artificial ack to get the same |
| + // result. |
|
tdresser
2016/04/01 19:03:20
I think we can get rid of "like other touch events
mustaq
2016/04/01 21:49:52
Done.
|
| + void AckTouchScrollStartedNotification(WebInputEvent::Type type) { |
|
tdresser
2016/04/01 19:03:20
We can hardcode the type in this method.
mustaq
2016/04/01 21:49:52
Done.
|
| + ui::LatencyInfo latency_info; |
| + input_router_->ProcessInputEventAck(type, INPUT_EVENT_ACK_STATE_IGNORED, |
| + latency_info, 0, InputRouterImpl::IGNORING_DISPOSITION); |
| + } |
| + |
| int PressTouchPoint(int x, int y) { |
| return touch_event_.PressPoint(x, y); |
| } |
| @@ -1103,6 +1113,11 @@ TEST_F(InputRouterImplTest, GestureTypesIgnoringAck) { |
| EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
| EXPECT_EQ(0, client_->in_flight_event_count()); |
| + |
| + if (type == WebInputEvent::GestureScrollBegin) { |
| + EXPECT_TRUE(HasPendingEvents()); |
| + AckTouchScrollStartedNotification(WebInputEvent::TouchScrollStarted); |
| + } |
| EXPECT_FALSE(HasPendingEvents()); |
| } |
| } |
| @@ -1233,7 +1248,6 @@ TEST_F(InputRouterImplTest, GestureShowPressIsInOrder) { |
| EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
| - |
| // GesturePinchBegin ignores its ack. |
| SimulateGestureEvent(WebInputEvent::GesturePinchBegin, |
| blink::WebGestureDeviceTouchscreen); |
| @@ -1692,6 +1706,7 @@ TEST_F(InputRouterImplTest, InputFlushAfterFling) { |
| blink::WebGestureDeviceTouchscreen); |
| SimulateGestureEvent(WebInputEvent::GestureFlingStart, |
| blink::WebGestureDeviceTouchscreen); |
| + AckTouchScrollStartedNotification(WebInputEvent::TouchScrollStarted); |
| EXPECT_TRUE(HasPendingEvents()); |
| // If the fling is unconsumed, the flush is complete. |
| @@ -1701,7 +1716,10 @@ TEST_F(InputRouterImplTest, InputFlushAfterFling) { |
| blink::WebGestureDeviceTouchscreen); |
| SendInputEventACK(WebInputEvent::GestureFlingStart, |
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| + EXPECT_TRUE(HasPendingEvents()); |
| + AckTouchScrollStartedNotification(WebInputEvent::TouchScrollStarted); |
| EXPECT_FALSE(HasPendingEvents()); |
| + |
| EXPECT_EQ(1U, GetAndResetDidFlushCount()); |
| // Simulate a second fling. |
| @@ -1728,6 +1746,7 @@ TEST_F(InputRouterImplTest, InputFlushAfterFling) { |
| blink::WebGestureDeviceTouchscreen); |
| SimulateGestureEvent(WebInputEvent::GestureFlingStart, |
| blink::WebGestureDeviceTouchscreen); |
| + AckTouchScrollStartedNotification(WebInputEvent::TouchScrollStarted); |
| ASSERT_TRUE(HasPendingEvents()); |
| RequestNotificationWhenFlushed(); |
| EXPECT_EQ(0U, GetAndResetDidFlushCount()); |