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

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

Issue 831903004: [WebView] Add a new flushVisualState API to AwContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 5 years, 11 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/AwContentsRenderTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java
index 963e336ab16813e7e82cc10c60b00115112299d4..816e4c596a4df6862d93ad7d282ff0f5bc9ee6e7 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java
@@ -4,11 +4,11 @@
package org.chromium.android_webview.test;
-import android.graphics.Bitmap;
import android.graphics.Color;
import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.android_webview.AwContents;
+import org.chromium.android_webview.test.util.GraphicsTestUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature;
@@ -40,17 +40,11 @@ public class AwContentsRenderTest extends AwTestBase {
});
}
- Bitmap grabViewToBitmap() {
- final Bitmap result = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888);
- mAwContents.onDraw(new android.graphics.Canvas(result));
- return result;
- }
-
int sampleBackgroundColorOnUiThread() throws Exception {
return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
- return grabViewToBitmap().getPixel(0, 0);
+ return GraphicsTestUtils.drawAwContents(mAwContents, 10, 10).getPixel(0, 0);
}
});
}
@@ -82,8 +76,8 @@ public class AwContentsRenderTest extends AwTestBase {
pollForBackgroundColor(Color.YELLOW);
loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
- "data:text/html,<html><head><style>body {background-color:#227788}</style></head>" +
- "<body></body></html>");
+ "data:text/html,<html><head><style>body {background-color:#227788}</style></head>"
+ + "<body></body></html>");
pollForBackgroundColor(Color.rgb(0x22, 0x77, 0x88));
// Changing the base background should not override CSS background.

Powered by Google App Engine
This is Rietveld 408576698