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
3 // found in the LICENSE file.
4 
5 #include "content/test/web_gesture_curve_mock.h"
6 
WebGestureCurveMock(const gfx::Vector2dF & velocity,const blink::WebSize & cumulative_scroll)7 WebGestureCurveMock::WebGestureCurveMock(
8     const gfx::Vector2dF& velocity,
9     const blink::WebSize& cumulative_scroll)
10     : velocity_(velocity), cumulative_scroll_(cumulative_scroll) {}
11 
~WebGestureCurveMock()12 WebGestureCurveMock::~WebGestureCurveMock() {
13 }
14 
Advance(double time,gfx::Vector2dF & out_current_velocity,gfx::Vector2dF & out_delta_to_scroll)15 bool WebGestureCurveMock::Advance(double time,
16                                   gfx::Vector2dF& out_current_velocity,
17                                   gfx::Vector2dF& out_delta_to_scroll) {
18   blink::WebSize displacement(velocity_.x() * time, velocity_.y() * time);
19   out_delta_to_scroll =
20       gfx::Vector2dF(displacement.width - cumulative_scroll_.width,
21                      displacement.height - cumulative_scroll_.height);
22   cumulative_scroll_ = displacement;
23   out_current_velocity = velocity_;
24   return true;
25 }
26