This source file includes following definitions.
- setStringValue
- waitForStringValue
- setUp
- Feature
- testInjectedObjectPresentInChildFrame
package org.chromium.content.browser;
import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.test.util.Feature;
public class JavaBridgeChildFrameTest extends JavaBridgeTestBase {
private class TestController extends Controller {
private String mStringValue;
public synchronized void setStringValue(String x) {
mStringValue = x;
notifyResultIsReady();
}
public synchronized String waitForStringValue() {
waitForResult();
return mStringValue;
}
}
TestController mTestController;
@Override
protected void setUp() throws Exception {
super.setUp();
mTestController = new TestController();
setUpContentView(mTestController, "testController");
}
@SmallTest
@Feature({"AndroidWebView", "Android-JavaBridge"})
public void testInjectedObjectPresentInChildFrame() throws Throwable {
loadDataSync(getContentView(),
"<html><head></head><body>" +
"<iframe id=\"childFrame\" onload=\"testController.setStringValue('PASS');\" />" +
"</body></html>", "text/html", false);
assertEquals("PASS", mTestController.waitForStringValue());
}
}