| Index: chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
|
| diff --git a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
|
| index 6d47d2b608808c7f73ffb7d3ef40b0532e2f5a38..6aa1ab125e6e1ac8f2f446ba114188c35b600053 100644
|
| --- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
|
| +++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
|
| @@ -17,10 +17,12 @@
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/render_process_host.h"
|
| +#include "content/public/browser/render_process_host_observer.h"
|
| #include "content/public/browser/render_view_host.h"
|
| #include "content/public/browser/render_widget_host_iterator.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_contents_observer.h"
|
| +#include "content/public/test/browser_test_utils.h"
|
|
|
| using content::RenderViewHost;
|
| using content::RenderWidgetHost;
|
| @@ -111,9 +113,22 @@ class ChromeRenderProcessHostTest : public InProcessBrowserTest {
|
| content::RenderProcessHost* rph2 = NULL;
|
| content::RenderProcessHost* rph3 = NULL;
|
|
|
| - // Change the first tab to be the omnibox page (TYPE_WEBUI).
|
| + EXPECT_EQ(host_count, RenderProcessHostCount());
|
| + ASSERT_EQ(tab_count, browser()->tab_strip_model()->count());
|
| +
|
| + tab1 = browser()->tab_strip_model()->GetWebContentsAt(tab_count - 1);
|
| + content::RenderProcessHostWatcher process_watcher(
|
| + tab1->GetRenderProcessHost(),
|
| + content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION);
|
| +
|
| + // Change the first tab to be the omnibox page (TYPE_WEBUI). The navigation
|
| + // should terminate the existing process.
|
| GURL omnibox(chrome::kChromeUIOmniboxURL);
|
| ui_test_utils::NavigateToURL(browser(), omnibox);
|
| + // Wait for the RPH of the previous page (i.e. starting page) to be
|
| + // destroyed. The host does not get destroyed until the screenshot of the
|
| + // page is taken, which may happen after the navigation completes.
|
| + process_watcher.Wait();
|
| EXPECT_EQ(tab_count, browser()->tab_strip_model()->count());
|
| tab1 = browser()->tab_strip_model()->GetWebContentsAt(tab_count - 1);
|
| rph1 = tab1->GetRenderProcessHost();
|
| @@ -204,9 +219,22 @@ IN_PROC_BROWSER_TEST_F(ChromeRenderProcessHostTest, ProcessPerTab) {
|
| int tab_count = 1;
|
| int host_count = 1;
|
|
|
| + EXPECT_EQ(tab_count, browser()->tab_strip_model()->count());
|
| + EXPECT_EQ(host_count, RenderProcessHostCount());
|
| +
|
| + WebContents* tab1 =
|
| + browser()->tab_strip_model()->GetWebContentsAt(tab_count - 1);
|
| + content::RenderProcessHostWatcher process_watcher(
|
| + tab1->GetRenderProcessHost(),
|
| + content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION);
|
| +
|
| // Change the first tab to be the new tab page (TYPE_WEBUI).
|
| GURL omnibox(chrome::kChromeUIOmniboxURL);
|
| ui_test_utils::NavigateToURL(browser(), omnibox);
|
| + // Wait for the RPH of the previous page (i.e. starting page) to be
|
| + // destroyed. The host does not get destroyed until the screenshot of the
|
| + // page is taken, which may happen after the navigation completes.
|
| + process_watcher.Wait();
|
| EXPECT_EQ(tab_count, browser()->tab_strip_model()->count());
|
| EXPECT_EQ(host_count, RenderProcessHostCount());
|
|
|
|
|