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

Unified Diff: ui/events/gesture_detection/motion_event_generic_unittest.cc

Issue 999423003: Set the unique_event_id when converting from TouchEvent to WebTouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « ui/events/gesture_detection/motion_event_generic.cc ('k') | ui/events/gestures/motion_event_aura.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gesture_detection/motion_event_generic_unittest.cc
diff --git a/ui/events/gesture_detection/motion_event_generic_unittest.cc b/ui/events/gesture_detection/motion_event_generic_unittest.cc
index a67646b24f57a5f94a574cada63b75be91afc4d5..182eb1e48333c6a7ae1369fc00d4dcac656dad3d 100644
--- a/ui/events/gesture_detection/motion_event_generic_unittest.cc
+++ b/ui/events/gesture_detection/motion_event_generic_unittest.cc
@@ -17,6 +17,10 @@ TEST(MotionEventGenericTest, Basic) {
EXPECT_EQ(0U, event.GetHistorySize());
EXPECT_EQ(event_time, event.GetEventTime());
+ DCHECK_NE(0U, event.GetUniqueEventId());
+ event.set_unique_event_id(123456U);
+ EXPECT_EQ(123456U, event.GetUniqueEventId());
+
event.PushPointer(PointerProperties(8.3f, 4.7f, 0.9f));
ASSERT_EQ(2U, event.GetPointerCount());
EXPECT_EQ(8.3f, event.GetX(1));
@@ -27,8 +31,8 @@ TEST(MotionEventGenericTest, Basic) {
EXPECT_EQ(2.3f, event.GetX(2));
EXPECT_EQ(-3.7f, event.GetY(2));
- event.set_id(1);
- EXPECT_EQ(1, event.GetId());
+ event.pointer(0).id = 3;
+ EXPECT_EQ(3, event.GetPointerId(0));
event.set_action(MotionEvent::ACTION_POINTER_DOWN);
EXPECT_EQ(MotionEvent::ACTION_POINTER_DOWN, event.GetAction());
@@ -78,11 +82,11 @@ TEST(MotionEventGenericTest, Clone) {
MotionEventGeneric event(MotionEvent::ACTION_DOWN,
base::TimeTicks::Now(),
PointerProperties(8.3f, 4.7f, 2.f));
- event.set_id(1);
event.set_button_state(MotionEvent::BUTTON_PRIMARY);
scoped_ptr<MotionEvent> clone = event.Clone();
ASSERT_TRUE(clone);
+ EXPECT_EQ(event.GetUniqueEventId(), clone->GetUniqueEventId());
EXPECT_EQ(test::ToString(event), test::ToString(*clone));
}
@@ -103,6 +107,7 @@ TEST(MotionEventGenericTest, CloneWithHistory) {
scoped_ptr<MotionEvent> clone = event.Clone();
ASSERT_TRUE(clone);
+ EXPECT_EQ(event.GetUniqueEventId(), clone->GetUniqueEventId());
EXPECT_EQ(test::ToString(event), test::ToString(*clone));
}
@@ -110,12 +115,12 @@ TEST(MotionEventGenericTest, Cancel) {
MotionEventGeneric event(MotionEvent::ACTION_UP,
base::TimeTicks::Now(),
PointerProperties(8.7f, 4.3f, 1.f));
- event.set_id(2);
event.set_button_state(MotionEvent::BUTTON_SECONDARY);
scoped_ptr<MotionEvent> cancel = event.Cancel();
event.set_action(MotionEvent::ACTION_CANCEL);
ASSERT_TRUE(cancel);
+ EXPECT_NE(event.GetUniqueEventId(), cancel->GetUniqueEventId());
EXPECT_EQ(test::ToString(event), test::ToString(*cancel));
}
« no previous file with comments | « ui/events/gesture_detection/motion_event_generic.cc ('k') | ui/events/gestures/motion_event_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698