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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/LongPressDetectorTest.java

Issue 12223101: [Android] Cancel long press on ACTION_CANCEL as well (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « content/public/android/java/src/org/chromium/content/browser/LongPressDetector.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/javatests/src/org/chromium/content/browser/LongPressDetectorTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/LongPressDetectorTest.java b/content/public/android/javatests/src/org/chromium/content/browser/LongPressDetectorTest.java
index 4994ac47aed95e0592069aeb94757e87e7576de0..f3348176fa6c01df636fad16f577374de30b317c 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/LongPressDetectorTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/LongPressDetectorTest.java
@@ -51,14 +51,7 @@ public class LongPressDetectorTest extends InstrumentationTestCase {
assertTrue("Should have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage());
}
- /**
- * Verify a DOWN with a corresponding UP will not have a pending Gesture.
- *
- * @throws Exception
- */
- @SmallTest
- @Feature({"AndroidWebView"})
- public void testGestureNoLongPress() throws Exception {
+ private void gestureNoLongPressTestHelper(int cancelActionType) throws Exception {
final long downTime = SystemClock.uptimeMillis();
final long eventTime = SystemClock.uptimeMillis();
@@ -67,12 +60,34 @@ public class LongPressDetectorTest extends InstrumentationTestCase {
assertTrue("Should have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage());
- event = motionEvent(MotionEvent.ACTION_UP, downTime, eventTime + 10);
+ event = motionEvent(cancelActionType, downTime, eventTime + 10);
mLongPressDetector.cancelLongPressIfNeeded(event);
assertTrue("Should not have a pending LONG_PRESS", !mLongPressDetector.hasPendingMessage());
}
/**
+ * Verify a DOWN with a corresponding UP will not have a pending Gesture.
+ *
+ * @throws Exception
+ */
+ @SmallTest
+ @Feature({"AndroidWebView"})
+ public void testGestureNoLongPressOnUp() throws Exception {
+ gestureNoLongPressTestHelper(MotionEvent.ACTION_UP);
+ }
+
+ /**
+ * Verify a DOWN with a corresponding CANCEL will not have a pending Gesture.
+ *
+ * @throws Exception
+ */
+ @SmallTest
+ @Feature({"AndroidWebView"})
+ public void testGestureNoLongPressOnCancel() throws Exception {
+ gestureNoLongPressTestHelper(MotionEvent.ACTION_CANCEL);
+ }
+
+ /**
* Verify that a DOWN followed by an UP after the long press timer would
* detect a long press (that is, the UP will not trigger a tap or cancel the
* long press).
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/LongPressDetector.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698