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

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

Issue 521453002: Defer flushing the touch queue when all touch handlers removed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Aura unit test fix Created 6 years, 4 months 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_event_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698