Commit dde99fda authored by Miyoung Shin's avatar Miyoung Shin Committed by Chromium LUCI CQ

[remoteobjects] Add JavaBridgeBasicsTest#testWebViewAfterRenderViewSwapped

This CL adds JavaBridgeBasicsTest#testWebViewAfterRenderViewSwapped
to recreate the regression scenario described in
https://crbug.com/572053, and to verify that the new code works as
expected.

Bug: 1105935
Change-Id: Ie527f0c452a9d3eac7fe0c91797b792eff15c23d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2564931Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#832636}
parent a58dde11
......@@ -1087,4 +1087,39 @@ public class JavaBridgeBasicsTest {
mActivityTestRule.executeJavaScript("testObject2.method.call(testObject1)");
Assert.assertEquals(1, mTestController.waitForIntValue());
}
@Test
@SmallTest
@Feature({"AndroidWebView", "Android-JavaBridge"})
@UseMethodParameter(JavaBridgeActivityTestRule.LegacyTestParams.class)
public void testWebViewAfterRenderViewSwapped(boolean useMojo) throws Throwable {
class TestObject {
private int mIndex;
TestObject(int index) {
mIndex = index;
}
public void method() {
mTestController.setIntValue(mIndex);
}
}
final TestObject testObject = new TestObject(1);
mActivityTestRule.injectObjectAndReload(testObject, "testObject");
// Load a fake url to swap RenderView.
mActivityTestRule.loadUrl(mActivityTestRule.getWebContents().getNavigationController(),
mActivityTestRule.getTestCallBackHelperContainer(),
new LoadUrlParams("chrome://test"));
mActivityTestRule.handleBlockingCallbackAction(
mActivityTestRule.getTestCallBackHelperContainer().getOnPageFinishedHelper(),
new Runnable() {
@Override
public void run() {
mActivityTestRule.getWebContents().getNavigationController().goBack();
}
});
mActivityTestRule.executeJavaScript("testObject.method()");
Assert.assertEquals(1, mTestController.waitForIntValue());
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment