Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / events / test / mock_motion_event.h
blob9ae9a71980cdf9df6a5be3721b1c005f9007d425
1 // Copyright 2014 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 <vector>
7 #include "base/basictypes.h"
8 #include "base/time/time.h"
9 #include "ui/events/gesture_detection/motion_event_generic.h"
10 #include "ui/gfx/geometry/point_f.h"
12 namespace ui {
13 namespace test {
15 struct MockMotionEvent : public MotionEventGeneric {
16 enum { TOUCH_MAJOR = 10 };
18 MockMotionEvent();
19 explicit MockMotionEvent(Action action);
20 MockMotionEvent(Action action, base::TimeTicks time, float x, float y);
21 MockMotionEvent(Action action,
22 base::TimeTicks time,
23 float x0,
24 float y0,
25 float x1,
26 float y1);
27 MockMotionEvent(Action action,
28 base::TimeTicks time,
29 float x0,
30 float y0,
31 float x1,
32 float y1,
33 float x2,
34 float y2);
35 MockMotionEvent(Action action,
36 base::TimeTicks time,
37 const std::vector<gfx::PointF>& positions);
38 MockMotionEvent(const MockMotionEvent& other);
40 virtual ~MockMotionEvent();
42 // MotionEvent methods.
43 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE;
44 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE;
46 // Utility methods.
47 void PressPoint(float x, float y);
48 void MovePoint(size_t index, float x, float y);
49 void ReleasePoint();
50 void CancelPoint();
51 void SetTouchMajor(float new_touch_major);
52 void SetRawOffset(float raw_offset_x, float raw_offset_y);
53 void SetToolType(size_t index, ToolType tool_type);
55 private:
56 void PushPointer(float x, float y);
57 void ResolvePointers();
60 } // namespace test
61 } // namespace ui