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

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

Issue 844983004: Support transitioning between platform scrolling and JS pinching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « content/browser/renderer_host/input/touch_event_queue.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/touch_event_queue_unittest.cc
diff --git a/content/browser/renderer_host/input/touch_event_queue_unittest.cc b/content/browser/renderer_host/input/touch_event_queue_unittest.cc
index bb8f725825c7d9af5f75df7b295479ec0c9430a7..21895d2935c7f0150262eba792821ee9be57ca4a 100644
--- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc
+++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc
@@ -1875,7 +1875,7 @@ TEST_F(TouchEventQueueTest, AsyncTouchThrottledAfterScroll) {
// that the flushed touchmove's ack will not reach the client (its
// constituent events have already been ack'ed).
SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
- EXPECT_FALSE(sent_event().cancelable);
+ EXPECT_TRUE(sent_event().cancelable);
EXPECT_EQ(WebInputEvent::TouchStart, sent_event().type);
EXPECT_EQ(1U, queued_event_count());
EXPECT_EQ(1U, GetAndResetSentEventCount());
@@ -2156,6 +2156,67 @@ TEST_F(TouchEventQueueTest, TouchAbsorptionWithConsumedFirstMove) {
EXPECT_EQ(0U, GetAndResetSentEventCount());
}
+TEST_F(TouchEventQueueTest, TouchStartCancelableDuringScroll) {
+ SetTouchScrollingMode(TouchEventQueue::TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE);
+
+ // Queue a touchstart and touchmove that go unconsumed, transitioning to an
+ // active scroll sequence.
+ PressTouchPoint(0, 1);
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ EXPECT_TRUE(sent_event().cancelable);
+
+ MoveTouchPoint(0, 20, 5);
+ EXPECT_TRUE(sent_event().cancelable);
+ SendGestureEvent(blink::WebInputEvent::GestureScrollBegin);
+ SendGestureEvent(blink::WebInputEvent::GestureScrollUpdate);
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ EXPECT_TRUE(sent_event().cancelable);
+
+ // Even though scrolling has begun, touchstart events should be cancelable,
+ // allowing, for example, customized pinch processing.
+ PressTouchPoint(10, 11);
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ EXPECT_TRUE(sent_event().cancelable);
+
+ // As the touch start was consumed, touchmoves should no longer be throttled.
+ MoveTouchPoint(1, 11, 11);
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ EXPECT_TRUE(sent_event().cancelable);
+
+ // With throttling disabled, touchend and touchmove events should also be
+ // cancelable.
+ MoveTouchPoint(1, 12, 12);
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ EXPECT_TRUE(sent_event().cancelable);
+ ReleaseTouchPoint(1);
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ EXPECT_TRUE(sent_event().cancelable);
+
+ // If subsequent touchmoves aren't consumed, the generated scroll events
+ // will restore async touch dispatch.
+ MoveTouchPoint(0, 25, 5);
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ SendGestureEvent(blink::WebInputEvent::GestureScrollUpdate);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ EXPECT_TRUE(sent_event().cancelable);
+ AdvanceTouchTime(kMinSecondsBetweenThrottledTouchmoves + 0.1);
+ MoveTouchPoint(0, 30, 5);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ SendTouchEventAck(INPUT_EVENT_ACK_STATE_IGNORED);
+ EXPECT_FALSE(sent_event().cancelable);
+
+ // The touchend will be uncancelable during an active scroll sequence.
+ ReleaseTouchPoint(0);
+ ASSERT_EQ(1U, GetAndResetSentEventCount());
+ EXPECT_FALSE(sent_event().cancelable);
+}
+
TEST_F(TouchEventQueueTest, UnseenTouchPointerIdsNotForwarded) {
SyntheticWebTouchEvent event;
event.PressPoint(0, 0);
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698