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

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

Issue 2843543002: Missing source pointer down events are handled. (Closed)
Patch Set: Created 3 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
Index: ui/events/gesture_detection/gesture_provider_unittest.cc
diff --git a/ui/events/gesture_detection/gesture_provider_unittest.cc b/ui/events/gesture_detection/gesture_provider_unittest.cc
index 7987d4aa7ff74f151a578fa2a73092c6f7efa82a..43cf3bd2dea1f043b7e1d92c1c277aaaa38c854a 100644
--- a/ui/events/gesture_detection/gesture_provider_unittest.cc
+++ b/ui/events/gesture_detection/gesture_provider_unittest.cc
@@ -1033,6 +1033,38 @@ TEST_F(GestureProviderTest, SlopRegionCheckOnTwoFingerScroll) {
EXPECT_EQ(5U, GetReceivedGestureCount());
}
+TEST_F(GestureProviderTest, SlopRegionCheckOnMissingSecondaryPointerDownEvent) {
tdresser 2017/05/11 16:57:27 Add a link to the bug here.
sahel 2017/05/11 17:26:19 Done.
+ EnableTwoFingerTap(kMaxTwoFingerTapSeparation, base::TimeDelta());
+ const float scaled_touch_slop = GetTouchSlop();
+
+ base::TimeTicks event_time = base::TimeTicks::Now();
+
+ MockMotionEvent event =
+ ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, 0, 0);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ // Don't send ACTION_POINTER_DOWN event to the gesture_provider.
+ // This is for simulating the cases that the ACTION_POINTER_DOWN event is
+ // missing from the event sequence.
+ event = ObtainMotionEvent(event_time, MotionEvent::ACTION_POINTER_DOWN, 0, 0,
+ kMaxTwoFingerTapSeparation / 2, 0);
+
+ event.MovePoint(1, 0, 3 * scaled_touch_slop);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ event.ReleasePointAtIndex(0);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ event.ReleasePoint();
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ // No scroll happens since the source pointer down event for the moved
+ // pointer is not found. No two finger tap happens since one of the pointers
+ // moved beyond its slop region.
+ EXPECT_EQ(ET_GESTURE_TAP_DOWN, GetReceivedGesture(0).type());
+ EXPECT_EQ(1U, GetReceivedGestureCount());
+}
+
TEST_F(GestureProviderTest, NoSlopRegionCheckOnThreeFingerScroll) {
EnableTwoFingerTap(kMaxTwoFingerTapSeparation, base::TimeDelta());
const float scaled_touch_slop = GetTouchSlop();

Powered by Google App Engine
This is Rietveld 408576698