Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java

Issue 1308623003: Assume crashed RenderWidgetHost to be invisible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check dest_render_frame_host->render_view_host()->is_hidden() Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/android/bindingmanager/shared_renderer1.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java
index d8d7829974b8ac3f92f7ac08e4c178bf1cfaff8c..c8927f187f20fecd795355fc3df447c73c894657 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java
@@ -116,6 +116,8 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch
private static final String FILE_PATH = "chrome/test/data/android/test.html";
// about:version will always be handled by a different renderer than a local file.
private static final String ABOUT_VERSION_PATH = "chrome://version/";
+ private static final String SHARED_RENDERER_PAGE_PATH =
+ "chrome/test/data/android/bindingmanager/shared_renderer1.html";
public BindingManagerIntegrationTest() {
super(ChromeActivity.class);
@@ -478,6 +480,88 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch
assertTrue(mBindingManager.isReleaseAllModerateBindingsCalled());
}
+ @LargeTest
+ @Feature({"ProcessManagement"})
+ public void testRestoreSharedRenderer() throws Exception {
+ loadUrl(TestHttpServerClient.getUrl(SHARED_RENDERER_PAGE_PATH));
+
+ final Tab[] tabs = new Tab[2];
+ tabs[0] = getActivity().getActivityTab();
+ singleClickView(tabs[0].getView());
+
+ assertTrue("Child tab isn't opened.", CriteriaHelper.pollForCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return getActivity().getCurrentTabModel().getCount() == 2
+ && getActivity()
+ .getActivityTab()
+ .getContentViewCore()
+ .getCurrentRenderProcessId()
+ != 0;
+ }
+ }));
+ tabs[1] = getActivity().getActivityTab();
+ assertEquals(tabs[0].getContentViewCore().getCurrentRenderProcessId(),
+ tabs[1].getContentViewCore().getCurrentRenderProcessId());
+
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ // Verify the visibility of the renderer.
+ assertTrue(mBindingManager.isInForeground(
+ tabs[0].getContentViewCore().getCurrentRenderProcessId()));
+ }
+ });
+
+ assertTrue(ChildProcessLauncher.crashProcessForTesting(
+ tabs[1].getContentViewCore().getCurrentRenderProcessId()));
+
+ assertTrue("Renderer crash wasn't noticed by the browser.",
+ CriteriaHelper.pollForCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return tabs[1].getContentViewCore().getCurrentRenderProcessId() == 0;
+ }
+ }));
+ // Reload the tab, respawning the renderer.
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ tabs[1].reload();
+ }
+ });
+
+ // Wait until the process is spawned and its visibility is determined.
+ assertTrue("Process for the crashed tab was not respawned.",
+ CriteriaHelper.pollForCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return tabs[1].getContentViewCore().getCurrentRenderProcessId() != 0;
+ }
+ }));
+
+ assertTrue("setInForeground() was not called for the process.",
+ CriteriaHelper.pollForCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return mBindingManager.setInForegroundWasCalled(
+ tabs[1].getContentViewCore().getCurrentRenderProcessId());
+ }
+ }));
+
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ // Verify the visibility of the renderer.
+ assertTrue(mBindingManager.isInForeground(
+ tabs[1].getContentViewCore().getCurrentRenderProcessId()));
+ tabs[1].hide();
+ assertTrue(mBindingManager.isInBackground(
+ tabs[1].getContentViewCore().getCurrentRenderProcessId()));
+ }
+ });
+ }
+
@Override
public void startMainActivity() throws InterruptedException {
startMainActivityOnBlankPage();
« no previous file with comments | « no previous file | chrome/test/data/android/bindingmanager/shared_renderer1.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698