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

Side by Side Diff: content/renderer/input/input_handler_proxy_unittest.cc

Issue 792833002: Use Blink's flag to prevent fling boosting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test added Created 6 years 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 unified diff | Download patch
« no previous file with comments | « content/renderer/input/input_handler_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/input/input_handler_proxy.h" 5 #include "content/renderer/input/input_handler_proxy.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/swap_promise_monitor.h" 9 #include "cc/base/swap_promise_monitor.h"
10 #include "content/common/input/did_overscroll_params.h" 10 #include "content/common/input/did_overscroll_params.h"
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 EXPECT_CALL(mock_input_handler_, 1947 EXPECT_CALL(mock_input_handler_,
1948 ScrollBy(testing::_, 1948 ScrollBy(testing::_,
1949 testing::Property(&gfx::Vector2dF::x, 1949 testing::Property(&gfx::Vector2dF::x,
1950 testing::Eq(expected_delta)))) 1950 testing::Eq(expected_delta))))
1951 .WillOnce(testing::Return(scroll_result_did_scroll_)); 1951 .WillOnce(testing::Return(scroll_result_did_scroll_));
1952 input_handler_->Animate(time); 1952 input_handler_->Animate(time);
1953 1953
1954 VERIFY_AND_RESET_MOCKS(); 1954 VERIFY_AND_RESET_MOCKS();
1955 } 1955 }
1956 1956
1957 TEST_F(InputHandlerProxyTest, NoFlingBoostIfPreventBoostingFlagIsSet) {
1958 base::TimeDelta dt = base::TimeDelta::FromMilliseconds(10);
1959 base::TimeTicks time = base::TimeTicks() + dt;
1960 WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
1961 WebPoint fling_point = WebPoint(7, 13);
1962
1963 StartFling(
1964 time, blink::WebGestureDeviceTouchscreen, fling_delta, fling_point);
1965
1966 EXPECT_CALL(mock_input_handler_, ScrollEnd());
1967
1968 // Cancel the fling. The fling cancellation should not be deferred because of
1969 // prevent boosting flag set.
1970 gesture_.data.flingCancel.preventBoosting = true;
1971 time += dt;
1972 CancelFling(time);
1973
1974 // VERIFY_AND_RESET_MOCKS already called by CancelFling
1975 }
1976
1957 TEST_F(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) { 1977 TEST_F(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
1958 base::TimeDelta dt = base::TimeDelta::FromMilliseconds(10); 1978 base::TimeDelta dt = base::TimeDelta::FromMilliseconds(10);
1959 base::TimeTicks time = base::TimeTicks() + dt; 1979 base::TimeTicks time = base::TimeTicks() + dt;
1960 base::TimeTicks last_animate_time = time; 1980 base::TimeTicks last_animate_time = time;
1961 WebFloatPoint fling_delta = WebFloatPoint(1000, 0); 1981 WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
1962 WebPoint fling_point = WebPoint(7, 13); 1982 WebPoint fling_point = WebPoint(7, 13);
1963 StartFling( 1983 StartFling(
1964 time, blink::WebGestureDeviceTouchscreen, fling_delta, fling_point); 1984 time, blink::WebGestureDeviceTouchscreen, fling_delta, fling_point);
1965 1985
1966 // Now cancel the fling. The fling cancellation should be deferred to allow 1986 // Now cancel the fling. The fling cancellation should be deferred to allow
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); 2085 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
2066 EXPECT_CALL(mock_client, DidAnimateForInput()); 2086 EXPECT_CALL(mock_client, DidAnimateForInput());
2067 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); 2087 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
2068 input_handler_->Animate(time); 2088 input_handler_->Animate(time);
2069 2089
2070 testing::Mock::VerifyAndClearExpectations(&mock_client); 2090 testing::Mock::VerifyAndClearExpectations(&mock_client);
2071 } 2091 }
2072 2092
2073 } // namespace 2093 } // namespace
2074 } // namespace content 2094 } // namespace content
OLDNEW
« 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