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

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

Issue 2691073003: Add javatests for the WebView SafeBrowsing feature (Closed)
Patch Set: Move getPixelColorAtCenterOfView to GraphicsTestUtils Created 3 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
Index: android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
index dd079f1baaf1f5969852bd23d70cc5c821062187..f2267e288d98fa9a2177abc917b19e989eb354cd 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
@@ -8,7 +8,6 @@ import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
import android.app.Instrumentation;
import android.content.Context;
-import android.graphics.Bitmap;
import android.os.Build;
import android.util.AndroidRuntimeException;
import android.util.Log;
@@ -104,11 +103,16 @@ public class AwTestBase
getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
- mBrowserContext = new AwBrowserContext(prefs, appContext);
+ mBrowserContext = createAwBrowserContextOnUiThread(prefs, appContext);
}
});
}
+ protected AwBrowserContext createAwBrowserContextOnUiThread(
+ InMemorySharedPreferences prefs, Context appContext) {
+ return new AwBrowserContext(prefs, appContext);
+ }
+
protected void startBrowserProcess() throws Exception {
// The Activity must be launched in order for proper webview statics to be setup.
getActivity();
@@ -374,10 +378,8 @@ public class AwTestBase
pollUiThread(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
- Bitmap bitmap = GraphicsTestUtils.drawAwContents(awContents, 2, 2,
- -(float) testContainerView.getWidth() / 2,
- -(float) testContainerView.getHeight() / 2);
- return bitmap.getPixel(0, 0) == expectedColor;
+ return GraphicsTestUtils.getPixelColorAtCenterOfView(awContents, testContainerView)
+ == expectedColor;
}
});
}
« no previous file with comments | « android_webview/javatests/DEPS ('k') | android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698