| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include <vector> | |
| 6 | |
| 7 #include "base/basictypes.h" | |
| 8 #include "base/time/time.h" | |
| 9 #include "ui/events/gesture_detection/motion_event.h" | |
| 10 #include "ui/gfx/geometry/point_f.h" | |
| 11 | |
| 12 namespace ui { | |
| 13 | |
| 14 struct MockMotionEvent : public MotionEvent { | |
| 15 enum { MAX_POINTERS = 3 }; | |
| 16 enum { TOUCH_MAJOR = 10 }; | |
| 17 | |
| 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); | |
| 39 virtual ~MockMotionEvent(); | |
| 40 | |
| 41 // MotionEvent methods. | |
| 42 virtual Action GetAction() const OVERRIDE; | |
| 43 virtual int GetActionIndex() const OVERRIDE; | |
| 44 virtual size_t GetPointerCount() const OVERRIDE; | |
| 45 virtual int GetId() const OVERRIDE; | |
| 46 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; | |
| 47 virtual float GetX(size_t pointer_index) const OVERRIDE; | |
| 48 virtual float GetY(size_t pointer_index) const OVERRIDE; | |
| 49 virtual float GetRawX(size_t pointer_index) const OVERRIDE; | |
| 50 virtual float GetRawY(size_t pointer_index) const OVERRIDE; | |
| 51 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; | |
| 52 virtual float GetPressure(size_t pointer_index) const OVERRIDE; | |
| 53 virtual base::TimeTicks GetEventTime() const OVERRIDE; | |
| 54 virtual size_t GetHistorySize() const OVERRIDE; | |
| 55 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const | |
| 56 OVERRIDE; | |
| 57 virtual float GetHistoricalTouchMajor(size_t pointer_index, | |
| 58 size_t historical_index) const OVERRIDE; | |
| 59 virtual float GetHistoricalX(size_t pointer_index, | |
| 60 size_t historical_index) const OVERRIDE; | |
| 61 virtual float GetHistoricalY(size_t pointer_index, | |
| 62 size_t historical_index) const OVERRIDE; | |
| 63 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; | |
| 64 virtual int GetButtonState() const OVERRIDE; | |
| 65 | |
| 66 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; | |
| 67 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; | |
| 68 | |
| 69 // Utility methods. | |
| 70 void SetId(int new_id); | |
| 71 void SetTime(base::TimeTicks new_time); | |
| 72 void PressPoint(float x, float y); | |
| 73 void MovePoint(size_t index, float x, float y); | |
| 74 void ReleasePoint(); | |
| 75 void CancelPoint(); | |
| 76 void SetTouchMajor(float new_touch_major); | |
| 77 void SetRawOffset(float raw_offset_x, float raw_offset_y); | |
| 78 | |
| 79 MotionEvent::Action action; | |
| 80 size_t pointer_count; | |
| 81 gfx::PointF points[MAX_POINTERS]; | |
| 82 gfx::Vector2dF raw_offset; | |
| 83 base::TimeTicks time; | |
| 84 float touch_major; | |
| 85 int id; | |
| 86 }; | |
| 87 | |
| 88 } // namespace ui | |
| OLD | NEW |