Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: ui/events/gesture_detection/mock_motion_event.h

Issue 181833003: [Android] Out with the Android GR, in with the new unified C++ GR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/time/time.h" 6 #include "base/time/time.h"
7 #include "ui/events/gesture_detection/motion_event.h" 7 #include "ui/events/gesture_detection/motion_event.h"
8 #include "ui/gfx/geometry/point_f.h" 8 #include "ui/gfx/geometry/point_f.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 struct MockMotionEvent : public MotionEvent { 12 struct MockMotionEvent : public MotionEvent {
13 enum { MAX_POINTERS = 3 };
14
15 MockMotionEvent();
16 explicit MockMotionEvent(Action action);
13 MockMotionEvent(Action action, base::TimeTicks time, float x, float y); 17 MockMotionEvent(Action action, base::TimeTicks time, float x, float y);
14 MockMotionEvent(Action action, 18 MockMotionEvent(Action action,
15 base::TimeTicks time, 19 base::TimeTicks time,
16 float x0, 20 float x0,
17 float y0, 21 float y0,
18 float x1, 22 float x1,
19 float y1); 23 float y1);
20 MockMotionEvent(const MockMotionEvent& other); 24 MockMotionEvent(const MockMotionEvent& other);
21 virtual ~MockMotionEvent(); 25 virtual ~MockMotionEvent();
22 26
27 // MotionEvent methods.
23 virtual Action GetAction() const OVERRIDE; 28 virtual Action GetAction() const OVERRIDE;
24 virtual int GetActionIndex() const OVERRIDE; 29 virtual int GetActionIndex() const OVERRIDE;
25 virtual size_t GetPointerCount() const OVERRIDE; 30 virtual size_t GetPointerCount() const OVERRIDE;
26 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; 31 virtual int GetPointerId(size_t pointer_index) const OVERRIDE;
27 virtual float GetX(size_t pointer_index) const OVERRIDE; 32 virtual float GetX(size_t pointer_index) const OVERRIDE;
28 virtual float GetY(size_t pointer_index) const OVERRIDE; 33 virtual float GetY(size_t pointer_index) const OVERRIDE;
29 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; 34 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE;
30 virtual base::TimeTicks GetEventTime() const OVERRIDE; 35 virtual base::TimeTicks GetEventTime() const OVERRIDE;
31 virtual size_t GetHistorySize() const OVERRIDE; 36 virtual size_t GetHistorySize() const OVERRIDE;
32 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const 37 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const
33 OVERRIDE; 38 OVERRIDE;
34 virtual float GetHistoricalTouchMajor(size_t pointer_index, 39 virtual float GetHistoricalTouchMajor(size_t pointer_index,
35 size_t historical_index) const OVERRIDE; 40 size_t historical_index) const OVERRIDE;
36 virtual float GetHistoricalX(size_t pointer_index, 41 virtual float GetHistoricalX(size_t pointer_index,
37 size_t historical_index) const OVERRIDE; 42 size_t historical_index) const OVERRIDE;
38 virtual float GetHistoricalY(size_t pointer_index, 43 virtual float GetHistoricalY(size_t pointer_index,
39 size_t historical_index) const OVERRIDE; 44 size_t historical_index) const OVERRIDE;
40 45
41 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; 46 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE;
42 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; 47 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE;
43 48
49 // Utility methods.
50 void PressPoint(float x, float y);
51 void MovePoint(size_t index, float x, float y);
52 void ReleasePoint();
53 void CancelPoint();
54
44 MotionEvent::Action action; 55 MotionEvent::Action action;
45 size_t pointer_count; 56 size_t pointer_count;
46 gfx::PointF points[2]; 57 gfx::PointF points[MAX_POINTERS];
47 base::TimeTicks time; 58 base::TimeTicks time;
48
49 private:
50 MockMotionEvent();
51 }; 59 };
52 60
53 } // namespace ui 61 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/gesture_provider_unittest.cc ('k') | ui/events/gesture_detection/mock_motion_event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698