| Index: content/renderer/input/input_handler_proxy_unittest.cc
|
| diff --git a/content/renderer/input/input_handler_proxy_unittest.cc b/content/renderer/input/input_handler_proxy_unittest.cc
|
| index 382536687ff248b91db8eb698fbb57e64db3ca7c..675b9c02a7281f118a7f98e4168f24f6c9b8e9a6 100644
|
| --- a/content/renderer/input/input_handler_proxy_unittest.cc
|
| +++ b/content/renderer/input/input_handler_proxy_unittest.cc
|
| @@ -90,10 +90,11 @@ class MockInputHandler : public cc::InputHandler {
|
| MOCK_METHOD2(ScrollAnimated,
|
| ScrollStatus(const gfx::Point& viewport_point,
|
| const gfx::Vector2dF& scroll_delta));
|
| - MOCK_METHOD2(ScrollBy,
|
| - cc::InputHandlerScrollResult(
|
| - const gfx::Point& viewport_point,
|
| - const gfx::Vector2dF& scroll_delta));
|
| + MOCK_METHOD3(
|
| + ScrollBy,
|
| + cc::InputHandlerScrollResult(const gfx::Point& viewport_point,
|
| + const gfx::Vector2dF& scroll_delta,
|
| + cc::InputHandler::RailsMode rails_mode));
|
| MOCK_METHOD2(ScrollVerticallyByPage,
|
| bool(const gfx::Point& viewport_point,
|
| cc::ScrollDirection direction));
|
| @@ -320,7 +321,8 @@ TEST_F(InputHandlerProxyTest, GestureScrollStarted) {
|
| -40; // -Y means scroll down - i.e. in the +Y direction.
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Gt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_not_scroll_));
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -333,7 +335,8 @@ TEST_F(InputHandlerProxyTest, GestureScrollStarted) {
|
| -40; // -Y means scroll down - i.e. in the +Y direction.
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Gt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -503,7 +506,8 @@ TEST_F(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
|
| -40; // -Y means scroll down - i.e. in the +Y direction.
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Gt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -648,7 +652,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| time += base::TimeDelta::FromMilliseconds(100);
|
| @@ -663,7 +668,9 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
|
| // transferred to the main thread.
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
|
| - EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .Times(0);
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
|
| // Expected wheel fling animation parameters:
|
| // *) fling_delta and fling_point should match the original GestureFlingStart
|
| @@ -751,7 +758,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| time += base::TimeDelta::FromMilliseconds(100);
|
| @@ -766,7 +774,9 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
|
| // transferred to the main thread.
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
|
| - EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .Times(0);
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
|
|
|
| // Expected wheel fling animation parameters:
|
| @@ -852,7 +862,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Gt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| time += base::TimeDelta::FromMilliseconds(100);
|
| @@ -863,7 +874,9 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
|
| // Then abort the second fling.
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
|
| - EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .Times(0);
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
|
|
|
| // We should get parameters from the second fling, nothing from the first
|
| @@ -1029,7 +1042,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| time += base::TimeDelta::FromMilliseconds(100);
|
| input_handler_->Animate(time);
|
| @@ -1083,7 +1097,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| time += dt;
|
| input_handler_->Animate(time);
|
| @@ -1146,7 +1161,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| time += base::TimeDelta::FromMilliseconds(10);
|
| input_handler_->Animate(time);
|
| @@ -1213,7 +1229,8 @@ TEST_F(InputHandlerProxyTest,
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| time += base::TimeDelta::FromMilliseconds(100);
|
| input_handler_->Animate(time);
|
| @@ -1258,7 +1275,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| @@ -1277,7 +1295,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(overscroll));
|
| EXPECT_CALL(
|
| mock_client_,
|
| @@ -1303,7 +1322,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Eq(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| time += base::TimeDelta::FromMilliseconds(100);
|
| @@ -1358,7 +1378,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_not_scroll_));
|
| time += base::TimeDelta::FromMicroseconds(5);
|
| input_handler_->Animate(time);
|
| @@ -1379,7 +1400,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(1))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(1)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_not_scroll_));
|
| time += base::TimeDelta::FromMilliseconds(100);
|
| input_handler_->Animate(time);
|
| @@ -1426,7 +1448,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| time += base::TimeDelta::FromMilliseconds(10);
|
| input_handler_->Animate(time);
|
| @@ -1437,7 +1460,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
|
| overscroll.unused_scroll_delta = gfx::Vector2dF(0, 100);
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(overscroll));
|
| EXPECT_CALL(
|
| mock_client_,
|
| @@ -1460,7 +1484,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
|
| + testing::Property(&gfx::Vector2dF::y, testing::Eq(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| time += base::TimeDelta::FromMilliseconds(10);
|
| input_handler_->Animate(time);
|
| @@ -1471,7 +1496,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
|
| overscroll.unused_scroll_delta = gfx::Vector2dF(100, 0);
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(overscroll));
|
| EXPECT_CALL(
|
| mock_client_,
|
| @@ -1493,7 +1519,9 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
|
| // The next call to animate will no longer scroll horizontally or vertically,
|
| // and the fling should be cancelled.
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()).Times(0);
|
| - EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .Times(0);
|
| time += base::TimeDelta::FromMilliseconds(10);
|
| input_handler_->Animate(time);
|
| testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
|
| @@ -1643,9 +1671,9 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
|
| // before the fling's start time then we should *not* try scrolling and
|
| // instead reset the fling start time.
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::_)).Times(0);
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .Times(0);
|
| time -= base::TimeDelta::FromMilliseconds(5);
|
| input_handler_->Animate(time);
|
|
|
| @@ -1656,7 +1684,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| EXPECT_CALL(mock_input_handler_,
|
| ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
|
| + testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
|
|
| input_handler_->Animate(time + base::TimeDelta::FromMilliseconds(1));
|
| @@ -1700,10 +1729,11 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
|
| float expected_delta =
|
| (time - last_animate_time).InSecondsF() * -fling_delta.x;
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x,
|
| - testing::Eq(expected_delta))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::x,
|
| + testing::Eq(expected_delta)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| input_handler_->Animate(time);
|
| last_animate_time = time;
|
| @@ -1724,10 +1754,11 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
|
| time += dt;
|
| expected_delta = (time - last_animate_time).InSecondsF() * -fling_delta.x;
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x,
|
| - testing::Eq(expected_delta))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::x,
|
| + testing::Eq(expected_delta)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| input_handler_->Animate(time);
|
| last_animate_time = time;
|
| @@ -1750,10 +1781,11 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
|
| // Note we get *2x* as much delta because 2 flings have combined.
|
| expected_delta = 2 * (time - last_animate_time).InSecondsF() * -fling_delta.x;
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x,
|
| - testing::Eq(expected_delta))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::x,
|
| + testing::Eq(expected_delta)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| input_handler_->Animate(time);
|
| last_animate_time = time;
|
| @@ -1776,10 +1808,11 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
|
| // Note we get *3x* as much delta because 3 flings have combined.
|
| expected_delta = 3 * (time - last_animate_time).InSecondsF() * -fling_delta.x;
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x,
|
| - testing::Eq(expected_delta))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::x,
|
| + testing::Eq(expected_delta)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| input_handler_->Animate(time);
|
| last_animate_time = time;
|
| @@ -1902,10 +1935,11 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfFlingInDifferentDirection) {
|
| time += dt;
|
| float expected_delta = dt.InSecondsF() * -orthogonal_fling_delta.y;
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::y,
|
| - testing::Eq(expected_delta))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::y,
|
| + testing::Eq(expected_delta)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| input_handler_->Animate(time);
|
|
|
| @@ -1947,10 +1981,11 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollInDifferentDirection) {
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x,
|
| - testing::Eq(fling_delta.x))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::x,
|
| + testing::Eq(fling_delta.x)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -1987,10 +2022,11 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfFlingTooSlow) {
|
| time += dt;
|
| float expected_delta = dt.InSecondsF() * -small_fling_delta.x;
|
| EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x,
|
| - testing::Eq(expected_delta))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::x,
|
| + testing::Eq(expected_delta)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| input_handler_->Animate(time);
|
|
|
| @@ -2049,10 +2085,11 @@ TEST_F(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
|
| time += dt;
|
| float expected_delta =
|
| (time - last_animate_time).InSecondsF() * -fling_delta.x;
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x,
|
| - testing::Eq(expected_delta))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::x,
|
| + testing::Eq(expected_delta)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_not_scroll_));
|
| EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| @@ -2068,10 +2105,11 @@ TEST_F(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
|
| gesture_.timeStampSeconds = InSecondsF(time);
|
| gesture_.type = WebInputEvent::GestureScrollUpdate;
|
| gesture_.data.scrollUpdate.deltaX = -expected_delta;
|
| - EXPECT_CALL(mock_input_handler_,
|
| - ScrollBy(testing::_,
|
| - testing::Property(&gfx::Vector2dF::x,
|
| - testing::Eq(expected_delta))))
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::Property(&gfx::Vector2dF::x,
|
| + testing::Eq(expected_delta)),
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
|
|
|
| @@ -2136,5 +2174,95 @@ TEST_F(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
|
| testing::Mock::VerifyAndClearExpectations(&mock_client);
|
| }
|
|
|
| +TEST_F(InputHandlerProxyTest, WheelRailsModes) {
|
| + WebMouseWheelEvent wheel;
|
| + wheel.type = WebInputEvent::MouseWheel;
|
| + wheel.deltaX = 1;
|
| + wheel.deltaY = 2;
|
| +
|
| + // We shouldn't send any events to the widget for this gesture.
|
| + VERIFY_AND_RESET_MOCKS();
|
| +
|
| + // Begin the scroll gesture
|
| + wheel.phase = WebMouseWheelEvent::PhaseBegan;
|
| + wheel.railsMode = WebInputEvent::RailsModeFree;
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
|
| + input_handler_->HandleInputEvent(wheel));
|
| + VERIFY_AND_RESET_MOCKS();
|
| +
|
| + // Scroll with no rails.
|
| + wheel.phase = WebMouseWheelEvent::PhaseChanged;
|
| + wheel.railsMode = WebInputEvent::RailsModeFree;
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
|
| + input_handler_->HandleInputEvent(wheel));
|
| + VERIFY_AND_RESET_MOCKS();
|
| +
|
| + // Scroll with horizontal rails.
|
| + wheel.phase = WebMouseWheelEvent::PhaseChanged;
|
| + wheel.railsMode = WebInputEvent::RailsModeHorizontal;
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::_, cc::InputHandler::RAILS_MODE_HORIZONTAL))
|
| + .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
|
| + input_handler_->HandleInputEvent(wheel));
|
| + VERIFY_AND_RESET_MOCKS();
|
| +
|
| + // Scroll with vertical rails.
|
| + wheel.phase = WebMouseWheelEvent::PhaseChanged;
|
| + wheel.railsMode = WebInputEvent::RailsModeVertical;
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| + EXPECT_CALL(
|
| + mock_input_handler_,
|
| + ScrollBy(testing::_, testing::_, cc::InputHandler::RAILS_MODE_VERTICAL))
|
| + .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
|
| + input_handler_->HandleInputEvent(wheel));
|
| + VERIFY_AND_RESET_MOCKS();
|
| +
|
| + // Scroll with no rails.
|
| + wheel.phase = WebMouseWheelEvent::PhaseChanged;
|
| + wheel.railsMode = WebInputEvent::RailsModeFree;
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
|
| + input_handler_->HandleInputEvent(wheel));
|
| + VERIFY_AND_RESET_MOCKS();
|
| +
|
| + // Stop the scroll gesture.
|
| + wheel.phase = WebMouseWheelEvent::PhaseEnded;
|
| + wheel.railsMode = WebInputEvent::RailsModeFree;
|
| + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
|
| + .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
|
| + EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_,
|
| + cc::InputHandler::RAILS_MODE_FREE))
|
| + .WillOnce(testing::Return(scroll_result_did_scroll_));
|
| + EXPECT_CALL(mock_input_handler_, ScrollEnd());
|
| + EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
|
| + input_handler_->HandleInputEvent(wheel));
|
| + VERIFY_AND_RESET_MOCKS();
|
| +}
|
| +
|
| } // namespace
|
| } // namespace content
|
|
|