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

Side by Side Diff: ui/events/blink/input_handler_proxy_unittest.cc

Issue 1884863003: Non passive touch end or touch cancel listeners should not block scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/blink/input_handler_proxy.h" 5 #include "ui/events/blink/input_handler_proxy.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/test/histogram_tester.h" 10 #include "base/test/histogram_tester.h"
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 1987
1988 TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestNegative) { 1988 TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestNegative) {
1989 // None of the three touch points fall in the touch region. So the event 1989 // None of the three touch points fall in the touch region. So the event
1990 // should be dropped. 1990 // should be dropped.
1991 expected_disposition_ = InputHandlerProxy::DROP_EVENT; 1991 expected_disposition_ = InputHandlerProxy::DROP_EVENT;
1992 VERIFY_AND_RESET_MOCKS(); 1992 VERIFY_AND_RESET_MOCKS();
1993 1993
1994 EXPECT_CALL(mock_input_handler_, 1994 EXPECT_CALL(mock_input_handler_,
1995 GetEventListenerProperties(cc::EventListenerClass::kTouch)) 1995 GetEventListenerProperties(cc::EventListenerClass::kTouch))
1996 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 1996 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1997 EXPECT_CALL(
1998 mock_input_handler_,
1999 GetEventListenerProperties(cc::EventListenerClass::kTouchEndOrCancel))
2000 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1997 EXPECT_CALL(mock_input_handler_, DoTouchEventsBlockScrollAt(testing::_)) 2001 EXPECT_CALL(mock_input_handler_, DoTouchEventsBlockScrollAt(testing::_))
1998 .WillOnce(testing::Return(false)); 2002 .WillOnce(testing::Return(false));
1999 EXPECT_CALL(mock_input_handler_, 2003 EXPECT_CALL(mock_input_handler_,
2000 DoTouchEventsBlockScrollAt( 2004 DoTouchEventsBlockScrollAt(
2001 testing::Property(&gfx::Point::x, testing::Lt(0)))) 2005 testing::Property(&gfx::Point::x, testing::Lt(0))))
2002 .WillOnce(testing::Return(false)); 2006 .WillOnce(testing::Return(false));
2003 2007
2004 WebTouchEvent touch; 2008 WebTouchEvent touch;
2005 touch.type = WebInputEvent::TouchStart; 2009 touch.type = WebInputEvent::TouchStart;
2006 2010
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 2063
2060 touch.touchesLength = 3; 2064 touch.touchesLength = 3;
2061 touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0); 2065 touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0);
2062 touch.touches[1] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 10, 10); 2066 touch.touches[1] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 10, 10);
2063 touch.touches[2] = CreateWebTouchPoint(WebTouchPoint::StatePressed, -10, 10); 2067 touch.touches[2] = CreateWebTouchPoint(WebTouchPoint::StatePressed, -10, 10);
2064 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(touch)); 2068 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(touch));
2065 2069
2066 VERIFY_AND_RESET_MOCKS(); 2070 VERIFY_AND_RESET_MOCKS();
2067 } 2071 }
2068 2072
2073 TEST_P(InputHandlerProxyTest, TouchStartPassiveAndTouchEndBlocking) {
2074 // The touch start is not in a region but there is a touch end handler
tdresser 2016/04/13 16:52:35 not in a touch-region
dtapuska 2016/04/13 18:00:15 Done.
2075 // so to maintain targetting we need to dispatch the touch start as
tdresser 2016/04/13 16:52:35 targeting
dtapuska 2016/04/13 18:00:15 Done.
2076 // non-blocking but drop all touch moves.
2077 expected_disposition_ = InputHandlerProxy::DID_HANDLE_NON_BLOCKING;
2078 VERIFY_AND_RESET_MOCKS();
2079
2080 EXPECT_CALL(mock_input_handler_,
2081 GetEventListenerProperties(cc::EventListenerClass::kTouch))
2082 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
2083 EXPECT_CALL(
2084 mock_input_handler_,
2085 GetEventListenerProperties(cc::EventListenerClass::kTouchEndOrCancel))
2086 .WillOnce(testing::Return(cc::EventListenerProperties::kBlocking));
2087 EXPECT_CALL(mock_input_handler_, DoTouchEventsBlockScrollAt(testing::_))
2088 .WillOnce(testing::Return(false));
2089
2090 WebTouchEvent touch;
2091 touch.type = WebInputEvent::TouchStart;
2092 touch.touchesLength = 1;
2093 touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0);
2094 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(touch));
2095
2096 touch.type = WebInputEvent::TouchMove;
2097 touch.touchesLength = 1;
2098 touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 10, 10);
2099 EXPECT_EQ(InputHandlerProxy::DROP_EVENT,
2100 input_handler_->HandleInputEvent(touch));
2101 VERIFY_AND_RESET_MOCKS();
2102 }
2103
2069 TEST_P(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) { 2104 TEST_P(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
2070 // We shouldn't send any events to the widget for this gesture. 2105 // We shouldn't send any events to the widget for this gesture.
2071 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 2106 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
2072 VERIFY_AND_RESET_MOCKS(); 2107 VERIFY_AND_RESET_MOCKS();
2073 2108
2074 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 2109 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
2075 .WillOnce(testing::Return(kImplThreadScrollState)); 2110 .WillOnce(testing::Return(kImplThreadScrollState));
2076 gesture_.type = WebInputEvent::GestureScrollBegin; 2111 gesture_.type = WebInputEvent::GestureScrollBegin;
2077 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; 2112 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
2078 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 2113 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), 2855 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1),
2821 base::Bucket(5, 1), base::Bucket(14, 1))); 2856 base::Bucket(5, 1), base::Bucket(14, 1)));
2822 } 2857 }
2823 2858
2824 2859
2825 INSTANTIATE_TEST_CASE_P(AnimateInput, 2860 INSTANTIATE_TEST_CASE_P(AnimateInput,
2826 InputHandlerProxyTest, 2861 InputHandlerProxyTest,
2827 testing::ValuesIn(test_types)); 2862 testing::ValuesIn(test_types));
2828 } // namespace test 2863 } // namespace test
2829 } // namespace ui 2864 } // namespace ui
OLDNEW
« ui/events/blink/input_handler_proxy.cc ('K') | « 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