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

Unified Diff: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java

Issue 572013002: Removing ContentViewCore dependencies from direct WebContents functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the patch and addressed review comments. Created 6 years, 2 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: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java
index daefd4f60ad52d8cd6ca01452632593436cd0e30..42457ccb7de1d0874c819e5868618343663009b1 100644
--- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java
+++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java
@@ -9,8 +9,8 @@ import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
import junit.framework.Assert;
import org.chromium.base.ThreadUtils;
-import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper;
+import org.chromium.content_public.browser.WebContents;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -26,9 +26,9 @@ public class JavaScriptUtils {
* Returns the result of its execution in JSON format.
*/
public static String executeJavaScriptAndWaitForResult(
- ContentViewCore viewCore, String code) throws InterruptedException, TimeoutException {
+ WebContents webContents, String code) throws InterruptedException, TimeoutException {
return executeJavaScriptAndWaitForResult(
- viewCore, code, EVALUATION_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ webContents, code, EVALUATION_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
/**
@@ -37,7 +37,7 @@ public class JavaScriptUtils {
* Returns the result of its execution in JSON format.
*/
public static String executeJavaScriptAndWaitForResult(
- final ContentViewCore viewCore,
+ final WebContents webContents,
final String code,
final long timeout,
final TimeUnit timeoutUnits)
@@ -50,7 +50,7 @@ public class JavaScriptUtils {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
- helper.evaluateJavaScript(viewCore, code);
+ helper.evaluateJavaScript(webContents, code);
}
});
helper.waitUntilHasValue(timeout, timeoutUnits);
@@ -61,11 +61,11 @@ public class JavaScriptUtils {
/**
* Executes the given snippet of JavaScript code but does not wait for the result.
*/
- public static void executeJavaScript(final ContentViewCore viewCore, final String code) {
+ public static void executeJavaScript(final WebContents webContents, final String code) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
- viewCore.evaluateJavaScript(code, null);
+ webContents.evaluateJavaScript(code, null);
}
});
}

Powered by Google App Engine
This is Rietveld 408576698