| 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 20 matching lines...) Expand all Loading... |
| 31 TimeTicks time, | 31 TimeTicks time, |
| 32 float x0, | 32 float x0, |
| 33 float y0, | 33 float y0, |
| 34 float x1, | 34 float x1, |
| 35 float y1) | 35 float y1) |
| 36 : action(action), pointer_count(2), time(time), id(0) { | 36 : action(action), pointer_count(2), time(time), id(0) { |
| 37 points[0].SetPoint(x0, y0); | 37 points[0].SetPoint(x0, y0); |
| 38 points[1].SetPoint(x1, y1); | 38 points[1].SetPoint(x1, y1); |
| 39 } | 39 } |
| 40 | 40 |
| 41 MockMotionEvent::MockMotionEvent(Action action, |
| 42 TimeTicks time, |
| 43 float x0, |
| 44 float y0, |
| 45 float x1, |
| 46 float y1, |
| 47 float x2, |
| 48 float y2) |
| 49 : action(action), pointer_count(3), time(time), id(0) { |
| 50 points[0].SetPoint(x0, y0); |
| 51 points[1].SetPoint(x1, y1); |
| 52 points[2].SetPoint(x2, y2); |
| 53 } |
| 54 |
| 41 MockMotionEvent::MockMotionEvent(const MockMotionEvent& other) | 55 MockMotionEvent::MockMotionEvent(const MockMotionEvent& other) |
| 42 : action(other.action), | 56 : action(other.action), |
| 43 pointer_count(other.pointer_count), | 57 pointer_count(other.pointer_count), |
| 44 time(other.time), | 58 time(other.time), |
| 45 id(other.GetId()) { | 59 id(other.GetId()) { |
| 46 points[0] = other.points[0]; | 60 points[0] = other.points[0]; |
| 47 points[1] = other.points[1]; | 61 points[1] = other.points[1]; |
| 48 } | 62 } |
| 49 | 63 |
| 50 MockMotionEvent::~MockMotionEvent() {} | 64 MockMotionEvent::~MockMotionEvent() {} |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 162 } |
| 149 | 163 |
| 150 void MockMotionEvent::CancelPoint() { | 164 void MockMotionEvent::CancelPoint() { |
| 151 DCHECK_GT(pointer_count, 0U); | 165 DCHECK_GT(pointer_count, 0U); |
| 152 if (pointer_count > 1) | 166 if (pointer_count > 1) |
| 153 --pointer_count; | 167 --pointer_count; |
| 154 action = ACTION_CANCEL; | 168 action = ACTION_CANCEL; |
| 155 } | 169 } |
| 156 | 170 |
| 157 } // namespace ui | 171 } // namespace ui |
| OLD | NEW |