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

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

Issue 2175803002: The helper functions for slop region check and subtraction are modified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/gesture_provider.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/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 6be69847501c4a661da6f29abe2444b99e7ca19d..76c7a28b183fd99c86db5dc693c0b4293ebcaffe 100644
--- a/ui/events/gesture_detection/gesture_provider_unittest.cc
+++ b/ui/events/gesture_detection/gesture_provider_unittest.cc
@@ -1064,6 +1064,39 @@ TEST_F(GestureProviderTest, NoSlopRegionCheckOnThreeFingerScroll) {
EXPECT_EQ(3U, GetReceivedGestureCount());
}
+TEST_F(GestureProviderTest, ScrollStartWithSecondaryPointer) {
+ 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));
+
+ event = ObtainMotionEvent(event_time, MotionEvent::ACTION_POINTER_DOWN, 0, 0,
+ kMaxTwoFingerTapSeparation / 2, 0);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ // Wait for the two finger tap timeout, and put the second pointer down.
+ event_time += kOneSecond;
+ event.set_event_time(event_time);
+ event.ReleasePointAtIndex(0);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ event.MovePoint(0, kMaxTwoFingerTapSeparation / 2, 2 * scaled_touch_slop);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ event.ReleasePoint();
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ EXPECT_EQ(ET_GESTURE_TAP_DOWN, GetReceivedGesture(0).type());
+ EXPECT_EQ(ET_GESTURE_SCROLL_BEGIN, GetReceivedGesture(1).type());
+ EXPECT_EQ(ET_GESTURE_SCROLL_UPDATE, GetReceivedGesture(2).type());
+ EXPECT_EQ(ET_GESTURE_SCROLL_END, GetReceivedGesture(3).type());
+ EXPECT_EQ(4U, GetReceivedGestureCount());
+}
+
TEST_F(GestureProviderTest, LongPressAndTapCancelledWhenScrollBegins) {
base::TimeTicks event_time = base::TimeTicks::Now();
« no previous file with comments | « ui/events/gesture_detection/gesture_provider.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