| 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 c4414aa59cf688b0ed8c6d60ba77008104b002ee..d75c91e4e7a259ef2ec00a9272a4e38ea7d095d0 100644
|
| --- a/content/renderer/gpu/input_handler_proxy_unittest.cc
|
| +++ b/content/renderer/gpu/input_handler_proxy_unittest.cc
|
| @@ -996,4 +996,60 @@ TEST_F(InputHandlerProxyTest, LastInputEventForVSync) {
|
| input_handler_->HandleInputEvent(gesture_);
|
| }
|
|
|
| +TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
|
| + // We shouldn't send any events to the widget for this gesture.
|
| + expected_disposition_ = DidHandle;
|
| + 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());
|
| + 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
|
|
|