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

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

Issue 941713002: [WebView] Tests for visual state during fullscreen transitions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@breakSwapIfNoUpdates
Patch Set: Created 5 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 acce0fe26130a2fe6ca7f19dc0ba433bb7c90c7d..d41b7a389706540fecd56db7f8fd38f4184134ff 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
@@ -6,6 +6,7 @@ package org.chromium.android_webview.test.util;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.view.View;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.AwTestBase;
@@ -43,6 +44,20 @@ public class GraphicsTestUtils {
return doDrawAwContents(awContents, width, height, dx, dy);
}
+ /**
+ * Draws the supplied {@link View} into the returned {@link Bitmap}.
+ *
+ * @param view The view to draw
+ * @param width The width of the bitmap
+ * @param height The height of the bitmap
+ */
+ public static Bitmap drawView(View view, int width, int height) {
+ Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(bitmap);
+ view.draw(canvas);
+ return bitmap;
+ }
+
public static int sampleBackgroundColorOnUiThread(final AwContents awContents)
throws Exception {
return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {

Powered by Google App Engine
This is Rietveld 408576698