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

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

Issue 586553002: Allow repeated handler removal/addition with the TouchEventQueue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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.h » ('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 b3a535ffe819b1fd4aadae28ed62a023574f5166..1bed763a41e76bb4b972fdc6faf9fa512f4349dc 100644
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -284,7 +284,7 @@ class InputRouterImplTest : public testing::Test {
}
bool TouchEventTimeoutEnabled() const {
- return input_router()->touch_event_queue_.ack_timeout_enabled();
+ return input_router()->touch_event_queue_.IsAckTimeoutEnabled();
}
void Flush() const {
@@ -1105,53 +1105,40 @@ TEST_F(InputRouterImplTest,
// Start a touch sequence.
PressTouchPoint(1, 1);
SendTouchEvent();
+ EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
// TOUCH_ACTION_NONE should disable the timeout.
OnSetTouchAction(TOUCH_ACTION_NONE);
SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED);
+ EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
EXPECT_FALSE(TouchEventTimeoutEnabled());
- // End the touch sequence.
- ReleaseTouchPoint(0);
+ MoveTouchPoint(0, 1, 1);
SendTouchEvent();
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED);
EXPECT_FALSE(TouchEventTimeoutEnabled());
- ack_handler_->GetAndResetAckCount();
- GetSentMessageCountAndResetSink();
-
- // Start another touch sequence. While this does restore the touch timeout
- // the timeout will not apply until the *next* touch sequence. This affords a
- // touch-action response from the renderer without racing against the timeout.
- PressTouchPoint(1, 1);
- SendTouchEvent();
- EXPECT_TRUE(TouchEventTimeoutEnabled());
EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
- // Delay the ack. The timeout should *not* fire.
+ // Delay the move ack. The timeout should not fire.
RunTasksAndWait(base::TimeDelta::FromMilliseconds(timeout_ms + 1));
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount());
EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
-
- // Finally send the ack. The touch sequence should not have been cancelled.
- SendInputEventACK(WebInputEvent::TouchStart,
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_TRUE(TouchEventTimeoutEnabled());
+ SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED);
EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
- EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
- // End the sequence.
+ // End the touch sequence.
ReleaseTouchPoint(0);
SendTouchEvent();
SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED);
- EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
- EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
+ EXPECT_FALSE(TouchEventTimeoutEnabled());
+ ack_handler_->GetAndResetAckCount();
+ GetSentMessageCountAndResetSink();
- // A new touch sequence should (finally) be subject to the timeout.
+ // Start another touch sequence. This should restore the touch timeout.
PressTouchPoint(1, 1);
SendTouchEvent();
EXPECT_TRUE(TouchEventTimeoutEnabled());
- EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount());
EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
+ EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount());
// Wait for the touch ack timeout to fire.
RunTasksAndWait(base::TimeDelta::FromMilliseconds(timeout_ms + 1));
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_event_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698