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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java

Issue 552813002: [android_webview] Use a MotionEvent to trigger ShouldInterceptRequest tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
index d83c96a161ad5ebff4592afdf21dcc1e40c16c6c..7a66bbdbbd15f36f21d989747a4bfb4702016598 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
@@ -4,12 +4,16 @@
package org.chromium.android_webview.test;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.Pair;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.AwContentsClient.ShouldInterceptRequestParams;
import org.chromium.android_webview.AwWebResourceResponse;
+import org.chromium.android_webview.test.util.AwTestTouchUtils;
import org.chromium.android_webview.test.util.CommonResources;
import org.chromium.android_webview.test.util.JSUtils;
import org.chromium.base.test.util.Feature;
@@ -236,9 +240,25 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase {
assertEquals(false,
mShouldInterceptRequestHelper.getParamsForUrl(pageWithLinkUrl).hasUserGesture);
+ // TODO(mkosiba): Remove this once we have a real API to wait for the page to load and
+ // display.
+ // http://crbug.com/364612
+ //
+ // The code here is waiting for the "link" (which is a full-screen blue div) to appear on
+ // screen.
+ pollOnUiThread(new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ Bitmap bitmap = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(bitmap);
+ canvas.translate(-(float)mTestContainerView.getWidth() / 2,
+ -(float)mTestContainerView.getHeight() / 2);
+ mAwContents.onDraw(canvas);
+ return bitmap.getPixel(0, 0) == Color.BLUE;
+ }
+ });
callCount = mShouldInterceptRequestHelper.getCallCount();
- JSUtils.clickOnLinkUsingJs(this, mAwContents,
- mContentsClient.getOnEvaluateJavaScriptResultHelper(), "link");
+ AwTestTouchUtils.simulateTouchCenterOfView(mTestContainerView);
mShouldInterceptRequestHelper.waitForCallback(callCount);
assertEquals(true,
mShouldInterceptRequestHelper.getParamsForUrl(aboutPageUrl).hasUserGesture);
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698