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

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

Issue 183923034: Disable the touch ack timeout for touch-action:none (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Slight ordering tweak. Created 6 years, 10 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
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 423cd6788abe2f54ff8cd35d968b3cd7159f4d6b..b09eee724175166f4d6309ec3677e84741f081b5 100644
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -992,8 +992,12 @@ TEST_F(InputRouterImplTest, GestureShowPressIsInOrder) {
}
// Test that touch ack timeout behavior is properly configured via the command
-// line, and toggled by the view update flags.
+// line, and toggled by view update flags and allowed touch actions.
TEST_F(InputRouterImplTest, TouchAckTimeoutConfigured) {
+ // Unless explicitly supported via the command-line, the touch timeout should
+ // be disabled.
+ EXPECT_FALSE(TouchEventTimeoutEnabled());
+
CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kTouchAckTimeoutDelayMs, "5");
TearDown();
@@ -1016,6 +1020,36 @@ TEST_F(InputRouterImplTest, TouchAckTimeoutConfigured) {
input_router()->OnViewUpdated(InputRouter::VIEW_FLAGS_NONE);
EXPECT_TRUE(TouchEventTimeoutEnabled());
+
+ // TOUCH_ACTION_NONE should disable the touch timeout.
+ OnHasTouchEventHandlers(true);
+ PressTouchPoint(1, 1);
+ SendTouchEvent();
+ OnSetTouchAction(TOUCH_ACTION_NONE);
+ EXPECT_FALSE(TouchEventTimeoutEnabled());
+ ReleaseTouchPoint(0);
+ SendTouchEvent();
+ SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED);
+ SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED);
+
+ // As the touch-action is reset by a new touch sequence, the timeout behavior
+ // should be restored. (Note that this is not entirely accurate: the timeout
+ // will be enabled just *after* the new event has been forwarded from the
+ // TouchEventQueue to the router, so the timeout won't actually take
+ // meaningful effect until the following touch event is sent).
Rick Byers 2014/03/05 21:24:23 We both agree we like this property. Perhaps make
jdduke (slow) 2014/03/06 00:15:25 Definitely, added a test.
+ PressTouchPoint(1, 1);
+ SendTouchEvent();
+ EXPECT_TRUE(TouchEventTimeoutEnabled());
+ ReleaseTouchPoint(0);
+ SendTouchEvent();
+ SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED);
+ SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED);
+
+ // Only TOUCH_ACTION_NONE should disable the timeout.
+ PressTouchPoint(1, 1);
+ SendTouchEvent();
+ OnSetTouchAction(TOUCH_ACTION_PAN_Y);
+ EXPECT_TRUE(TouchEventTimeoutEnabled());
}
// Test that TouchActionFilter::ResetTouchAction is called before the

Powered by Google App Engine
This is Rietveld 408576698