| Index: content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java
|
| index cbb6b6a515579935f51fb293cb05124d33da03c1..6b45f95765283123b2e4068a380aa35f81dd0333 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java
|
| @@ -8,6 +8,7 @@ import android.test.suitebuilder.annotation.SmallTest;
|
|
|
| import org.chromium.base.test.util.Feature;
|
| import org.chromium.content_public.browser.JavaScriptCallback;
|
| +import org.chromium.content_public.browser.WebContents;
|
|
|
| /**
|
| * Part of the test suite for the WebView's Java Bridge.
|
| @@ -42,14 +43,14 @@ public class JavaBridgeChildFrameTest extends JavaBridgeTestBase {
|
| @SmallTest
|
| @Feature({"AndroidWebView", "Android-JavaBridge"})
|
| public void testInjectedObjectPresentInChildFrame() throws Throwable {
|
| - loadDataSync(getContentViewCore(),
|
| + loadDataSync(getWebContents().getNavigationController(),
|
| "<html><body><iframe></iframe></body></html>", "text/html", false);
|
| // We are not executing this code as a part of page loading routine to avoid races
|
| // with internal Blink events that notify Java Bridge about window object updates.
|
| assertEquals("\"object\"", executeJavaScriptAndGetResult(
|
| - getContentViewCore(), "typeof window.frames[0].testController"));
|
| + getWebContents(), "typeof window.frames[0].testController"));
|
| executeJavaScriptAndGetResult(
|
| - getContentViewCore(), "window.frames[0].testController.setStringValue('PASS')");
|
| + getWebContents(), "window.frames[0].testController.setStringValue('PASS')");
|
| assertEquals("PASS", mTestController.waitForStringValue());
|
| }
|
|
|
| @@ -58,7 +59,7 @@ public class JavaBridgeChildFrameTest extends JavaBridgeTestBase {
|
| @SmallTest
|
| @Feature({"AndroidWebView", "Android-JavaBridge"})
|
| public void testMainPageWrapperIsNotBrokenByChildFrame() throws Throwable {
|
| - loadDataSync(getContentViewCore(),
|
| + loadDataSync(getWebContents().getNavigationController(),
|
| "<html><body><iframe></iframe></body></html>", "text/html", false);
|
| // In case there is anything wrong with the JS wrapper, an attempt
|
| // to look up its properties will result in an exception being thrown.
|
| @@ -69,9 +70,9 @@ public class JavaBridgeChildFrameTest extends JavaBridgeTestBase {
|
| " return e.toString();" +
|
| "} })()";
|
| assertEquals("\"function\"",
|
| - executeJavaScriptAndGetResult(getContentViewCore(), script));
|
| + executeJavaScriptAndGetResult(getWebContents(), script));
|
| // Make sure calling a method also works.
|
| - executeJavaScriptAndGetResult(getContentViewCore(),
|
| + executeJavaScriptAndGetResult(getWebContents(),
|
| "testController.setStringValue('PASS');");
|
| assertEquals("PASS", mTestController.waitForStringValue());
|
| }
|
| @@ -83,7 +84,7 @@ public class JavaBridgeChildFrameTest extends JavaBridgeTestBase {
|
| public void testWrapperIsNotSharedWithChildFrame() throws Throwable {
|
| // Test by setting a custom property on the parent page's injected
|
| // object and then checking that child frame doesn't see the property.
|
| - loadDataSync(getContentViewCore(),
|
| + loadDataSync(getWebContents().getNavigationController(),
|
| "<html><head>" +
|
| "<script>" +
|
| " window.wProperty = 42;" +
|
| @@ -94,13 +95,13 @@ public class JavaBridgeChildFrameTest extends JavaBridgeTestBase {
|
| "</script>" +
|
| "</head><body><iframe></iframe></body></html>", "text/html", false);
|
| assertEquals("\"42 / 42\"",
|
| - executeJavaScriptAndGetResult(getContentViewCore(), "queryProperties(window)"));
|
| + executeJavaScriptAndGetResult(getWebContents(), "queryProperties(window)"));
|
| assertEquals("\"undefined / undefined\"",
|
| - executeJavaScriptAndGetResult(getContentViewCore(),
|
| + executeJavaScriptAndGetResult(getWebContents(),
|
| "queryProperties(window.frames[0])"));
|
| }
|
|
|
| - private String executeJavaScriptAndGetResult(final ContentViewCore contentViewCore,
|
| + private String executeJavaScriptAndGetResult(final WebContents webContents,
|
| final String script) throws Throwable {
|
| final String[] result = new String[1];
|
| class ResultCallback extends JavaBridgeTestBase.Controller
|
| @@ -115,7 +116,7 @@ public class JavaBridgeChildFrameTest extends JavaBridgeTestBase {
|
| runTestOnUiThread(new Runnable() {
|
| @Override
|
| public void run() {
|
| - contentViewCore.evaluateJavaScript(script, resultCallback);
|
| + webContents.evaluateJavaScript(script, resultCallback);
|
| }
|
| });
|
| resultCallback.waitForResult();
|
|
|