cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / content / test / web_gesture_curve_mock.cc
blob1007b7ef401d7970f66775da9f20b2742ba161ba
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.
5 #include "content/test/web_gesture_curve_mock.h"
7 #include "content/test/weburl_loader_mock_factory.h"
8 #include "third_party/WebKit/public/platform/WebFloatSize.h"
9 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
11 WebGestureCurveMock::WebGestureCurveMock(const blink::WebFloatPoint& velocity,
12 const blink::WebSize& cumulative_scroll)
13 : velocity_(velocity),
14 cumulative_scroll_(cumulative_scroll) {
17 WebGestureCurveMock::~WebGestureCurveMock() {
20 bool WebGestureCurveMock::apply(double time,
21 blink::WebGestureCurveTarget* target) {
22 blink::WebSize displacement(velocity_.x * time, velocity_.y * time);
23 blink::WebFloatSize increment(displacement.width - cumulative_scroll_.width,
24 displacement.height - cumulative_scroll_.height);
25 cumulative_scroll_ = displacement;
26 blink::WebFloatSize velocity(velocity_.x, velocity_.y);
27 // scrollBy() could delete this curve if the animation is over, so don't
28 // touch any member variables after making that call.
29 target->scrollBy(increment, velocity);
30 return true;