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

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

Issue 602873002: Prevent orthogonal fling accumulation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup Created 6 years, 3 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 6f4480ca0354c0f502c16acfc76833b7e75c2bfd..baac5af3411685124c1a7c8048cb8be758b4ff4e 100644
--- a/content/renderer/input/input_handler_proxy_unittest.cc
+++ b/content/renderer/input/input_handler_proxy_unittest.cc
@@ -1793,6 +1793,48 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollDelayed) {
VERIFY_AND_RESET_MOCKS();
}
+TEST_F(InputHandlerProxyTest, NoFlingBoostIfFlingInDifferentDirection) {
+ base::TimeDelta dt = base::TimeDelta::FromMilliseconds(10);
+ base::TimeTicks time = base::TimeTicks() + dt;
+ WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
+ WebPoint fling_point = WebPoint(7, 13);
+ StartFling(
+ time, blink::WebGestureDeviceTouchscreen, fling_delta, fling_point);
+
+ // Cancel the fling. The fling cancellation should be deferred to allow
+ // fling boosting events to arrive.
+ time += dt;
+ CancelFling(time);
+
+ // If the new fling is orthogonal to the existing fling, no boosting should
+ // take place, with the new fling replacing the old.
+ WebFloatPoint orthogonal_fling_delta =
+ WebFloatPoint(fling_delta.y, -fling_delta.x);
+ gesture_ = CreateFling(time,
+ blink::WebGestureDeviceTouchscreen,
+ orthogonal_fling_delta,
+ fling_point,
+ fling_point,
+ 0);
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
+
+ VERIFY_AND_RESET_MOCKS();
+
+ // Note that the new fling delta uses the orthogonal, unboosted fling
+ // velocity.
+ 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))))
+ .WillOnce(testing::Return(true));
+ input_handler_->Animate(time);
+
+ VERIFY_AND_RESET_MOCKS();
+}
+
TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollInDifferentDirection) {
base::TimeDelta dt = base::TimeDelta::FromMilliseconds(10);
base::TimeTicks time = base::TimeTicks() + dt;
« 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