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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.content.ComponentCallbacks2; 9 import android.content.ComponentCallbacks2;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 @Override 2062 @Override
2063 public void handleJavaScriptResult(String jsonResult) { 2063 public void handleJavaScriptResult(String jsonResult) {
2064 callback.onReceiveValue(jsonResult); 2064 callback.onReceiveValue(jsonResult);
2065 } 2065 }
2066 }; 2066 };
2067 } 2067 }
2068 2068
2069 mWebContents.evaluateJavaScript(script, jsCallback); 2069 mWebContents.evaluateJavaScript(script, jsCallback);
2070 } 2070 }
2071 2071
2072 public void evaluateJavaScriptForTests(String script, final ValueCallback<St ring> callback) {
2073 if (TRACE) Log.d(TAG, "evaluateJavascriptForTests=" + script);
2074 if (isDestroyed()) return;
2075 JavaScriptCallback jsCallback = null;
2076 if (callback != null) {
2077 jsCallback = new JavaScriptCallback() {
2078 @Override
2079 public void handleJavaScriptResult(String jsonResult) {
2080 callback.onReceiveValue(jsonResult);
2081 }
2082 };
2083 }
2084
2085 mWebContents.evaluateJavaScriptForTests(script, jsCallback);
2086 }
2087
2088 /** 2072 /**
2089 * Post a message to a frame. 2073 * Post a message to a frame.
2090 * 2074 *
2091 * @param frameName The name of the frame. If the name is null the message i s posted 2075 * @param frameName The name of the frame. If the name is null the message i s posted
2092 * to the main frame. 2076 * to the main frame.
2093 * @param message The message 2077 * @param message The message
2094 * @param targetOrigin The target origin 2078 * @param targetOrigin The target origin
2095 * @param sentPorts The sent message ports, if any. Pass null if there is no 2079 * @param sentPorts The sent message ports, if any. Pass null if there is no
2096 * message ports to pass. 2080 * message ports to pass.
2097 */ 2081 */
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
3135 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo rter awPdfExporter); 3119 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo rter awPdfExporter);
3136 3120
3137 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin, 3121 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin,
3138 long resources); 3122 long resources);
3139 3123
3140 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId, 3124 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId,
3141 String message, String targetOrigin, int[] msgPorts); 3125 String message, String targetOrigin, int[] msgPorts);
3142 3126
3143 private native void nativeCreateMessageChannel(long nativeAwContents, AwMess agePort[] ports); 3127 private native void nativeCreateMessageChannel(long nativeAwContents, AwMess agePort[] ports);
3144 } 3128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698