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

Reland "[remoteobjects] Add JavaBridgeBasicsTest#testWebViewAfterRenderViewSwapped"

This is a reland of dde99fda with a fix
of a flaky failure on the android-marshmallow-x86-rel-non-cq trybot.

Original change's description:
> [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/+/2564931
> Reviewed-by: Bo <boliu@chromium.org>
> Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
> Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
> Cr-Commit-Position: refs/heads/master@{#832636}

Bug: 1105935
Change-Id: Ia92d656122f7dbca2030fd0dc87e366c307945f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2571034
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835013}
parent 229a822f
...@@ -1087,4 +1087,39 @@ public class JavaBridgeBasicsTest { ...@@ -1087,4 +1087,39 @@ public class JavaBridgeBasicsTest {
mActivityTestRule.executeJavaScript("testObject2.method.call(testObject1)"); mActivityTestRule.executeJavaScript("testObject2.method.call(testObject1)");
Assert.assertEquals(1, mTestController.waitForIntValue()); 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");
// This needs renderer swap but not end up in an error page.
mActivityTestRule.loadUrl(mActivityTestRule.getWebContents().getNavigationController(),
mActivityTestRule.getTestCallBackHelperContainer(),
new LoadUrlParams("chrome://process-internals"));
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