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

Unified Diff: content/browser/site_instance_impl_unittest.cc

Issue 2706933003: webapk: Avoid overwriting default CreationParams
Patch Set: rebase 461342 Created 3 years, 9 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 | « content/browser/site_instance_impl.cc ('k') | content/public/browser/site_instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b79379debe987e5543587dec9734d8e7c59d1945..1ba64cb51ab1f467a1914734881c2a0ca6a711af 100644
--- a/content/browser/site_instance_impl_unittest.cc
+++ b/content/browser/site_instance_impl_unittest.cc
@@ -155,7 +155,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(
@@ -212,16 +214,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());
@@ -245,14 +249,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());
@@ -262,7 +267,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());
@@ -424,8 +431,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(
@@ -455,7 +463,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));
@@ -496,8 +504,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(
@@ -527,7 +536,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);
@@ -539,7 +548,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);
@@ -573,7 +582,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
@@ -645,8 +656,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());
@@ -673,7 +685,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());
@@ -690,7 +702,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(
@@ -706,8 +718,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());
@@ -737,8 +750,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());
@@ -761,7 +775,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);
@@ -778,8 +792,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());
@@ -800,8 +815,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();
« no previous file with comments | « content/browser/site_instance_impl.cc ('k') | content/public/browser/site_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698