Commit b203a8a7 authored by Evan Stade's avatar Evan Stade Committed by Andrii Shyshkalov

WebLayer: rewrite testOnRenderProcessGone

I couldn't reproduce or understand the flakiness, but hopefully
rewriting the test to use TestWebLayer#crashTab instead of
navigating to chrome://crash will resolve the problem.

FWIW, in the old version of the test, the navigation itself
seemed to fail, in that the post-test screenshot still showed
about:blank in the url bar.

Bug: 1143788
Change-Id: I35cbca4368f7215fd173692c1d2a24ed34fe8e4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2535218Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827385}
parent 67ce775d
...@@ -84,26 +84,6 @@ public class TabCallbackTest { ...@@ -84,26 +84,6 @@ public class TabCallbackTest {
callback.visibleUriChangedCallback.waitUntilValueObserved(url); callback.visibleUriChangedCallback.waitUntilValueObserved(url);
} }
@Test
@SmallTest
public void testOnRenderProcessGone() throws TimeoutException {
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank");
CallbackHelper callbackHelper = new CallbackHelper();
TestThreadUtils.runOnUiThreadBlocking(() -> {
Tab tab = activity.getTab();
activity.setIgnoreRendererCrashes();
TabCallback callback = new TabCallback() {
@Override
public void onRenderProcessGone() {
callbackHelper.notifyCalled();
}
};
tab.registerTabCallback(callback);
tab.getNavigationController().navigate(Uri.parse("chrome://crash"));
});
callbackHelper.waitForFirst();
}
// Requires implementation M82. // Requires implementation M82.
@Test @Test
@SmallTest @SmallTest
......
...@@ -95,4 +95,25 @@ public class TabPrivateTest { ...@@ -95,4 +95,25 @@ public class TabPrivateTest {
}); });
navigationCompletedHelper.waitForFirst(); navigationCompletedHelper.waitForFirst();
} }
@Test
@SmallTest
public void testOnRenderProcessGone() throws Exception {
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank");
CallbackHelper callbackHelper = new CallbackHelper();
Tab tabToCrash = TestThreadUtils.runOnUiThreadBlocking(() -> {
Tab tab = activity.getTab();
activity.setIgnoreRendererCrashes();
TabCallback callback = new TabCallback() {
@Override
public void onRenderProcessGone() {
callbackHelper.notifyCalled();
}
};
tab.registerTabCallback(callback);
return tab;
});
getTestWebLayer().crashTab(tabToCrash);
callbackHelper.waitForFirst();
}
} }
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