FileDocCategorySizeDatePackage
JavaBridgeChildFrameTest.javaAPI DocAndroid 5.1 API2283Thu Mar 12 22:22:44 GMT 2015com.android.webviewtests

JavaBridgeChildFrameTest

public class JavaBridgeChildFrameTest extends JavaBridgeTestBase
Part of the test suite for the WebView's Java Bridge. Ensures that injected objects are exposed to child frames as well as the main frame. To run this test ... adb shell am instrument -w -e class com.android.webviewtests.JavaBridgeChildFrameTest \ com.android.webviewtests/android.test.InstrumentationTestRunner

Fields Summary
TestController
mTestController
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        mTestController = new TestController();
        setUpWebView(mTestController, "testController");
    
public voidtestInjectedObjectPresentInChildFrame()

        // In the case that the test fails (i.e. the child frame doesn't get the injected object,
        // the call to testController.setStringValue in the child frame's onload handler will
        // not be made.
        getActivity().getWebView().loadData(
                "<html><head></head><body>" +
                "<iframe id=\"childFrame\" onload=\"testController.setStringValue('PASS');\" />" +
                "</body></html>", "text/html", null);
        assertEquals("PASS", mTestController.waitForStringValue());