summaryrefslogtreecommitdiffstats
path: root/content/browser/site_instance_impl_unittest.cc
diff options
context:
space:
mode:
authorjyasskin@chromium.org <jyasskin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-06 03:48:41 +0000
committerjyasskin@chromium.org <jyasskin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-06 03:48:41 +0000
commit3059caa70c826f0edbcf50d6f61e6e9a9c34008d (patch)
treefe14dc2c0e4eed2985aaabbff5ee4058f1c6e2ee /content/browser/site_instance_impl_unittest.cc
parent06f914b92a7d849f2e221434c5327e1567978734 (diff)
downloadchromium_src-3059caa70c826f0edbcf50d6f61e6e9a9c34008d.zip
chromium_src-3059caa70c826f0edbcf50d6f61e6e9a9c34008d.tar.gz
chromium_src-3059caa70c826f0edbcf50d6f61e6e9a9c34008d.tar.bz2
Store the RenderProcessHostFactory in a global variable
instead of a member variable within each SiteInstance. The local variable in one SiteInstance was documented to be passed on to other SiteInstances spawned from it, but that never actually worked. Even fixing that doesn't serve the use case of allowing different RenderProcessHostFactories for different trees of SiteInstances because of the many calls to SiteInstance::CreateForURL inside RenderViewHostManager. Review URL: https://chromiumcodereview.appspot.com/15799009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204409 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/site_instance_impl_unittest.cc')
-rw-r--r--content/browser/site_instance_impl_unittest.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc
index 7e807bd..3c3a09c 100644
--- a/content/browser/site_instance_impl_unittest.cc
+++ b/content/browser/site_instance_impl_unittest.cc
@@ -103,6 +103,7 @@ class SiteInstanceTest : public testing::Test {
EXPECT_TRUE(RenderProcessHost::AllHostsIterator().IsAtEnd());
SetBrowserClientForTesting(old_browser_client_);
+ SiteInstanceImpl::set_render_process_host_factory(NULL);
// http://crbug.com/143565 found SiteInstanceTest leaking an
// AppCacheDatabase. This happens because some part of the test indirectly
@@ -543,21 +544,17 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) {
DrainMessageLoops();
}
-static SiteInstanceImpl* CreateSiteInstance(
- BrowserContext* browser_context,
- RenderProcessHostFactory* factory,
- const GURL& url) {
- SiteInstanceImpl* instance =
- reinterpret_cast<SiteInstanceImpl*>(
- SiteInstance::CreateForURL(browser_context, url));
- instance->set_render_process_host_factory(factory);
- return instance;
+static SiteInstanceImpl* CreateSiteInstance(BrowserContext* browser_context,
+ const GURL& url) {
+ return static_cast<SiteInstanceImpl*>(
+ SiteInstance::CreateForURL(browser_context, url));
}
// Test to ensure that pages that require certain privileges are grouped
// in processes with similar pages.
TEST_F(SiteInstanceTest, ProcessSharingByType) {
MockRenderProcessHostFactory rph_factory;
+ SiteInstanceImpl::set_render_process_host_factory(&rph_factory);
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
@@ -569,12 +566,12 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) {
// Create some extension instances and make sure they share a process.
scoped_refptr<SiteInstanceImpl> extension1_instance(
- CreateSiteInstance(browser_context.get(), &rph_factory,
+ CreateSiteInstance(browser_context.get(),
GURL(kPrivilegedScheme + std::string("://foo/bar"))));
set_privileged_process_id(extension1_instance->GetProcess()->GetID());
scoped_refptr<SiteInstanceImpl> extension2_instance(
- CreateSiteInstance(browser_context.get(), &rph_factory,
+ CreateSiteInstance(browser_context.get(),
GURL(kPrivilegedScheme + std::string("://baz/bar"))));
scoped_ptr<RenderProcessHost> extension_host(
@@ -584,12 +581,12 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) {
// Create some WebUI instances and make sure they share a process.
scoped_refptr<SiteInstanceImpl> webui1_instance(CreateSiteInstance(
- browser_context.get(), &rph_factory,
+ browser_context.get(),
GURL(chrome::kChromeUIScheme + std::string("://newtab"))));
policy->GrantWebUIBindings(webui1_instance->GetProcess()->GetID());
scoped_refptr<SiteInstanceImpl> webui2_instance(CreateSiteInstance(
- browser_context.get(), &rph_factory,
+ browser_context.get(),
GURL(chrome::kChromeUIScheme + std::string("://history"))));
scoped_ptr<RenderProcessHost> dom_host(webui1_instance->GetProcess());