| 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 deac3835e5c016b2379d6f82b1bfa541c7404d48..1d35825f941055ed1e6fc6ffb234897014c8f489 100644
|
| --- a/ui/events/blink/input_handler_proxy_unittest.cc
|
| +++ b/ui/events/blink/input_handler_proxy_unittest.cc
|
| @@ -94,17 +94,15 @@ WebGestureEvent CreateFling(base::TimeTicks timestamp,
|
| WebPoint point,
|
| WebPoint global_point,
|
| int modifiers) {
|
| - WebGestureEvent fling;
|
| - fling.type = WebInputEvent::GestureFlingStart;
|
| + WebGestureEvent fling(WebInputEvent::GestureFlingStart, modifiers,
|
| + (timestamp - base::TimeTicks()).InSecondsF());
|
| fling.sourceDevice = source_device;
|
| - fling.timeStampSeconds = (timestamp - base::TimeTicks()).InSecondsF();
|
| fling.data.flingStart.velocityX = velocity.x;
|
| fling.data.flingStart.velocityY = velocity.y;
|
| fling.x = point.x;
|
| fling.y = point.y;
|
| fling.globalX = global_point.x;
|
| fling.globalY = global_point.y;
|
| - fling.modifiers = modifiers;
|
| return fling;
|
| }
|
|
|
| @@ -125,9 +123,9 @@ ScopedWebInputEvent CreateGestureScrollOrPinch(WebInputEvent::Type type,
|
| float deltaYOrScale = 0,
|
| int x = 0,
|
| int y = 0) {
|
| - WebGestureEvent gesture;
|
| + WebGestureEvent gesture(type, WebInputEvent::NoModifiers,
|
| + WebInputEvent::TimeStampForTesting);
|
| gesture.sourceDevice = blink::WebGestureDeviceTouchpad;
|
| - gesture.type = type;
|
| if (type == WebInputEvent::GestureScrollUpdate) {
|
| gesture.data.scrollUpdate.deltaY = deltaYOrScale;
|
| } else if (type == WebInputEvent::GesturePinchUpdate) {
|
| @@ -423,7 +421,7 @@ class InputHandlerProxyTest
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = source_device;
|
| EXPECT_EQ(expected_disposition_,
|
| input_handler_->HandleInputEvent(gesture_));
|
| @@ -443,8 +441,8 @@ class InputHandlerProxyTest
|
| }
|
|
|
| void CancelFling(base::TimeTicks timestamp) {
|
| - gesture_.timeStampSeconds = InSecondsF(timestamp);
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setTimeStampSeconds(InSecondsF(timestamp));
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_,
|
| input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -536,9 +534,8 @@ TEST_P(InputHandlerProxyTest, MouseWheelNoListener) {
|
| GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
|
| .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
|
|
|
| - WebMouseWheelEvent wheel;
|
| - wheel.type = WebInputEvent::MouseWheel;
|
| - wheel.modifiers = WebInputEvent::ControlKey;
|
| + WebMouseWheelEvent wheel(WebInputEvent::MouseWheel, WebInputEvent::ControlKey,
|
| + WebInputEvent::TimeStampForTesting);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
|
| VERIFY_AND_RESET_MOCKS();
|
| }
|
| @@ -549,9 +546,8 @@ TEST_P(InputHandlerProxyTest, MouseWheelPassiveListener) {
|
| GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
|
| .WillOnce(testing::Return(cc::EventListenerProperties::kPassive));
|
|
|
| - WebMouseWheelEvent wheel;
|
| - wheel.type = WebInputEvent::MouseWheel;
|
| - wheel.modifiers = WebInputEvent::ControlKey;
|
| + WebMouseWheelEvent wheel(WebInputEvent::MouseWheel, WebInputEvent::ControlKey,
|
| + WebInputEvent::TimeStampForTesting);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
|
| VERIFY_AND_RESET_MOCKS();
|
| }
|
| @@ -562,9 +558,8 @@ TEST_P(InputHandlerProxyTest, MouseWheelBlockingListener) {
|
| GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
|
| .WillOnce(testing::Return(cc::EventListenerProperties::kBlocking));
|
|
|
| - WebMouseWheelEvent wheel;
|
| - wheel.type = WebInputEvent::MouseWheel;
|
| - wheel.modifiers = WebInputEvent::ControlKey;
|
| + WebMouseWheelEvent wheel(WebInputEvent::MouseWheel, WebInputEvent::ControlKey,
|
| + WebInputEvent::TimeStampForTesting);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
|
| VERIFY_AND_RESET_MOCKS();
|
| }
|
| @@ -577,14 +572,14 @@ TEST_P(InputHandlerProxyTest, GestureScrollStarted) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_,input_handler_->HandleInputEvent(gesture_));
|
|
|
| // The event should not be marked as handled if scrolling is not possible.
|
| expected_disposition_ = InputHandlerProxy::DROP_EVENT;
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaY =
|
| -40; // -Y means scroll down - i.e. in the +Y direction.
|
| EXPECT_CALL(
|
| @@ -597,7 +592,7 @@ TEST_P(InputHandlerProxyTest, GestureScrollStarted) {
|
| expected_disposition_ = InputHandlerProxy::DID_HANDLE;
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaY =
|
| -40; // -Y means scroll down - i.e. in the +Y direction.
|
| EXPECT_CALL(
|
| @@ -608,7 +603,7 @@ TEST_P(InputHandlerProxyTest, GestureScrollStarted) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollEnd;
|
| + gesture_.setType(WebInputEvent::GestureScrollEnd);
|
| gesture_.data.scrollUpdate.deltaY = 0;
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| @@ -624,18 +619,18 @@ TEST_P(InputHandlerProxyTest, GestureScrollOnMainThread) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
|
| .WillOnce(testing::Return(kMainThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaY = 40;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollEnd;
|
| + gesture_.setType(WebInputEvent::GestureScrollEnd);
|
| gesture_.data.scrollUpdate.deltaY = 0;
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
|
| .WillOnce(testing::Return());
|
| @@ -656,11 +651,11 @@ TEST_P(InputHandlerProxyTest, GestureScrollIgnored) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kScrollIgnoredScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
|
| - gesture_.type = WebInputEvent::GestureScrollEnd;
|
| + gesture_.setType(WebInputEvent::GestureScrollEnd);
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
|
| .WillOnce(testing::Return());
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| @@ -673,20 +668,20 @@ TEST_P(InputHandlerProxyTest, GestureScrollByPage) {
|
| expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.data.scrollBegin.deltaHintUnits = WebGestureEvent::ScrollUnits::Page;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaY = 1;
|
| gesture_.data.scrollUpdate.deltaUnits = WebGestureEvent::ScrollUnits::Page;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollEnd;
|
| + gesture_.setType(WebInputEvent::GestureScrollEnd);
|
| gesture_.data.scrollUpdate.deltaY = 0;
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
|
| .WillOnce(testing::Return());
|
| @@ -704,14 +699,14 @@ TEST_P(InputHandlerProxyTest, DISABLED_GestureScrollByCoarsePixels) {
|
| SetSmoothScrollEnabled(true);
|
| expected_disposition_ = InputHandlerProxy::DID_HANDLE;
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.data.scrollBegin.deltaHintUnits =
|
| WebGestureEvent::ScrollUnits::Pixels;
|
| EXPECT_CALL(mock_input_handler_, ScrollAnimatedBegin(::testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaUnits = WebGestureEvent::ScrollUnits::Pixels;
|
|
|
| EXPECT_CALL(mock_input_handler_,
|
| @@ -730,7 +725,7 @@ TEST_P(InputHandlerProxyTest, GestureScrollBeginThatTargetViewport) {
|
| EXPECT_CALL(mock_input_handler_, RootScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.data.scrollBegin.targetViewport = true;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -742,7 +737,7 @@ TEST_P(InputHandlerProxyTest, GesturePinch) {
|
| expected_disposition_ = InputHandlerProxy::DID_HANDLE;
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchBegin;
|
| + gesture_.setType(WebInputEvent::GesturePinchBegin);
|
| EXPECT_CALL(mock_input_handler_,
|
| GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
|
| .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
|
| @@ -751,7 +746,7 @@ TEST_P(InputHandlerProxyTest, GesturePinch) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchUpdate;
|
| + gesture_.setType(WebInputEvent::GesturePinchUpdate);
|
| gesture_.data.pinchUpdate.scale = 1.5;
|
| gesture_.x = 7;
|
| gesture_.y = 13;
|
| @@ -760,7 +755,7 @@ TEST_P(InputHandlerProxyTest, GesturePinch) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchUpdate;
|
| + gesture_.setType(WebInputEvent::GesturePinchUpdate);
|
| gesture_.data.pinchUpdate.scale = 0.5;
|
| gesture_.data.pinchUpdate.zoomDisabled = true;
|
| gesture_.x = 9;
|
| @@ -771,7 +766,7 @@ TEST_P(InputHandlerProxyTest, GesturePinch) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchUpdate;
|
| + gesture_.setType(WebInputEvent::GesturePinchUpdate);
|
| gesture_.data.pinchUpdate.scale = 0.5;
|
| gesture_.x = 9;
|
| gesture_.y = 6;
|
| @@ -780,7 +775,7 @@ TEST_P(InputHandlerProxyTest, GesturePinch) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchEnd;
|
| + gesture_.setType(WebInputEvent::GesturePinchEnd);
|
| EXPECT_CALL(mock_input_handler_, PinchGestureEnd());
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -792,7 +787,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchWithWheelHandler) {
|
| expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchBegin;
|
| + gesture_.setType(WebInputEvent::GesturePinchBegin);
|
| EXPECT_CALL(mock_input_handler_,
|
| GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
|
| .WillOnce(testing::Return(cc::EventListenerProperties::kBlocking));
|
| @@ -800,7 +795,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchWithWheelHandler) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchUpdate;
|
| + gesture_.setType(WebInputEvent::GesturePinchUpdate);
|
| gesture_.data.pinchUpdate.scale = 1.5;
|
| gesture_.x = 7;
|
| gesture_.y = 13;
|
| @@ -808,7 +803,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchWithWheelHandler) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchUpdate;
|
| + gesture_.setType(WebInputEvent::GesturePinchUpdate);
|
| gesture_.data.pinchUpdate.scale = 0.5;
|
| gesture_.x = 9;
|
| gesture_.y = 6;
|
| @@ -816,7 +811,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchWithWheelHandler) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchEnd;
|
| + gesture_.setType(WebInputEvent::GesturePinchEnd);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| }
|
|
|
| @@ -828,12 +823,12 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
|
| .WillOnce(testing::Return(kMainThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaY = 40;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -842,7 +837,8 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
|
| expected_disposition_ = InputHandlerProxy::DID_HANDLE;
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchBegin;
|
| + gesture_.setType(WebInputEvent::GesturePinchBegin);
|
| + ;
|
| EXPECT_CALL(mock_input_handler_,
|
| GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
|
| .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
|
| @@ -851,7 +847,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchUpdate;
|
| + gesture_.setType(WebInputEvent::GesturePinchUpdate);
|
| gesture_.data.pinchUpdate.scale = 1.5;
|
| gesture_.x = 7;
|
| gesture_.y = 13;
|
| @@ -860,7 +856,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaY =
|
| -40; // -Y means scroll down - i.e. in the +Y direction.
|
| EXPECT_CALL(
|
| @@ -871,7 +867,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchUpdate;
|
| + gesture_.setType(WebInputEvent::GesturePinchUpdate);
|
| gesture_.data.pinchUpdate.scale = 0.5;
|
| gesture_.x = 9;
|
| gesture_.y = 6;
|
| @@ -880,7 +876,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GesturePinchEnd;
|
| + gesture_.setType(WebInputEvent::GesturePinchEnd);
|
| EXPECT_CALL(mock_input_handler_, PinchGestureEnd());
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -889,7 +885,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
|
| expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollEnd;
|
| + gesture_.setType(WebInputEvent::GestureScrollEnd);
|
| gesture_.data.scrollUpdate.deltaY = 0;
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
|
| .WillOnce(testing::Return());
|
| @@ -908,7 +904,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchpad) {
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
|
|
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| gesture_.data.flingStart.velocityX = 10;
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| @@ -916,7 +912,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchpad) {
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| // Verify that a GestureFlingCancel during an animation cancels it.
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| }
|
| @@ -929,7 +925,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingOnMainThreadTouchpad) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kMainThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -941,7 +937,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingOnMainThreadTouchpad) {
|
|
|
| // Even if we didn't start a fling ourselves, we still need to send the cancel
|
| // event to the widget.
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| }
|
| @@ -953,7 +949,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingIgnoredTouchpad) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kScrollIgnoredScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -962,7 +958,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingIgnoredTouchpad) {
|
|
|
| // Since the previous fling was ignored, we should also be dropping the next
|
| // fling_cancel.
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| }
|
| @@ -974,7 +970,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
|
|
|
| // On the fling start, we should schedule an animation but not actually start
|
| // scrolling.
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
|
| WebPoint fling_point = WebPoint(7, 13);
|
| WebPoint fling_global_point = WebPoint(17, 23);
|
| @@ -1076,7 +1072,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
|
| // next GestureFlingCancel to the main
|
| // thread as well.
|
| expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -1089,7 +1085,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingPassiveListener) {
|
|
|
| // On the fling start, we should schedule an animation but not actually start
|
| // scrolling.
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
|
| WebPoint fling_point = WebPoint(7, 13);
|
| WebPoint fling_global_point = WebPoint(17, 23);
|
| @@ -1131,9 +1127,8 @@ TEST_P(InputHandlerProxyTest, GestureFlingPassiveListener) {
|
| mock_input_handler_,
|
| ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| - WebMouseWheelEvent expected_wheel;
|
| - expected_wheel.type = WebInputEvent::MouseWheel;
|
| - expected_wheel.modifiers = modifiers;
|
| + WebMouseWheelEvent expected_wheel(WebInputEvent::MouseWheel, modifiers,
|
| + WebInputEvent::TimeStampForTesting);
|
| expected_wheel.x = fling_point.x;
|
| expected_wheel.y = fling_point.y;
|
| expected_wheel.globalX = fling_global_point.x;
|
| @@ -1153,7 +1148,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingPassiveListener) {
|
|
|
| // Ensure we can cancel the gesture.
|
| expected_disposition_ = InputHandlerProxy::DID_HANDLE;
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -1266,7 +1261,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
|
| // next GestureFlingCancel to the main
|
| // thread as well.
|
| expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -1356,7 +1351,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1366,7 +1361,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
| EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
|
|
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| gesture_.data.flingStart.velocityX = 10;
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| @@ -1376,7 +1371,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
|
|
| // Verify that a GestureFlingCancel during an animation cancels it.
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1391,14 +1386,14 @@ TEST_P(InputHandlerProxyTest, GestureFlingOnMainThreadTouchscreen) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kMainThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| EXPECT_CALL(mock_input_handler_, FlingScrollBegin()).Times(0);
|
|
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1406,7 +1401,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingOnMainThreadTouchscreen) {
|
|
|
| // Even if we didn't start a fling ourselves, we still need to send the cancel
|
| // event to the widget.
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| }
|
| @@ -1418,7 +1413,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1430,7 +1425,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
|
| EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
|
| .WillOnce(testing::Return(kScrollIgnoredScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1441,7 +1436,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
|
| expected_disposition_ = InputHandlerProxy::DID_HANDLE;
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1456,7 +1451,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1503,7 +1498,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -1517,7 +1512,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1559,7 +1554,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -1573,7 +1568,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1582,12 +1577,12 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
|
| // On the fling start, we should schedule an animation but not actually start
|
| // scrolling.
|
| base::TimeDelta start_time_offset = base::TimeDelta::FromMilliseconds(10);
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| WebFloatPoint fling_delta = WebFloatPoint(100, 0);
|
| WebPoint fling_point = WebPoint(7, 13);
|
| WebPoint fling_global_point = WebPoint(17, 23);
|
| int modifiers = WebInputEvent::ControlKey;
|
| - gesture_.timeStampSeconds = start_time_offset.InSecondsF();
|
| + gesture_.setTimeStampSeconds(start_time_offset.InSecondsF());
|
| gesture_.data.flingStart.velocityX = fling_delta.x;
|
| gesture_.data.flingStart.velocityY = fling_delta.y;
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| @@ -1595,7 +1590,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
|
| gesture_.y = fling_point.y;
|
| gesture_.globalX = fling_global_point.x;
|
| gesture_.globalY = fling_global_point.y;
|
| - gesture_.modifiers = modifiers;
|
| + gesture_.setModifiers(modifiers);
|
| EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
|
| EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
| @@ -1624,7 +1619,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -1638,7 +1633,7 @@ TEST_P(InputHandlerProxyTest, GestureScrollOnImplThreadFlagClearedAfterFling) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| // After sending a GestureScrollBegin, the member variable
|
| @@ -1692,7 +1687,7 @@ TEST_P(InputHandlerProxyTest, GestureScrollOnImplThreadFlagClearedAfterFling) {
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| // |gesture_scroll_on_impl_thread_| should be false once
|
| @@ -1711,7 +1706,7 @@ TEST_P(InputHandlerProxyTest,
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| // After sending a GestureScrollBegin, the member variable
|
| @@ -1746,7 +1741,7 @@ TEST_P(InputHandlerProxyTest,
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| // After sending a GestureScrollBegin, the member variable
|
| @@ -1762,7 +1757,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
|
|
|
| // On the fling start, we should schedule an animation but not actually start
|
| // scrolling.
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| WebFloatPoint fling_delta = WebFloatPoint(100, 100);
|
| gesture_.data.flingStart.velocityX = fling_delta.x;
|
| gesture_.data.flingStart.velocityY = fling_delta.y;
|
| @@ -1849,7 +1844,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1929,14 +1924,14 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| // On the fling start, we should schedule an animation but not actually start
|
| // scrolling.
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| WebFloatPoint fling_delta = WebFloatPoint(100, 100);
|
| gesture_.data.flingStart.velocityX = fling_delta.x;
|
| gesture_.data.flingStart.velocityY = fling_delta.y;
|
| @@ -2039,8 +2034,8 @@ TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestNegative) {
|
| .WillRepeatedly(testing::Return(
|
| cc::InputHandler::TouchStartEventListenerType::NO_HANDLER));
|
|
|
| - WebTouchEvent touch;
|
| - touch.type = WebInputEvent::TouchStart;
|
| + WebTouchEvent touch(WebInputEvent::TouchStart, WebInputEvent::NoModifiers,
|
| + WebInputEvent::TimeStampForTesting);
|
|
|
| touch.touchesLength = 3;
|
| touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StateStationary, 0, 0);
|
| @@ -2070,8 +2065,8 @@ TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestPositive) {
|
| // Since the second touch point hits a touch-region, there should be no
|
| // hit-testing for the third touch point.
|
|
|
| - WebTouchEvent touch;
|
| - touch.type = WebInputEvent::TouchStart;
|
| + WebTouchEvent touch(WebInputEvent::TouchStart, WebInputEvent::NoModifiers,
|
| + WebInputEvent::TimeStampForTesting);
|
|
|
| touch.touchesLength = 3;
|
| touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0);
|
| @@ -2096,8 +2091,8 @@ TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestPassivePositive) {
|
| .WillRepeatedly(testing::Return(
|
| cc::InputHandler::TouchStartEventListenerType::NO_HANDLER));
|
|
|
| - WebTouchEvent touch;
|
| - touch.type = WebInputEvent::TouchStart;
|
| + WebTouchEvent touch(WebInputEvent::TouchStart, WebInputEvent::NoModifiers,
|
| + WebInputEvent::TimeStampForTesting);
|
|
|
| touch.touchesLength = 3;
|
| touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0);
|
| @@ -2127,13 +2122,13 @@ TEST_P(InputHandlerProxyTest, TouchStartPassiveAndTouchEndBlocking) {
|
| .WillOnce(testing::Return(
|
| cc::InputHandler::TouchStartEventListenerType::NO_HANDLER));
|
|
|
| - WebTouchEvent touch;
|
| - touch.type = WebInputEvent::TouchStart;
|
| + WebTouchEvent touch(WebInputEvent::TouchStart, WebInputEvent::NoModifiers,
|
| + WebInputEvent::TimeStampForTesting);
|
| touch.touchesLength = 1;
|
| touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(touch));
|
|
|
| - touch.type = WebInputEvent::TouchMove;
|
| + touch.setType(WebInputEvent::TouchMove);
|
| touch.touchesLength = 1;
|
| touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 10, 10);
|
| EXPECT_EQ(InputHandlerProxy::DROP_EVENT,
|
| @@ -2148,22 +2143,22 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| // Keyboard events received during a scroll should have no effect.
|
| - WebKeyboardEvent key_event;
|
| - key_event.type = WebInputEvent::KeyDown;
|
| + WebKeyboardEvent key_event(WebInputEvent::KeyDown, WebInputEvent::NoModifiers,
|
| + WebInputEvent::TimeStampForTesting);
|
| EXPECT_EQ(InputHandlerProxy::DID_NOT_HANDLE,
|
| input_handler_->HandleInputEvent(key_event));
|
| EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| // On the fling start, animation should be scheduled, but no scrolling occurs.
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| WebFloatPoint fling_delta = WebFloatPoint(100, 100);
|
| gesture_.data.flingStart.velocityX = fling_delta.x;
|
| gesture_.data.flingStart.velocityY = fling_delta.y;
|
| @@ -2187,7 +2182,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| // A fling cancel should be dropped, as there is nothing to cancel.
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(InputHandlerProxy::DROP_EVENT,
|
| input_handler_->HandleInputEvent(gesture_));
|
| EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
|
| @@ -2201,7 +2196,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledByWheelEvent) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
|
| @@ -2215,14 +2210,15 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledByWheelEvent) {
|
| GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
|
| .WillOnce(testing::Return(cc::EventListenerProperties::kBlocking));
|
|
|
| - WebMouseWheelEvent wheel_event;
|
| - wheel_event.type = WebInputEvent::MouseWheel;
|
| + WebMouseWheelEvent wheel_event(WebInputEvent::MouseWheel,
|
| + WebInputEvent::NoModifiers,
|
| + WebInputEvent::TimeStampForTesting);
|
| input_handler_->HandleInputEvent(wheel_event);
|
| EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| // On the fling start, animation should be scheduled, but no scrolling occurs.
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| WebFloatPoint fling_delta = WebFloatPoint(100, 100);
|
| gesture_.data.flingStart.velocityX = fling_delta.x;
|
| gesture_.data.flingStart.velocityY = fling_delta.y;
|
| @@ -2252,7 +2248,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledByWheelEvent) {
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| // A fling cancel should be dropped, as there is nothing to cancel.
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(InputHandlerProxy::DROP_EVENT,
|
| input_handler_->HandleInputEvent(gesture_));
|
| EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
|
| @@ -2266,7 +2262,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -2316,7 +2312,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -2343,8 +2339,8 @@ TEST_P(InputHandlerProxyTest, FlingBoost) {
|
| .WillOnce(testing::Return(true));
|
|
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -2366,8 +2362,8 @@ TEST_P(InputHandlerProxyTest, FlingBoost) {
|
| // GestureScrollUpdates in the same direction and at sufficient speed should
|
| // be swallowed by the fling.
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaX = fling_delta.x;
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -2440,8 +2436,8 @@ TEST_P(InputHandlerProxyTest, FlingBoost) {
|
| // received within the timeout window.
|
|
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureFlingCancel;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureFlingCancel);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -2476,8 +2472,8 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfScrollTargetsDifferentLayer) {
|
| .WillOnce(testing::Return(kImplThreadScrollState));
|
|
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -2503,8 +2499,8 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfScrollDelayed) {
|
| .WillOnce(testing::Return(true));
|
|
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -2547,15 +2543,15 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfNotAnimated) {
|
| .WillOnce(testing::Return(true));
|
|
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
|
|
| // Should exit scroll bosting on GestureScrollUpdate due to long delay
|
| // since last animate. Cancel old fling and start new scroll.
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaY = -40;
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| @@ -2628,8 +2624,8 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfScrollInDifferentDirection) {
|
| .WillOnce(testing::Return(true));
|
|
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| VERIFY_AND_RESET_MOCKS();
|
| @@ -2637,8 +2633,8 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfScrollInDifferentDirection) {
|
| // If the GestureScrollUpdate is in a different direction than the fling,
|
| // the fling should be cancelled and scrolling should resume.
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaX = -fling_delta.x;
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| @@ -2727,8 +2723,8 @@ TEST_P(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
|
|
|
| // The GestureScrollBegin should be swallowed by the fling.
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollBegin;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollBegin);
|
| EXPECT_CALL(mock_input_handler_,
|
| IsCurrentlyScrollingLayerAt(testing::_, testing::_))
|
| .WillOnce(testing::Return(true));
|
| @@ -2758,8 +2754,8 @@ TEST_P(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
|
| // cause scrolling as usual.
|
| time += dt;
|
| expected_delta = 7.3f;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollUpdate);
|
| gesture_.data.scrollUpdate.deltaX = -expected_delta;
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::Property(&cc::ScrollState::delta_x,
|
| @@ -2771,8 +2767,8 @@ TEST_P(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
|
|
|
| // GestureScrollEnd should terminate the resumed scroll properly.
|
| time += dt;
|
| - gesture_.timeStampSeconds = InSecondsF(time);
|
| - gesture_.type = WebInputEvent::GestureScrollEnd;
|
| + gesture_.setTimeStampSeconds(InSecondsF(time));
|
| + gesture_.setType(WebInputEvent::GestureScrollEnd);
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -2793,7 +2789,7 @@ TEST_P(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
|
| }
|
| mock_input_handler_.set_is_scrolling_root(synchronous_root_scroll_);
|
|
|
| - gesture_.type = WebInputEvent::GestureFlingStart;
|
| + gesture_.setType(WebInputEvent::GestureFlingStart);
|
| WebFloatPoint fling_delta = WebFloatPoint(100, 100);
|
| gesture_.data.flingStart.velocityX = fling_delta.x;
|
| gesture_.data.flingStart.velocityY = fling_delta.y;
|
|
|