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

Unified Diff: ui/events/blink/input_handler_proxy_unittest.cc

Issue 1895303007: Non passive touch end or touch cancel listeners should not block scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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 | « ui/events/blink/input_handler_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/blink/input_handler_proxy_unittest.cc
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc
index 5e3239f88a1895b4b6f994e7feb1de792c3a6998..1ff2d374e10235df24ed285509c5e5261ce48398 100644
--- a/ui/events/blink/input_handler_proxy_unittest.cc
+++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -1990,8 +1990,13 @@ TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestNegative) {
expected_disposition_ = InputHandlerProxy::DROP_EVENT;
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_,
- GetEventListenerProperties(cc::EventListenerClass::kTouch))
+ EXPECT_CALL(
+ mock_input_handler_,
+ GetEventListenerProperties(cc::EventListenerClass::kTouchStartOrMove))
+ .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
+ EXPECT_CALL(
+ mock_input_handler_,
+ GetEventListenerProperties(cc::EventListenerClass::kTouchEndOrCancel))
.WillOnce(testing::Return(cc::EventListenerProperties::kNone));
EXPECT_CALL(mock_input_handler_, DoTouchEventsBlockScrollAt(testing::_))
.WillOnce(testing::Return(false));
@@ -2047,8 +2052,9 @@ TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestPassivePositive) {
expected_disposition_ = InputHandlerProxy::DID_HANDLE_NON_BLOCKING;
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_,
- GetEventListenerProperties(cc::EventListenerClass::kTouch))
+ EXPECT_CALL(
+ mock_input_handler_,
+ GetEventListenerProperties(cc::EventListenerClass::kTouchStartOrMove))
.WillRepeatedly(testing::Return(cc::EventListenerProperties::kPassive));
EXPECT_CALL(mock_input_handler_, DoTouchEventsBlockScrollAt(testing::_))
.WillRepeatedly(testing::Return(false));
@@ -2065,6 +2071,38 @@ TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestPassivePositive) {
VERIFY_AND_RESET_MOCKS();
}
+TEST_P(InputHandlerProxyTest, TouchStartPassiveAndTouchEndBlocking) {
+ // The touch start is not in a touch-region but there is a touch end handler
+ // so to maintain targeting we need to dispatch the touch start as
+ // non-blocking but drop all touch moves.
+ expected_disposition_ = InputHandlerProxy::DID_HANDLE_NON_BLOCKING;
+ VERIFY_AND_RESET_MOCKS();
+
+ EXPECT_CALL(
+ mock_input_handler_,
+ GetEventListenerProperties(cc::EventListenerClass::kTouchStartOrMove))
+ .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
+ EXPECT_CALL(
+ mock_input_handler_,
+ GetEventListenerProperties(cc::EventListenerClass::kTouchEndOrCancel))
+ .WillOnce(testing::Return(cc::EventListenerProperties::kBlocking));
+ EXPECT_CALL(mock_input_handler_, DoTouchEventsBlockScrollAt(testing::_))
+ .WillOnce(testing::Return(false));
+
+ WebTouchEvent touch;
+ touch.type = WebInputEvent::TouchStart;
+ touch.touchesLength = 1;
+ touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0);
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(touch));
+
+ touch.type = WebInputEvent::TouchMove;
+ touch.touchesLength = 1;
+ touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 10, 10);
+ EXPECT_EQ(InputHandlerProxy::DROP_EVENT,
+ input_handler_->HandleInputEvent(touch));
+ VERIFY_AND_RESET_MOCKS();
+}
+
TEST_P(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
// We shouldn't send any events to the widget for this gesture.
expected_disposition_ = InputHandlerProxy::DID_HANDLE;
« no previous file with comments | « ui/events/blink/input_handler_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698