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

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

Issue 231693002: Remove some dependencies on ContentView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 80556b6166e8c3c52e4184b8c098fd9302babdf9..daefd4f60ad52d8cd6ca01452632593436cd0e30 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
@@ -10,6 +10,7 @@ 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 java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -25,10 +26,9 @@ public class JavaScriptUtils {
* Returns the result of its execution in JSON format.
*/
public static String executeJavaScriptAndWaitForResult(
- final ContentViewCore viewCore, TestCallbackHelperContainer viewClient,
- final String code) throws InterruptedException, TimeoutException {
+ ContentViewCore viewCore, String code) throws InterruptedException, TimeoutException {
return executeJavaScriptAndWaitForResult(
- viewCore, viewClient.getOnEvaluateJavaScriptResultHelper(), code);
+ viewCore, code, EVALUATION_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
/**
@@ -38,23 +38,11 @@ public class JavaScriptUtils {
*/
public static String executeJavaScriptAndWaitForResult(
final ContentViewCore viewCore,
- final TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper helper,
- final String code) throws InterruptedException, TimeoutException {
- return executeJavaScriptAndWaitForResult(
- viewCore, helper, code, EVALUATION_TIMEOUT_SECONDS, TimeUnit.SECONDS);
- }
-
- /**
- * Executes the given snippet of JavaScript code within the given ContentViewCore.
- * Does not depend on ContentView and TestCallbackHelperContainer.
- * Returns the result of its execution in JSON format.
- */
- public static String executeJavaScriptAndWaitForResult(
- final ContentViewCore viewCore,
- final TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper helper,
final String code,
- final long timeout, final TimeUnit timeoutUnits)
+ final long timeout,
+ final TimeUnit timeoutUnits)
throws InterruptedException, TimeoutException {
+ final OnEvaluateJavaScriptResultHelper helper = new OnEvaluateJavaScriptResultHelper();
// Calling this from the UI thread causes it to time-out: the UI thread being blocked won't
// have a chance to process the JavaScript eval response).
Assert.assertFalse("Executing JavaScript should be done from the test thread, "

Powered by Google App Engine
This is Rietveld 408576698