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 713ae5f84577f817a9f99f6e05e9b3a3d601a0f1..b3a535ffe819b1fd4aadae28ed62a023574f5166 100644 |
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc |
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc |
@@ -619,8 +619,8 @@ TEST_F(InputRouterImplTest, TouchEventQueue) { |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
} |
-// Tests that the touch-queue is emptied if a page stops listening for touch |
-// events. |
+// Tests that the touch-queue is emptied after a page stops listening for touch |
+// events and the outstanding ack is received. |
TEST_F(InputRouterImplTest, TouchEventQueueFlush) { |
OnHasTouchEventHandlers(true); |
EXPECT_TRUE(client_->has_touch_handler()); |
@@ -632,15 +632,23 @@ TEST_F(InputRouterImplTest, TouchEventQueueFlush) { |
// Send a touch-press event. |
PressTouchPoint(1, 1); |
SendTouchEvent(); |
+ MoveTouchPoint(0, 2, 2); |
+ MoveTouchPoint(0, 3, 3); |
EXPECT_FALSE(TouchEventQueueEmpty()); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
- // The page stops listening for touch-events. The touch-event queue should now |
- // be emptied, but none of the queued touch-events should be sent to the |
- // renderer. |
+ // The page stops listening for touch-events. Note that flushing is deferred |
+ // until the outstanding ack is received. |
OnHasTouchEventHandlers(false); |
EXPECT_FALSE(client_->has_touch_handler()); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
+ EXPECT_FALSE(TouchEventQueueEmpty()); |
+ EXPECT_TRUE(input_router_->ShouldForwardTouchEvent()); |
+ |
+ // After the ack, the touch-event queue should be empty, and none of the |
+ // flushed touch-events should have been sent to the renderer. |
+ SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
EXPECT_TRUE(TouchEventQueueEmpty()); |
EXPECT_FALSE(input_router_->ShouldForwardTouchEvent()); |
} |