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/test/mock_motion_event.h" | 5 #include "ui/events/test/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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 MockMotionEvent::~MockMotionEvent() {} | 88 MockMotionEvent::~MockMotionEvent() {} |
89 | 89 |
90 scoped_ptr<MotionEvent> MockMotionEvent::Clone() const { | 90 scoped_ptr<MotionEvent> MockMotionEvent::Clone() const { |
91 return scoped_ptr<MotionEvent>(new MockMotionEvent(*this)); | 91 return scoped_ptr<MotionEvent>(new MockMotionEvent(*this)); |
92 } | 92 } |
93 | 93 |
94 scoped_ptr<MotionEvent> MockMotionEvent::Cancel() const { | 94 scoped_ptr<MotionEvent> MockMotionEvent::Cancel() const { |
95 scoped_ptr<MockMotionEvent> event(new MockMotionEvent(*this)); | 95 scoped_ptr<MockMotionEvent> event(new MockMotionEvent(*this)); |
96 event->set_action(MotionEvent::ACTION_CANCEL); | 96 event->set_action(MotionEvent::ACTION_CANCEL); |
97 return event.PassAs<MotionEvent>(); | 97 return event.Pass(); |
98 } | 98 } |
99 | 99 |
100 void MockMotionEvent::PressPoint(float x, float y) { | 100 void MockMotionEvent::PressPoint(float x, float y) { |
101 ResolvePointers(); | 101 ResolvePointers(); |
102 PushPointer(x, y); | 102 PushPointer(x, y); |
103 if (GetPointerCount() > 1) { | 103 if (GetPointerCount() > 1) { |
104 set_action_index(static_cast<int>(GetPointerCount()) - 1); | 104 set_action_index(static_cast<int>(GetPointerCount()) - 1); |
105 set_action(ACTION_POINTER_DOWN); | 105 set_action(ACTION_POINTER_DOWN); |
106 } else { | 106 } else { |
107 set_action(ACTION_DOWN); | 107 set_action(ACTION_DOWN); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 case ACTION_CANCEL: | 168 case ACTION_CANCEL: |
169 PopPointer(); | 169 PopPointer(); |
170 return; | 170 return; |
171 default: | 171 default: |
172 break; | 172 break; |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 } // namespace test | 176 } // namespace test |
177 } // namespace ui | 177 } // namespace ui |
OLD | NEW |