| Index: content/browser/renderer_host/input/touch_action_filter_unittest.cc
|
| diff --git a/content/browser/renderer_host/input/touch_action_filter_unittest.cc b/content/browser/renderer_host/input/touch_action_filter_unittest.cc
|
| index 7bb48a02d49441fff2de39e64c6988651462b8f9..f200c4f1f5bcc525ab78633d5826052c024866a7 100644
|
| --- a/content/browser/renderer_host/input/touch_action_filter_unittest.cc
|
| +++ b/content/browser/renderer_host/input/touch_action_filter_unittest.cc
|
| @@ -451,13 +451,7 @@ TEST(TouchActionFilterTest, Pinch) {
|
| EXPECT_FALSE(filter.FilterGestureEvent(&pinch_end));
|
| EXPECT_FALSE(filter.FilterGestureEvent(&scroll_end));
|
|
|
| - // Pinching can become disallowed during a single scroll gesture, but
|
| - // can't become allowed again until the scroll terminates.
|
| - // Note that the current TouchEventQueue design makes this scenario
|
| - // impossible in practice (no touch events are sent to the renderer
|
| - // while scrolling) and so no SetTouchAction can occur. But this
|
| - // could change in the future, so it's still worth verifying in this
|
| - // unit test.
|
| + // Pinching is only computed at GestureScrollBegin time.
|
| filter.ResetTouchAction();
|
| filter.OnSetTouchAction(TOUCH_ACTION_AUTO);
|
| EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin));
|
| @@ -465,17 +459,17 @@ TEST(TouchActionFilterTest, Pinch) {
|
| EXPECT_FALSE(filter.FilterGestureEvent(&pinch_update));
|
| EXPECT_FALSE(filter.FilterGestureEvent(&pinch_end));
|
| filter.OnSetTouchAction(TOUCH_ACTION_NONE);
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_begin));
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_update));
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_end));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_begin));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_update));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_end));
|
| filter.OnSetTouchAction(TOUCH_ACTION_AUTO);
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_begin));
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_update));
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_end));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_begin));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_update));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_end));
|
| EXPECT_FALSE(filter.FilterGestureEvent(&scroll_end));
|
|
|
| - // Once a pinch has started, any change in state won't affect the current
|
| - // pinch gesture, but can affect a future one within the same scroll.
|
| + // Once a pinch has started, any change in state won't affect the pinch
|
| + // gestures since it is computed in GestureScrollBegin.
|
| filter.ResetTouchAction();
|
| filter.OnSetTouchAction(TOUCH_ACTION_AUTO);
|
| EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin));
|
| @@ -483,11 +477,32 @@ TEST(TouchActionFilterTest, Pinch) {
|
| filter.OnSetTouchAction(TOUCH_ACTION_NONE);
|
| EXPECT_FALSE(filter.FilterGestureEvent(&pinch_update));
|
| EXPECT_FALSE(filter.FilterGestureEvent(&pinch_end));
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_begin));
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_update));
|
| - EXPECT_TRUE(filter.FilterGestureEvent(&pinch_end));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_begin));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_update));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_end));
|
| EXPECT_FALSE(filter.FilterGestureEvent(&scroll_end));
|
| filter.ResetTouchAction();
|
| +
|
| + scroll_begin.data.scrollBegin.pointerCount = 1;
|
| + // Scrolling should be disallowed for pinch zoom with only
|
| + // one pointer down.
|
| + filter.OnSetTouchAction(TOUCH_ACTION_PINCH_ZOOM);
|
| + EXPECT_TRUE(filter.FilterGestureEvent(&scroll_begin));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_begin));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_update));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_end));
|
| + EXPECT_TRUE(filter.FilterGestureEvent(&scroll_end));
|
| +
|
| + scroll_begin.data.scrollBegin.pointerCount = 2;
|
| +
|
| + // Scrolling is allowed when two fingers are down.
|
| + filter.ResetTouchAction();
|
| + filter.OnSetTouchAction(TOUCH_ACTION_PINCH_ZOOM);
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_begin));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_update));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&pinch_end));
|
| + EXPECT_FALSE(filter.FilterGestureEvent(&scroll_end));
|
| }
|
|
|
| TEST(TouchActionFilterTest, DoubleTapWithTouchActionAuto) {
|
|
|