summaryrefslogtreecommitdiffstats
path: root/content/test/web_gesture_curve_mock.h
blob: 8f1fafeeb731b6c98678e7be5c74c52dc894dbb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_TEST_WEB_GESTURE_CURVE_MOCK_H_
#define CONTENT_TEST_WEB_GESTURE_CURVE_MOCK_H_

#include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/public/platform/WebFloatPoint.h"
#include "third_party/WebKit/public/platform/WebGestureCurve.h"
#include "third_party/WebKit/public/platform/WebSize.h"

// A simple class for mocking a WebGestureCurve. The curve flings at velocity
// indefinitely.
class WebGestureCurveMock : public blink::WebGestureCurve {
 public:
  WebGestureCurveMock(const blink::WebFloatPoint& velocity,
                      const blink::WebSize& cumulative_scroll);
  ~WebGestureCurveMock() override;

  // Returns false if curve has finished and can no longer be applied.
  bool apply(double time, blink::WebGestureCurveTarget* target) override;

 private:
  blink::WebFloatPoint velocity_;
  blink::WebSize cumulative_scroll_;

  DISALLOW_COPY_AND_ASSIGN(WebGestureCurveMock);
};

#endif  // CONTENT_TEST_WEB_GESTURE_CURVE_MOCK_H_