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>() { |