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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.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/util/GraphicsTestUtils.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java
index 7b125061062a1f63d5dbe42201fecd435078d1a4..b27c76630aae629c300b3a24b895fbe50a42193f 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java
@@ -10,6 +10,7 @@ import android.view.View;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.AwTestBase;
+import org.chromium.android_webview.test.AwTestContainerView;
import org.chromium.base.ThreadUtils;
import java.util.concurrent.Callable;
@@ -78,6 +79,19 @@ public class GraphicsTestUtils {
});
}
+ // Gets the pixel color at the center of AwContents.
+ public static int getPixelColorAtCenterOfView(
+ final AwContents awContents, final AwTestContainerView testContainerView) {
+ return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Integer>() {
+ @Override
+ public Integer call() {
+ return drawAwContents(awContents, 2, 2, -(float) testContainerView.getWidth() / 2,
+ -(float) testContainerView.getHeight() / 2)
+ .getPixel(0, 0);
+ }
+ });
+ }
+
public static void pollForBackgroundColor(final AwContents awContents, final int c)
throws Throwable {
AwTestBase.pollInstrumentationThread(new Callable<Boolean>() {
« no previous file with comments | « android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java ('k') | android_webview/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698