OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/gesture_detection/mock_motion_event.h" | 5 #include "ui/events/gesture_detection/mock_motion_event.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 using base::TimeTicks; | 9 using base::TimeTicks; |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 TimeTicks time, | 28 TimeTicks time, |
29 float x0, | 29 float x0, |
30 float y0, | 30 float y0, |
31 float x1, | 31 float x1, |
32 float y1) | 32 float y1) |
33 : action(action), pointer_count(2), time(time), id(0) { | 33 : action(action), pointer_count(2), time(time), id(0) { |
34 points[0].SetPoint(x0, y0); | 34 points[0].SetPoint(x0, y0); |
35 points[1].SetPoint(x1, y1); | 35 points[1].SetPoint(x1, y1); |
36 } | 36 } |
37 | 37 |
| 38 MockMotionEvent::MockMotionEvent(Action action, |
| 39 TimeTicks time, |
| 40 float x0, |
| 41 float y0, |
| 42 float x1, |
| 43 float y1, |
| 44 float x2, |
| 45 float y2) |
| 46 : action(action), pointer_count(3), time(time), id(0) { |
| 47 points[0].SetPoint(x0, y0); |
| 48 points[1].SetPoint(x1, y1); |
| 49 points[2].SetPoint(x2, y2); |
| 50 } |
| 51 |
38 MockMotionEvent::MockMotionEvent(const MockMotionEvent& other) | 52 MockMotionEvent::MockMotionEvent(const MockMotionEvent& other) |
39 : action(other.action), | 53 : action(other.action), |
40 pointer_count(other.pointer_count), | 54 pointer_count(other.pointer_count), |
41 time(other.time), | 55 time(other.time), |
42 id(other.GetId()) { | 56 id(other.GetId()) { |
43 points[0] = other.points[0]; | 57 points[0] = other.points[0]; |
44 points[1] = other.points[1]; | 58 points[1] = other.points[1]; |
45 } | 59 } |
46 | 60 |
47 MockMotionEvent::~MockMotionEvent() {} | 61 MockMotionEvent::~MockMotionEvent() {} |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 159 } |
146 | 160 |
147 void MockMotionEvent::CancelPoint() { | 161 void MockMotionEvent::CancelPoint() { |
148 DCHECK_GT(pointer_count, 0U); | 162 DCHECK_GT(pointer_count, 0U); |
149 if (pointer_count > 1) | 163 if (pointer_count > 1) |
150 --pointer_count; | 164 --pointer_count; |
151 action = ACTION_CANCEL; | 165 action = ACTION_CANCEL; |
152 } | 166 } |
153 | 167 |
154 } // namespace ui | 168 } // namespace ui |
OLD | NEW |