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

Unified Diff: content/renderer/input/input_handler_proxy_unittest.cc

Issue 1063853005: Unify Android Webview and Chrome's fling (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: add proguard Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/input/input_handler_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cfa8631f2bd67a6d5e416496d521e92bc04dce7c..522225e81d2bc3b99f5e2d0b32df564db7ff9b4e 100644
--- a/content/renderer/input/input_handler_proxy_unittest.cc
+++ b/content/renderer/input/input_handler_proxy_unittest.cc
@@ -82,7 +82,7 @@ class MockInputHandler : public cc::InputHandler {
void(float magnify_delta, const gfx::Point& anchor));
MOCK_METHOD0(PinchGestureEnd, void());
- MOCK_METHOD0(SetNeedsAnimate, void());
+ MOCK_METHOD0(SetNeedsAnimateInput, void());
MOCK_METHOD2(ScrollBegin,
ScrollStatus(const gfx::Point& viewport_point,
@@ -249,7 +249,7 @@ class InputHandlerProxyTest : public testing::Test {
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
gesture_ =
CreateFling(timestamp, source_device, velocity, position, position, 0);
@@ -551,7 +551,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchpad) {
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
gesture_.type = WebInputEvent::GestureFlingStart;
gesture_.data.flingStart.velocityX = 10;
@@ -631,7 +631,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
fling_point,
fling_global_point,
modifiers);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
@@ -643,7 +643,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
// fling start will typically include the last scroll from the gesture that
// lead to the scroll (either wheel or gesture scroll), so there should be no
// visible hitch.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.Times(0);
base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
@@ -652,7 +652,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// The second call should start scrolling in the -X direction.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
@@ -705,7 +705,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
// Since we've aborted the fling, the next animation should be a no-op and
// should not result in another
// frame being requested.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()).Times(0);
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(0);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.Times(0);
time += base::TimeDelta::FromMilliseconds(100);
@@ -736,7 +736,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
fling_point,
fling_global_point,
modifiers);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
@@ -746,7 +746,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// Start the fling animation at time 10. This shouldn't actually scroll, just
// establish a start time.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.Times(0);
base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
@@ -755,7 +755,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// The second call should start scrolling in the -X direction.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
@@ -809,7 +809,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// Since we've aborted the fling, the next animation should be a no-op and
// should not result in another
// frame being requested.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()).Times(0);
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(0);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.Times(0);
time += base::TimeDelta::FromMilliseconds(100);
@@ -837,7 +837,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
fling_point,
fling_global_point,
modifiers);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
@@ -847,7 +847,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// Start the second fling animation at time 30.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.Times(0);
time = base::TimeTicks() + base::TimeDelta::FromSeconds(30);
@@ -856,7 +856,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// Tick the second fling once normally.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
@@ -911,7 +911,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
gesture_.type = WebInputEvent::GestureFlingStart;
gesture_.data.flingStart.velocityX = 10;
@@ -1017,7 +1017,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
fling_point,
fling_global_point,
modifiers);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1028,14 +1028,14 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
// fling start will typically include the last scroll from the gesture that
// lead to the scroll (either wheel or gesture scroll), so there should be no
// visible hitch.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
input_handler_->Animate(time);
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// The second call should start scrolling in the -X direction.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
@@ -1078,7 +1078,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
fling_point,
fling_global_point,
modifiers);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1089,7 +1089,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
// the likelihood of a hitch between the scroll preceding the fling and
// the first scroll generated by the fling.
// Scrolling should start in the -X direction.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
@@ -1135,7 +1135,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
gesture_.globalX = fling_global_point.x;
gesture_.globalY = fling_global_point.y;
gesture_.modifiers = modifiers;
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1144,7 +1144,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
// Event though a time stamp was provided for the fling event, it will be
// ignored as its too far in the past relative to the first animate call's
// timestamp.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
base::TimeTicks time =
base::TimeTicks() + start_time_offset + base::TimeDelta::FromSeconds(1);
input_handler_->Animate(time);
@@ -1152,7 +1152,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// Further animation ticks should update the fling as usual.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
@@ -1197,7 +1197,7 @@ TEST_F(InputHandlerProxyTest,
fling_point,
fling_global_point,
modifiers);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1212,14 +1212,14 @@ TEST_F(InputHandlerProxyTest,
// fling start will typically include the last scroll from the gesture that
// lead to the scroll (either wheel or gesture scroll), so there should be no
// visible hitch.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
input_handler_->Animate(time);
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// The second call should start scrolling in the -X direction.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
@@ -1238,6 +1238,59 @@ TEST_F(InputHandlerProxyTest,
EXPECT_TRUE(!input_handler_->gesture_scroll_on_impl_thread_for_testing());
}
+TEST_F(InputHandlerProxyTest,
+ BeginScrollWhenGestureScrollOnImplThreadFlagIsSet) {
+ // We shouldn't send any events to the widget for this gesture.
+ expected_disposition_ = InputHandlerProxy::DID_HANDLE;
+ VERIFY_AND_RESET_MOCKS();
+
+ EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
+
+ gesture_.type = WebInputEvent::GestureScrollBegin;
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
+
+ // After sending a GestureScrollBegin, the member variable
+ // |gesture_scroll_on_impl_thread_| should be true.
+ EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
+
+ expected_disposition_ = InputHandlerProxy::DID_HANDLE;
+ VERIFY_AND_RESET_MOCKS();
+
+ // On the fling start, we should schedule an animation but not actually start
+ // scrolling.
+ WebFloatPoint fling_delta = WebFloatPoint(100, 0);
+ WebPoint fling_point = WebPoint(7, 13);
+ WebPoint fling_global_point = WebPoint(17, 23);
+ int modifiers = WebInputEvent::ControlKey | WebInputEvent::AltKey;
+ gesture_ = CreateFling(blink::WebGestureDeviceTouchscreen, fling_delta,
+ fling_point, fling_global_point, modifiers);
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
+ EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
+
+ // |gesture_scroll_on_impl_thread_| should still be true after
+ // a GestureFlingStart is sent.
+ EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
+
+ testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
+
+ // gesture_scroll_on_impl_thread_ is still true when this scroll begins. As a
+ // result, this scroll begin will cancel the previous fling.
+ EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
+
+ gesture_.type = WebInputEvent::GestureScrollBegin;
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
+
+ // After sending a GestureScrollBegin, the member variable
+ // |gesture_scroll_on_impl_thread_| should be true.
+ EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
+ VERIFY_AND_RESET_MOCKS();
+}
+
TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
// We shouldn't send any events to the widget for this gesture.
expected_disposition_ = InputHandlerProxy::DID_HANDLE;
@@ -1252,12 +1305,12 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
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_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
input_handler_->Animate(time);
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1270,7 +1323,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
time += base::TimeDelta::FromMilliseconds(100);
input_handler_->Animate(time);
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1301,13 +1354,13 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
&DidOverscrollParams::current_fling_velocity,
testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
time += base::TimeDelta::FromMilliseconds(100);
input_handler_->Animate(time);
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// The next call to animate will no longer scroll vertically.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
@@ -1348,7 +1401,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
fling_point,
fling_global_point,
modifiers);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1356,7 +1409,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// With an animation timestamp equivalent to the starting timestamp, the
// animation will simply be rescheduled.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
input_handler_->Animate(time);
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1364,7 +1417,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
// A small time delta should not stop the fling, even if the client
// reports no scrolling.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
@@ -1377,7 +1430,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
// A time delta of zero should not stop the fling, and neither should it
// trigger scrolling on the client.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
input_handler_->Animate(time);
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1421,18 +1474,18 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
gesture_.data.flingStart.velocityY = fling_delta.y;
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
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_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
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_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
@@ -1460,13 +1513,13 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
testing::Field(
&DidOverscrollParams::current_fling_velocity,
testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))));
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
time += base::TimeDelta::FromMilliseconds(10);
input_handler_->Animate(time);
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
// The next call to animate will no longer scroll vertically.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
@@ -1501,7 +1554,7 @@ 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_, SetNeedsAnimateInput()).Times(0);
EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
time += base::TimeDelta::FromMilliseconds(10);
input_handler_->Animate(time);
@@ -1589,7 +1642,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
gesture_.data.flingStart.velocityY = fling_delta.y;
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1641,7 +1694,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
fling_point,
fling_global_point,
modifiers);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1651,7 +1704,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
// If we get a negative time delta, that is, the Animation tick time happens
// 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_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::_)).Times(0);
@@ -1662,7 +1715,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
// The first call should have reset the start time so subsequent calls should
// generate scroll events.
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
@@ -1708,7 +1761,7 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
time += dt;
float expected_delta =
(time - last_animate_time).InSecondsF() * -fling_delta.x;
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x,
@@ -1732,7 +1785,7 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
// Animate calls within the deferred cancellation window should continue.
time += dt;
expected_delta = (time - last_animate_time).InSecondsF() * -fling_delta.x;
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x,
@@ -1758,7 +1811,7 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
time += dt;
// 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_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x,
@@ -1784,7 +1837,7 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
time += dt;
// 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_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x,
@@ -1910,7 +1963,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfFlingInDifferentDirection) {
// velocity.
time += dt;
float expected_delta = dt.InSecondsF() * -orthogonal_fling_delta.y;
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::y,
@@ -1995,7 +2048,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfFlingTooSlow) {
// Note that the new fling delta uses the *slow*, unboosted fling velocity.
time += dt;
float expected_delta = dt.InSecondsF() * -small_fling_delta.x;
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x,
@@ -2106,7 +2159,7 @@ TEST_F(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
WebFloatPoint fling_delta = WebFloatPoint(100, 100);
gesture_.data.flingStart.velocityX = fling_delta.x;
gesture_.data.flingStart.velocityY = fling_delta.y;
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
@@ -2115,7 +2168,7 @@ TEST_F(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
testing::Mock::VerifyAndClearExpectations(&mock_client);
- EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput());
EXPECT_CALL(mock_client, DidAnimateForInput());
base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
input_handler_->Animate(time);
« no previous file with comments | « content/renderer/input/input_handler_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698