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 b880436f0d40af68d9ec73fb9ffcb783887592c7..4d8bc430310c712755111984477ac050d1a8f14a 100644 |
--- a/content/renderer/input/input_handler_proxy_unittest.cc |
+++ b/content/renderer/input/input_handler_proxy_unittest.cc |
@@ -7,7 +7,6 @@ |
#include "base/basictypes.h" |
#include "base/memory/scoped_ptr.h" |
#include "cc/base/swap_promise_monitor.h" |
-#include "content/common/input/did_overscroll_params.h" |
#include "content/renderer/input/input_handler_proxy_client.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -68,6 +67,8 @@ |
float page_scale, |
base::TimeDelta duration) OVERRIDE {} |
+ virtual void NotifyCurrentFlingVelocity( |
+ const gfx::Vector2dF& velocity) OVERRIDE {} |
virtual void MouseMoveAt(const gfx::Point& mouse_position) OVERRIDE {} |
MOCK_METHOD1(HaveTouchEventHandlersAt, bool(const gfx::Point& point)); |
@@ -85,29 +86,28 @@ |
// indefinitely. |
class FakeWebGestureCurve : public blink::WebGestureCurve { |
public: |
- FakeWebGestureCurve(const blink::WebFloatSize& velocity, |
- const blink::WebFloatSize& cumulative_scroll) |
+ FakeWebGestureCurve(const blink::WebFloatPoint& velocity, |
+ const blink::WebSize& cumulative_scroll) |
: velocity_(velocity), cumulative_scroll_(cumulative_scroll) {} |
virtual ~FakeWebGestureCurve() {} |
// Returns false if curve has finished and can no longer be applied. |
virtual bool apply(double time, blink::WebGestureCurveTarget* target) { |
- blink::WebFloatSize displacement(velocity_.width * time, |
- velocity_.height * time); |
+ blink::WebSize displacement(velocity_.x * time, velocity_.y * time); |
blink::WebFloatSize increment( |
displacement.width - cumulative_scroll_.width, |
displacement.height - cumulative_scroll_.height); |
cumulative_scroll_ = displacement; |
// scrollBy() could delete this curve if the animation is over, so don't |
// touch any member variables after making that call. |
- target->scrollBy(increment, velocity_); |
+ target->scrollBy(increment); |
return true; |
} |
private: |
- blink::WebFloatSize velocity_; |
- blink::WebFloatSize cumulative_scroll_; |
+ blink::WebFloatPoint velocity_; |
+ blink::WebSize cumulative_scroll_; |
DISALLOW_COPY_AND_ASSIGN(FakeWebGestureCurve); |
}; |
@@ -127,12 +127,10 @@ |
int deviceSource, |
const WebFloatPoint& velocity, |
const WebSize& cumulative_scroll) OVERRIDE { |
- return new FakeWebGestureCurve( |
- blink::WebFloatSize(velocity.x, velocity.y), |
- blink::WebFloatSize(cumulative_scroll.width, cumulative_scroll.height)); |
+ return new FakeWebGestureCurve(velocity, cumulative_scroll); |
} |
- MOCK_METHOD1(DidOverscroll, void(const DidOverscrollParams&)); |
+ virtual void DidOverscroll(const cc::DidOverscrollParams& params) OVERRIDE {} |
virtual void DidStopFlinging() OVERRIDE {} |
private: |
@@ -1087,19 +1085,10 @@ |
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
// Simulate hitting the bottom content edge. |
- gfx::Vector2dF accumulated_overscroll(0, 100); |
- gfx::Vector2dF latest_overscroll_delta(0, 10); |
- EXPECT_CALL(mock_client_, |
- DidOverscroll(testing::AllOf( |
- testing::Field(&DidOverscrollParams::accumulated_overscroll, |
- testing::Eq(accumulated_overscroll)), |
- testing::Field(&DidOverscrollParams::latest_overscroll_delta, |
- testing::Eq(latest_overscroll_delta)), |
- testing::Field( |
- &DidOverscrollParams::current_fling_velocity, |
- testing::Property(&gfx::Vector2dF::y, testing::Gt(0)))))); |
- input_handler_->DidOverscroll(accumulated_overscroll, |
- latest_overscroll_delta); |
+ cc::DidOverscrollParams overscroll_params; |
+ overscroll_params.accumulated_overscroll = gfx::Vector2dF(0, 100); |
+ overscroll_params.current_fling_velocity = gfx::Vector2dF(0, 10); |
+ input_handler_->DidOverscroll(overscroll_params); |
// The next call to animate will no longer scroll vertically. |
EXPECT_CALL(mock_input_handler_, ScheduleAnimation()); |
@@ -1156,19 +1145,9 @@ |
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
// Simulate hitting the bottom content edge. |
- gfx::Vector2dF accumulated_overscroll(0, 100); |
- gfx::Vector2dF latest_overscroll_delta(0, 100); |
- EXPECT_CALL(mock_client_, |
- DidOverscroll(testing::AllOf( |
- testing::Field(&DidOverscrollParams::accumulated_overscroll, |
- testing::Eq(accumulated_overscroll)), |
- testing::Field(&DidOverscrollParams::latest_overscroll_delta, |
- testing::Eq(latest_overscroll_delta)), |
- testing::Field( |
- &DidOverscrollParams::current_fling_velocity, |
- testing::Property(&gfx::Vector2dF::y, testing::Gt(0)))))); |
- input_handler_->DidOverscroll(accumulated_overscroll, |
- latest_overscroll_delta); |
+ cc::DidOverscrollParams overscroll_params; |
+ overscroll_params.accumulated_overscroll = gfx::Vector2dF(0, 100); |
+ input_handler_->DidOverscroll(overscroll_params); |
// The next call to animate will no longer scroll vertically. |
EXPECT_CALL(mock_input_handler_, ScheduleAnimation()); |
@@ -1181,19 +1160,9 @@ |
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
// Simulate hitting the right content edge. |
- accumulated_overscroll = gfx::Vector2dF(100, 100); |
- latest_overscroll_delta = gfx::Vector2dF(100, 0); |
- EXPECT_CALL(mock_client_, |
- DidOverscroll(testing::AllOf( |
- testing::Field(&DidOverscrollParams::accumulated_overscroll, |
- testing::Eq(accumulated_overscroll)), |
- testing::Field(&DidOverscrollParams::latest_overscroll_delta, |
- testing::Eq(latest_overscroll_delta)), |
- testing::Field( |
- &DidOverscrollParams::current_fling_velocity, |
- testing::Property(&gfx::Vector2dF::x, testing::Gt(0)))))); |
- input_handler_->DidOverscroll(accumulated_overscroll, |
- latest_overscroll_delta); |
+ overscroll_params.accumulated_overscroll = gfx::Vector2dF(100, 100); |
+ input_handler_->DidOverscroll(overscroll_params); |
+ |
// The next call to animate will no longer scroll horizontally or vertically, |
// and the fling should be cancelled. |
EXPECT_CALL(mock_input_handler_, ScheduleAnimation()).Times(0); |