summaryrefslogtreecommitdiffstats
path: root/android_webview/javatests/src/org/chromium
diff options
context:
space:
mode:
authorboliu <boliu@chromium.org>2016-03-10 23:02:14 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-11 07:03:13 +0000
commitde5b75b1ccd0ef7f478318d805b3ba1c8ebf7130 (patch)
tree393ff97cfa98eda6ae12d59381dc0a71dbf22091 /android_webview/javatests/src/org/chromium
parenta2e46e0ffc404d3168c0af4c3b89d8ae5475cc3d (diff)
downloadchromium_src-de5b75b1ccd0ef7f478318d805b3ba1c8ebf7130.zip
chromium_src-de5b75b1ccd0ef7f478318d805b3ba1c8ebf7130.tar.gz
chromium_src-de5b75b1ccd0ef7f478318d805b3ba1c8ebf7130.tar.bz2
sync compositor: Merge input path with chrome
Use chrome's async input delivery path in Android WebView. See bug for potential incompatibility risk. Existing code path is not removed in case compatibility is an issue. Refactor out ui::SynchronousInputHandlerProxy parts from InputHandlerManagerClient into a separate interface so that sync compositor can use SynchronousInputHandlerProxy even without routing input synchronously. Then just stop filtering input events in sync compositor, hook up overscroll, and everything just works. Tests: testNoSpuriousOverScrolls requires synchronous input to maintain the property that a single scroll call happens. Asynchronously the test is not valid AwContents.zoomIn is no longer synchronous which breaks testPinchZoomUpdatesScrollRangeSynchronously. Can fix this independently if this becomes a problem later. BUG=545628 Review URL: https://codereview.chromium.org/1620053002 Cr-Commit-Position: refs/heads/master@{#380563}
Diffstat (limited to 'android_webview/javatests/src/org/chromium')
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java51
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java9
2 files changed, 11 insertions, 49 deletions
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
index 473acd4..ca277ba 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
@@ -15,6 +15,7 @@ import org.chromium.android_webview.test.util.CommonResources;
import org.chromium.android_webview.test.util.JavascriptEventObserver;
import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.SuppressFBWarnings;
+import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.content_public.browser.GestureStateListener;
@@ -23,7 +24,6 @@ import org.chromium.ui.gfx.DeviceDisplayInfo;
import java.util.Locale;
import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -472,8 +472,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
AwTestTouchUtils.dragCompleteView(testContainerView,
0, -targetScrollXPix, // these need to be negative as we're scrolling down.
0, -targetScrollYPix,
- dragSteps,
- null /* completionLatch */);
+ dragSteps);
for (int i = 1; i <= dragSteps; ++i) {
onScrollToCallbackHelper.waitForCallback(scrollToCallCount, i);
@@ -487,38 +486,6 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
@SmallTest
@Feature({"AndroidWebView"})
- public void testNoSpuriousOverScrolls() throws Throwable {
- final TestAwContentsClient contentsClient = new TestAwContentsClient();
- final ScrollTestContainerView testContainerView =
- (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient);
- enableJavaScriptOnUiThread(testContainerView.getAwContents());
-
- final int dragSteps = 1;
- final int targetScrollYPix = 40;
-
- setMaxScrollOnMainSync(testContainerView, 0, 0);
-
- loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null, "");
-
- final CallbackHelper onScrollToCallbackHelper =
- testContainerView.getOnScrollToCallbackHelper();
- final int scrollToCallCount = onScrollToCallbackHelper.getCallCount();
- CountDownLatch scrollingCompleteLatch = new CountDownLatch(1);
- AwTestTouchUtils.dragCompleteView(testContainerView,
- 0, 0, // these need to be negative as we're scrolling down.
- 0, -targetScrollYPix,
- dragSteps,
- scrollingCompleteLatch);
- try {
- scrollingCompleteLatch.await();
- } catch (InterruptedException ex) {
- // ignore
- }
- assertEquals(scrollToCallCount + 1, onScrollToCallbackHelper.getCallCount());
- }
-
- @SmallTest
- @Feature({"AndroidWebView"})
public void testOverScrollX() throws Throwable {
final TestAwContentsClient contentsClient = new TestAwContentsClient();
final ScrollTestContainerView testContainerView =
@@ -538,8 +505,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
AwTestTouchUtils.dragCompleteView(testContainerView,
0, overScrollDeltaX,
0, 0,
- oneStep,
- null /* completionLatch */);
+ oneStep);
overScrollByCallbackHelper.waitForCallback(overScrollCallCount);
// Unfortunately the gesture detector seems to 'eat' some number of pixels. For now
// checking that the value is < 0 (overscroll is reported as negative values) will have to
@@ -569,8 +535,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
AwTestTouchUtils.dragCompleteView(testContainerView,
0, 0,
0, overScrollDeltaY,
- oneStep,
- null /* completionLatch */);
+ oneStep);
overScrollByCallbackHelper.waitForCallback(overScrollCallCount);
assertEquals(0, overScrollByCallbackHelper.getDeltaX());
assertTrue(0 > overScrollByCallbackHelper.getDeltaY());
@@ -802,13 +767,17 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
AwTestTouchUtils.dragCompleteView(testContainerView,
0, -targetScrollXPix, // these need to be negative as we're scrolling down.
0, -targetScrollYPix,
- dragSteps,
- null /* completionLatch */);
+ dragSteps);
onScrollUpdateGestureConsumedHelper.waitForCallback(callCount);
}
+ /*
@SmallTest
@Feature({"AndroidWebView"})
+ Disabled because zoomIn is no longer synchronous. Fix if it's a compatibility problem.
+ See crbug.com/545628.
+ */
+ @DisabledTest
public void testPinchZoomUpdatesScrollRangeSynchronously() throws Throwable {
final TestAwContentsClient contentsClient = new TestAwContentsClient();
final ScrollTestContainerView testContainerView =
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java
index bdae4ec..c733076 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java
@@ -8,8 +8,6 @@ import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
-import java.util.concurrent.CountDownLatch;
-
/**
* A touch utility class that injects the events directly into the view.
* TODO(mkosiba): Merge with TestTouchUtils.
@@ -59,20 +57,15 @@ public class AwTestTouchUtils {
* @param fromY The relative y-coordinate of the start point of the drag.
* @param toY The relative y-coordinate of the end point of the drag.
* @param stepCount The total number of motion events that should be generated during the drag.
- * @param completionLatch The .countDown method is called on this latch once the drag finishes.
*/
public static void dragCompleteView(final View view, final int fromX, final int toX,
- final int fromY, final int toY, final int stepCount,
- final CountDownLatch completionLatch) {
+ final int fromY, final int toY, final int stepCount) {
view.post(new Runnable() {
@Override
public void run() {
long downTime = dragStart(view, fromX, fromY);
dragTo(view, fromX, toX, fromY, toY, stepCount, downTime);
dragEnd(view, toX, toY, downTime);
- if (completionLatch != null) {
- completionLatch.countDown();
- }
}
});
}