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

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

Issue 23346003: [Android] Add mechanism to disable double tap/drag zooming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: joth comment. Created 7 years, 4 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/ContentViewGestureHandler.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/ContentViewGestureHandlerTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewGestureHandlerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewGestureHandlerTest.java
index 2647b3a2f592dbd1e1aa030c7aa137265ad310a6..f7d29e44766c21e9c6efae9be25507c5ec8ccae7 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewGestureHandlerTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewGestureHandlerTest.java
@@ -890,6 +890,73 @@ public class ContentViewGestureHandlerTest extends InstrumentationTestCase {
}
/**
+ * Verify that double tap drag zoom feature is not invoked
+ * when it is disabled..
+ * @throws Exception
+ */
+ @SmallTest
+ @Feature({"Gestures"})
+ public void testDoubleTapDragZoomNothingWhenDisabled() throws Exception {
+ final long downTime1 = SystemClock.uptimeMillis();
+ final long downTime2 = downTime1 + 100;
+
+ GestureRecordingMotionEventDelegate mockDelegate =
+ new GestureRecordingMotionEventDelegate();
+ mGestureHandler = new ContentViewGestureHandler(
+ getInstrumentation().getTargetContext(), mockDelegate,
+ new MockZoomManager(getInstrumentation().getTargetContext(), null),
+ ContentViewCore.INPUT_EVENTS_DELIVERED_AT_VSYNC);
+
+ mGestureHandler.updateDoubleTapDragSupport(false);
+
+ MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime1, downTime1);
+ assertTrue(mGestureHandler.onTouchEvent(event));
+
+ event = MotionEvent.obtain(
+ downTime1, downTime1 + 5, MotionEvent.ACTION_UP,
+ FAKE_COORD_X, FAKE_COORD_Y, 0);
+ mGestureHandler.onTouchEvent(event);
+
+ event = MotionEvent.obtain(
+ downTime2, downTime2, MotionEvent.ACTION_DOWN,
+ FAKE_COORD_X, FAKE_COORD_Y, 0);
+ assertTrue(mGestureHandler.onTouchEvent(event));
+
+ event = MotionEvent.obtain(
+ downTime2, downTime2 + 5, MotionEvent.ACTION_MOVE,
+ FAKE_COORD_X, FAKE_COORD_Y + 100, 0);
+ // As double tap and drag to zoom is disabled, we won't handle
+ // the move event.
+ assertFalse(mGestureHandler.onTouchEvent(event));
+
+ assertFalse("No GESTURE_SCROLL_START should have been sent",
+ mockDelegate.mGestureTypeList.contains(
+ ContentViewGestureHandler.GESTURE_SCROLL_START));
+ assertTrue("No GESTURE_PINCH_BEGIN should have been sent",
+ ContentViewGestureHandler.GESTURE_PINCH_BEGIN !=
+ mockDelegate.mMostRecentGestureEvent.mType);
+
+ event = MotionEvent.obtain(
+ downTime2, downTime2 + 10, MotionEvent.ACTION_MOVE,
+ FAKE_COORD_X, FAKE_COORD_Y + 200, 0);
+ assertFalse(mGestureHandler.onTouchEvent(event));
+ assertFalse("No GESTURE_SCROLL_BY should have been sent",
+ mockDelegate.mGestureTypeList.contains(
+ ContentViewGestureHandler.GESTURE_SCROLL_BY));
+ assertTrue("No GESTURE_PINCH_BY should have been sent",
+ ContentViewGestureHandler.GESTURE_PINCH_BY !=
+ mockDelegate.mMostRecentGestureEvent.mType);
+
+ event = MotionEvent.obtain(
+ downTime2, downTime2 + 15, MotionEvent.ACTION_UP,
+ FAKE_COORD_X, FAKE_COORD_Y + 200, 0);
+ assertFalse(mGestureHandler.onTouchEvent(event));
+ assertFalse("No GESTURE_PINCH_END should have been sent",
+ mockDelegate.mGestureTypeList.contains(
+ ContentViewGestureHandler.GESTURE_PINCH_END));
+ }
+
+ /**
* Mock MotionEventDelegate that remembers the most recent gesture event.
*/
static class GestureRecordingMotionEventDelegate implements MotionEventDelegate {
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698