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

Unified Diff: ui/events/gestures/motion_event_aura_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/gestures/motion_event_aura.cc ('k') | ui/events/test/motion_event_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gestures/motion_event_aura_unittest.cc
diff --git a/ui/events/gestures/motion_event_aura_unittest.cc b/ui/events/gestures/motion_event_aura_unittest.cc
index 8decac0bc198a35eecc5416fb5f5d6533cc24019..03a8dd7fff12e6c33e151fd09ea5d2d136a0a902 100644
--- a/ui/events/gestures/motion_event_aura_unittest.cc
+++ b/ui/events/gestures/motion_event_aura_unittest.cc
@@ -113,6 +113,7 @@ TEST(MotionEventAuraTest, PointerCountAndIds) {
EXPECT_EQ(2U, clone->GetPointerCount());
EXPECT_EQ(ids[0], clone->GetPointerId(0));
EXPECT_EQ(ids[2], clone->GetPointerId(1));
+ EXPECT_EQ(event.GetUniqueEventId(), clone->GetUniqueEventId());
EXPECT_EQ(test::ToString(event), test::ToString(*clone));
TouchEvent release0 = TouchWithType(ET_TOUCH_RELEASED, ids[0]);
@@ -207,6 +208,7 @@ TEST(MotionEventAuraTest, PointerLocations) {
// Test cloning of pointer location information.
scoped_ptr<MotionEvent> clone = event.Clone();
+ EXPECT_EQ(event.GetUniqueEventId(), clone->GetUniqueEventId());
EXPECT_EQ(test::ToString(event), test::ToString(*clone));
EXPECT_EQ(2U, clone->GetPointerCount());
EXPECT_FLOAT_EQ(x, clone->GetX(1));
@@ -285,6 +287,7 @@ TEST(MotionEventAuraTest, TapParams) {
// Test cloning of tap params
// TODO(mustaq): Make a separate clone test, crbug.com/450655
scoped_ptr<MotionEvent> clone = event.Clone();
+ EXPECT_EQ(event.GetUniqueEventId(), clone->GetUniqueEventId());
EXPECT_EQ(test::ToString(event), test::ToString(*clone));
EXPECT_EQ(2U, clone->GetPointerCount());
EXPECT_FLOAT_EQ(radius_y, clone->GetTouchMajor(1) / 2);
@@ -490,4 +493,22 @@ TEST(MotionEventAuraTest, IgnoresStationaryMoves) {
EXPECT_FALSE(event.OnTouch(move1));
}
+// Test after converting touch events into motion events, motion events should
+// have the same unique_event_id as touch events.
+TEST(MotionEventAuraTest, UniqueEventID) {
+ MotionEventAura event;
+
+ TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, 3);
+ EXPECT_TRUE(event.OnTouch(press0));
+ EXPECT_EQ(MotionEvent::ACTION_DOWN, event.GetAction());
+ ASSERT_EQ(1U, event.GetPointerCount());
+ EXPECT_EQ(event.GetUniqueEventId(), press0.unique_event_id());
+
+ TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, 6);
+ EXPECT_TRUE(event.OnTouch(press1));
+ EXPECT_EQ(MotionEvent::ACTION_POINTER_DOWN, event.GetAction());
+ EXPECT_EQ(2U, event.GetPointerCount());
+ EXPECT_EQ(event.GetUniqueEventId(), press1.unique_event_id());
+}
+
} // namespace ui
« no previous file with comments | « ui/events/gestures/motion_event_aura.cc ('k') | ui/events/test/motion_event_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698