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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 3b7a1654a3c6bef5b674c891f1e32949adcafc86..8874bd7375ea74006664616fe1e7e41e5c7d1327 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -2069,6 +2069,22 @@ public class AwContents implements SmartClipProvider,
mWebContents.evaluateJavaScript(script, jsCallback);
}
+ public void evaluateJavaScriptForTests(String script, final ValueCallback<String> callback) {
+ if (TRACE) Log.d(TAG, "evaluateJavascriptForTests=" + script);
+ if (isDestroyed()) return;
+ JavaScriptCallback jsCallback = null;
+ if (callback != null) {
+ jsCallback = new JavaScriptCallback() {
+ @Override
+ public void handleJavaScriptResult(String jsonResult) {
+ callback.onReceiveValue(jsonResult);
+ }
+ };
+ }
+
+ mWebContents.evaluateJavaScriptForTests(script, jsCallback);
+ }
+
/**
* Post a message to a frame.
*

Powered by Google App Engine
This is Rietveld 408576698