| Index: content/browser/site_instance_impl_unittest.cc
|
| diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc
|
| index 043085b8c586d358677e5f12f6244ba0e025f033..8ef3689468640118454916d8f52a046a8450abeb 100644
|
| --- a/content/browser/site_instance_impl_unittest.cc
|
| +++ b/content/browser/site_instance_impl_unittest.cc
|
| @@ -153,7 +153,9 @@ TEST_F(SiteInstanceTest, SiteInstanceDestructor) {
|
| const GURL url("test:foo");
|
|
|
| // Ensure that instances are deleted when their NavigationEntries are gone.
|
| - scoped_refptr<SiteInstanceImpl> instance = SiteInstanceImpl::Create(nullptr);
|
| + constexpr int child_process_param_id = 0;
|
| + scoped_refptr<SiteInstanceImpl> instance =
|
| + SiteInstanceImpl::Create(nullptr, child_process_param_id);
|
| EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount());
|
|
|
| NavigationEntryImpl* e1 = new NavigationEntryImpl(
|
| @@ -210,16 +212,18 @@ TEST_F(SiteInstanceTest, SiteInstanceDestructor) {
|
| TEST_F(SiteInstanceTest, CloneNavigationEntry) {
|
| const GURL url("test:foo");
|
|
|
| + constexpr int child_process_param_id = 0;
|
| std::unique_ptr<NavigationEntryImpl> e1 =
|
| base::WrapUnique(new NavigationEntryImpl(
|
| - SiteInstanceImpl::Create(nullptr), url, Referrer(),
|
| - base::string16(), ui::PAGE_TRANSITION_LINK, false));
|
| + SiteInstanceImpl::Create(nullptr, child_process_param_id), url,
|
| + Referrer(), base::string16(), ui::PAGE_TRANSITION_LINK, false));
|
|
|
| // Clone the entry.
|
| std::unique_ptr<NavigationEntryImpl> e2 = e1->Clone();
|
|
|
| // Should be able to change the SiteInstance of the cloned entry.
|
| - e2->set_site_instance(SiteInstanceImpl::Create(nullptr));
|
| + e2->set_site_instance(
|
| + SiteInstanceImpl::Create(nullptr, child_process_param_id));
|
|
|
| EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount());
|
| EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount());
|
| @@ -243,14 +247,15 @@ TEST_F(SiteInstanceTest, GetProcess) {
|
| // Ensure that GetProcess returns a process.
|
| std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
|
| std::unique_ptr<RenderProcessHost> host1;
|
| + constexpr int child_process_param_id = 0;
|
| scoped_refptr<SiteInstanceImpl> instance(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
| host1.reset(instance->GetProcess());
|
| EXPECT_TRUE(host1.get() != nullptr);
|
|
|
| // Ensure that GetProcess creates a new process.
|
| scoped_refptr<SiteInstanceImpl> instance2(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
| std::unique_ptr<RenderProcessHost> host2(instance2->GetProcess());
|
| EXPECT_TRUE(host2.get() != nullptr);
|
| EXPECT_NE(host1.get(), host2.get());
|
| @@ -260,7 +265,9 @@ TEST_F(SiteInstanceTest, GetProcess) {
|
|
|
| // Test to ensure SetSite and site() work properly.
|
| TEST_F(SiteInstanceTest, SetSite) {
|
| - scoped_refptr<SiteInstanceImpl> instance(SiteInstanceImpl::Create(nullptr));
|
| + constexpr int child_process_param_id = 0;
|
| + scoped_refptr<SiteInstanceImpl> instance(
|
| + SiteInstanceImpl::Create(nullptr, child_process_param_id));
|
| EXPECT_FALSE(instance->HasSite());
|
| EXPECT_TRUE(instance->GetSiteURL().is_empty());
|
|
|
| @@ -422,8 +429,9 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSite) {
|
| ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| switches::kProcessPerSite));
|
| std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
|
| + constexpr int child_process_param_id = 0;
|
| BrowsingInstance* browsing_instance =
|
| - new BrowsingInstance(browser_context.get());
|
| + new BrowsingInstance(browser_context.get(), child_process_param_id);
|
|
|
| const GURL url_a1("http://www.google.com/1.html");
|
| scoped_refptr<SiteInstanceImpl> site_instance_a1(
|
| @@ -453,7 +461,7 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSite) {
|
| // A visit to the original site in a new BrowsingInstance (same or different
|
| // browser context) should return a different SiteInstance.
|
| BrowsingInstance* browsing_instance2 =
|
| - new BrowsingInstance(browser_context.get());
|
| + new BrowsingInstance(browser_context.get(), child_process_param_id);
|
| // Ensure the new SiteInstance is ref counted so that it gets deleted.
|
| scoped_refptr<SiteInstanceImpl> site_instance_a2_2(
|
| browsing_instance2->GetSiteInstanceForURL(url_a2));
|
| @@ -494,8 +502,9 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) {
|
| base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
| switches::kProcessPerSite);
|
| std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
|
| + constexpr int child_process_param_id = 0;
|
| scoped_refptr<BrowsingInstance> browsing_instance =
|
| - new BrowsingInstance(browser_context.get());
|
| + new BrowsingInstance(browser_context.get(), child_process_param_id);
|
|
|
| const GURL url_a1("http://www.google.com/1.html");
|
| scoped_refptr<SiteInstanceImpl> site_instance_a1(
|
| @@ -525,7 +534,7 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) {
|
| // A visit to the original site in a new BrowsingInstance (same browser
|
| // context) should return a different SiteInstance with the same process.
|
| BrowsingInstance* browsing_instance2 =
|
| - new BrowsingInstance(browser_context.get());
|
| + new BrowsingInstance(browser_context.get(), child_process_param_id);
|
| scoped_refptr<SiteInstanceImpl> site_instance_a1_2(
|
| browsing_instance2->GetSiteInstanceForURL(url_a1));
|
| EXPECT_TRUE(site_instance_a1.get() != nullptr);
|
| @@ -537,7 +546,7 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) {
|
| std::unique_ptr<TestBrowserContext> browser_context2(
|
| new TestBrowserContext());
|
| BrowsingInstance* browsing_instance3 =
|
| - new BrowsingInstance(browser_context2.get());
|
| + new BrowsingInstance(browser_context2.get(), child_process_param_id);
|
| scoped_refptr<SiteInstanceImpl> site_instance_a2_3(
|
| browsing_instance3->GetSiteInstanceForURL(url_a2));
|
| EXPECT_TRUE(site_instance_a2_3.get() != nullptr);
|
| @@ -571,7 +580,9 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) {
|
| static scoped_refptr<SiteInstanceImpl> CreateSiteInstance(
|
| BrowserContext* browser_context,
|
| const GURL& url) {
|
| - return SiteInstanceImpl::CreateForURL(browser_context, url);
|
| + constexpr int child_process_param_id = 0;
|
| + return SiteInstanceImpl::CreateForURL(browser_context, url,
|
| + child_process_param_id);
|
| }
|
|
|
| // Test to ensure that pages that require certain privileges are grouped
|
| @@ -642,8 +653,9 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) {
|
| TEST_F(SiteInstanceTest, HasWrongProcessForURL) {
|
| std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
|
| std::unique_ptr<RenderProcessHost> host;
|
| + constexpr int child_process_param_id = 0;
|
| scoped_refptr<SiteInstanceImpl> instance(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
|
|
| EXPECT_FALSE(instance->HasSite());
|
| EXPECT_TRUE(instance->GetSiteURL().is_empty());
|
| @@ -670,7 +682,7 @@ TEST_F(SiteInstanceTest, HasWrongProcessForURL) {
|
| // Test that WebUI SiteInstances reject normal web URLs.
|
| const GURL webui_url("chrome://gpu");
|
| scoped_refptr<SiteInstanceImpl> webui_instance(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
| webui_instance->SetSite(webui_url);
|
| std::unique_ptr<RenderProcessHost> webui_host(webui_instance->GetProcess());
|
|
|
| @@ -687,7 +699,7 @@ TEST_F(SiteInstanceTest, HasWrongProcessForURL) {
|
| // even if we haven't called GetProcess yet. Make sure HasWrongProcessForURL
|
| // doesn't crash (http://crbug.com/137070).
|
| scoped_refptr<SiteInstanceImpl> webui_instance2(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
| webui_instance2->SetSite(webui_url);
|
| EXPECT_FALSE(webui_instance2->HasWrongProcessForURL(webui_url));
|
| EXPECT_TRUE(
|
| @@ -703,8 +715,9 @@ TEST_F(SiteInstanceTest, HasWrongProcessForURLInSitePerProcess) {
|
|
|
| std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
|
| std::unique_ptr<RenderProcessHost> host;
|
| + constexpr int child_process_param_id = 0;
|
| scoped_refptr<SiteInstanceImpl> instance(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
|
|
| instance->SetSite(GURL("http://evernote.com/"));
|
| EXPECT_TRUE(instance->HasSite());
|
| @@ -734,8 +747,9 @@ TEST_F(SiteInstanceTest, ProcessPerSiteWithWrongBindings) {
|
| std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
|
| std::unique_ptr<RenderProcessHost> host;
|
| std::unique_ptr<RenderProcessHost> host2;
|
| + constexpr int child_process_param_id = 0;
|
| scoped_refptr<SiteInstanceImpl> instance(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
|
|
| EXPECT_FALSE(instance->HasSite());
|
| EXPECT_TRUE(instance->GetSiteURL().is_empty());
|
| @@ -758,7 +772,7 @@ TEST_F(SiteInstanceTest, ProcessPerSiteWithWrongBindings) {
|
| // same process. Make sure it doesn't use the same process if the bindings
|
| // are missing.
|
| scoped_refptr<SiteInstanceImpl> instance2(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
| instance2->SetSite(webui_url);
|
| host2.reset(instance2->GetProcess());
|
| EXPECT_TRUE(host2.get() != nullptr);
|
| @@ -775,8 +789,9 @@ TEST_F(SiteInstanceTest, NoProcessPerSiteForEmptySite) {
|
| switches::kProcessPerSite);
|
| std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
|
| std::unique_ptr<RenderProcessHost> host;
|
| + constexpr int child_process_param_id = 0;
|
| scoped_refptr<SiteInstanceImpl> instance(
|
| - SiteInstanceImpl::Create(browser_context.get()));
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id));
|
|
|
| instance->SetSite(GURL());
|
| EXPECT_TRUE(instance->HasSite());
|
| @@ -797,8 +812,9 @@ TEST_F(SiteInstanceTest, DefaultSubframeSiteInstance) {
|
| switches::kTopDocumentIsolation);
|
|
|
| std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
|
| + constexpr int child_process_param_id = 0;
|
| scoped_refptr<SiteInstanceImpl> main_instance =
|
| - SiteInstanceImpl::Create(browser_context.get());
|
| + SiteInstanceImpl::Create(browser_context.get(), child_process_param_id);
|
| scoped_refptr<SiteInstanceImpl> subframe_instance =
|
| main_instance->GetDefaultSubframeSiteInstance();
|
| int subframe_instance_id = subframe_instance->GetId();
|
|
|