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

Unified Diff: chrome/browser/renderer_host/test/render_process_host_browsertest.cc

Issue 6106003: Similar as extension, DOM UI needs to be created in its own process.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « chrome/browser/dom_ui/dom_ui_factory.cc ('k') | chrome/browser/tab_contents/render_view_host_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/test/render_process_host_browsertest.cc
===================================================================
--- chrome/browser/renderer_host/test/render_process_host_browsertest.cc (revision 70813)
+++ chrome/browser/renderer_host/test/render_process_host_browsertest.cc (working copy)
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/command_line.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
@@ -28,6 +30,58 @@
}
};
+IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) {
+ // Set max renderers to 1 to force running out of processes.
+ RenderProcessHost::SetMaxRendererProcessCount(1);
+
+ CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
+ parsed_command_line.AppendSwitch(switches::kProcessPerTab);
+
+ int tab_count = 1;
+ int host_count = 1;
+
+ // Change the first tab to be the new tab page (TYPE_DOMUI).
+ GURL newtab(chrome::kChromeUINewTabURL);
+ ui_test_utils::NavigateToURL(browser(), newtab);
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+
+ // Create a new TYPE_NORMAL tab. It should be in its own process.
+ GURL page1("data:text/html,hello world1");
+ browser()->ShowSingletonTab(page1, false);
+ if (browser()->tab_count() == tab_count)
+ ui_test_utils::WaitForNewTab(browser());
+ tab_count++;
+ host_count++;
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+
+ // Create another TYPE_NORMAL tab. It should share the previous process.
+ GURL page2("data:text/html,hello world2");
+ browser()->ShowSingletonTab(page2, false);
+ if (browser()->tab_count() == tab_count)
+ ui_test_utils::WaitForNewTab(browser());
+ tab_count++;
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+
+ // Create another new tab. It should share the process with the other DOMUI.
+ browser()->NewTab();
+ if (browser()->tab_count() == tab_count)
+ ui_test_utils::WaitForNewTab(browser());
+ tab_count++;
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+
+ // Create another new tab. It should share the process with the other DOMUI.
+ browser()->NewTab();
+ if (browser()->tab_count() == tab_count)
+ ui_test_utils::WaitForNewTab(browser());
+ tab_count++;
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+}
+
// When we hit the max number of renderers, verify that the way we do process
// sharing behaves correctly. In particular, this test is verifying that even
// when we hit the max process limit, that renderers of each type will wind up
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_factory.cc ('k') | chrome/browser/tab_contents/render_view_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698