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

Unified Diff: ui/events/test/motion_event_test_utils.cc

Issue 1087893003: Support longpress drag selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/test/motion_event_test_utils.cc
diff --git a/ui/events/test/motion_event_test_utils.cc b/ui/events/test/motion_event_test_utils.cc
index fe5b747ee2aaaf4b80578198e575d3134d88b538..e615a7ea5dcde510e08d8003be9314fa25bb7e6b 100644
--- a/ui/events/test/motion_event_test_utils.cc
+++ b/ui/events/test/motion_event_test_utils.cc
@@ -90,7 +90,7 @@ MockMotionEvent::MockMotionEvent(const MockMotionEvent& other)
MockMotionEvent::~MockMotionEvent() {
}
-void MockMotionEvent::PressPoint(float x, float y) {
+MockMotionEvent& MockMotionEvent::PressPoint(float x, float y) {
ResolvePointers();
PushPointer(x, y);
if (GetPointerCount() > 1) {
@@ -99,9 +99,10 @@ void MockMotionEvent::PressPoint(float x, float y) {
} else {
set_action(ACTION_DOWN);
}
+ return *this;
}
-void MockMotionEvent::MovePoint(size_t index, float x, float y) {
+MockMotionEvent& MockMotionEvent::MovePoint(size_t index, float x, float y) {
ResolvePointers();
DCHECK_LT(index, GetPointerCount());
PointerProperties& p = pointer(index);
@@ -112,9 +113,10 @@ void MockMotionEvent::MovePoint(size_t index, float x, float y) {
p.raw_x += dx;
p.raw_y += dy;
set_action(ACTION_MOVE);
+ return *this;
}
-void MockMotionEvent::ReleasePoint() {
+MockMotionEvent& MockMotionEvent::ReleasePoint() {
ResolvePointers();
DCHECK_GT(GetPointerCount(), 0U);
if (GetPointerCount() > 1) {
@@ -123,29 +125,36 @@ void MockMotionEvent::ReleasePoint() {
} else {
set_action(ACTION_UP);
}
+ return *this;
}
-void MockMotionEvent::CancelPoint() {
+MockMotionEvent& MockMotionEvent::CancelPoint() {
ResolvePointers();
DCHECK_GT(GetPointerCount(), 0U);
set_action(ACTION_CANCEL);
+ return *this;
}
-void MockMotionEvent::SetTouchMajor(float new_touch_major) {
+MockMotionEvent& MockMotionEvent::SetTouchMajor(float new_touch_major) {
for (size_t i = 0; i < GetPointerCount(); ++i)
pointer(i).touch_major = new_touch_major;
+ return *this;
}
-void MockMotionEvent::SetRawOffset(float raw_offset_x, float raw_offset_y) {
+MockMotionEvent& MockMotionEvent::SetRawOffset(float raw_offset_x,
+ float raw_offset_y) {
for (size_t i = 0; i < GetPointerCount(); ++i) {
pointer(i).raw_x = pointer(i).x + raw_offset_x;
pointer(i).raw_y = pointer(i).y + raw_offset_y;
}
+ return *this;
}
-void MockMotionEvent::SetToolType(size_t pointer_index, ToolType tool_type) {
+MockMotionEvent& MockMotionEvent::SetToolType(size_t pointer_index,
+ ToolType tool_type) {
DCHECK_LT(pointer_index, GetPointerCount());
pointer(pointer_index).tool_type = tool_type;
+ return *this;
}
void MockMotionEvent::PushPointer(float x, float y) {
@@ -166,9 +175,10 @@ void MockMotionEvent::ResolvePointers() {
}
}
-void MockMotionEvent::SetPrimaryPointerId(int id) {
+MockMotionEvent& MockMotionEvent::SetPrimaryPointerId(int id) {
DCHECK_GT(GetPointerCount(), 0U);
pointer(0).id = id;
+ return *this;
}
std::string ToString(const MotionEvent& event) {

Powered by Google App Engine
This is Rietveld 408576698