| Index: content/renderer/gpu/input_handler_proxy_unittest.cc
|
| diff --git a/content/renderer/gpu/input_handler_proxy_unittest.cc b/content/renderer/gpu/input_handler_proxy_unittest.cc
|
| index 1ab4c04152902a2e556b2ddb2d3d751d035f2b25..14ea2b37dea5fc9db09b988d6d0475360ed7ec52 100644
|
| --- a/content/renderer/gpu/input_handler_proxy_unittest.cc
|
| +++ b/content/renderer/gpu/input_handler_proxy_unittest.cc
|
| @@ -966,5 +966,61 @@ TEST_F(InputHandlerProxyTest, LastInputEventForVSync) {
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| }
|
|
|
| +TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
|
| + // We shouldn't send any events to the widget for this gesture.
|
| + expected_disposition_ = InputHandlerProxy::DID_HANDLE;
|
| + VERIFY_AND_RESET_MOCKS();
|
| +
|
| + // On the fling start, we should schedule an animation but not actually start
|
| + // scrolling.
|
| + gesture_.type = WebInputEvent::GestureFlingStart;
|
| + WebFloatPoint fling_delta = WebFloatPoint(1000, 1000);
|
| + gesture_.data.flingStart.velocityX = fling_delta.x;
|
| + gesture_.data.flingStart.velocityY = fling_delta.y;
|
| + EXPECT_CALL(mock_input_handler_, ScheduleAnimation());
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
| + testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
|
| +
|
| + // The first animate doesn't cause any scrolling.
|
| + EXPECT_CALL(mock_input_handler_, ScheduleAnimation());
|
| + base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
|
| + input_handler_->Animate(time);
|
| + testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
|
| +
|
| + // The second animate starts scrolling in the positive X and Y directions.
|
| + EXPECT_CALL(mock_input_handler_, ScheduleAnimation());
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
|
| + EXPECT_CALL(mock_input_handler_,
|
| + ScrollBy(testing::_,
|
| + testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
|
| + .WillOnce(testing::Return(true));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + time += base::TimeDelta::FromMilliseconds(100);
|
| + input_handler_->Animate(time);
|
| + testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
|
| +
|
| + // Simulate hitting the bottom content edge.
|
| + gfx::Vector2dF overscroll_amount(0, 100);
|
| + gfx::Vector2dF overscroll_velocity(0, 10);
|
| + input_handler_->DidOverscroll(overscroll_amount, overscroll_velocity);
|
| +
|
| + // The next call to animate will no longer scroll vertically.
|
| + EXPECT_CALL(mock_input_handler_, ScheduleAnimation());
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
|
| + EXPECT_CALL(mock_input_handler_,
|
| + ScrollBy(testing::_,
|
| + testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
|
| + .WillOnce(testing::Return(true));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + time += base::TimeDelta::FromMilliseconds(100);
|
| + input_handler_->Animate(time);
|
| + testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
|
| +}
|
| +
|
| } // namespace
|
| } // namespace content
|
|
|