| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
| 10 #include "content/browser/browsing_instance.h" | 10 #include "content/browser/browsing_instance.h" |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 561 |
| 562 static SiteInstanceImpl* CreateSiteInstance(BrowserContext* browser_context, | 562 static SiteInstanceImpl* CreateSiteInstance(BrowserContext* browser_context, |
| 563 const GURL& url) { | 563 const GURL& url) { |
| 564 return static_cast<SiteInstanceImpl*>( | 564 return static_cast<SiteInstanceImpl*>( |
| 565 SiteInstance::CreateForURL(browser_context, url)); | 565 SiteInstance::CreateForURL(browser_context, url)); |
| 566 } | 566 } |
| 567 | 567 |
| 568 // Test to ensure that pages that require certain privileges are grouped | 568 // Test to ensure that pages that require certain privileges are grouped |
| 569 // in processes with similar pages. | 569 // in processes with similar pages. |
| 570 TEST_F(SiteInstanceTest, ProcessSharingByType) { | 570 TEST_F(SiteInstanceTest, ProcessSharingByType) { |
| 571 // This test shouldn't run with --site-per-process mode, since it doesn't | 571 // This test shouldn't run with --site-per-process or |
| 572 // allow render process reuse, which this test explicitly exercises. | 572 // --enable-strict-site-isolation modes, since they don't allow render |
| 573 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 573 // process reuse, which this test explicitly exercises. |
| 574 switches::kSitePerProcess)) | 574 const base::CommandLine& command_line = |
| 575 *base::CommandLine::ForCurrentProcess(); |
| 576 if (command_line.HasSwitch(switches::kSitePerProcess) || |
| 577 command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) |
| 575 return; | 578 return; |
| 576 | 579 |
| 577 // On Android by default the number of renderer hosts is unlimited and process | 580 // On Android by default the number of renderer hosts is unlimited and process |
| 578 // sharing doesn't happen. We set the override so that the test can run | 581 // sharing doesn't happen. We set the override so that the test can run |
| 579 // everywhere. | 582 // everywhere. |
| 580 RenderProcessHost::SetMaxRendererProcessCount(kMaxRendererProcessCount); | 583 RenderProcessHost::SetMaxRendererProcessCount(kMaxRendererProcessCount); |
| 581 | 584 |
| 582 ChildProcessSecurityPolicyImpl* policy = | 585 ChildProcessSecurityPolicyImpl* policy = |
| 583 ChildProcessSecurityPolicyImpl::GetInstance(); | 586 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 584 | 587 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 EXPECT_TRUE(instance->GetSiteURL().is_empty()); | 780 EXPECT_TRUE(instance->GetSiteURL().is_empty()); |
| 778 host.reset(instance->GetProcess()); | 781 host.reset(instance->GetProcess()); |
| 779 | 782 |
| 780 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite( | 783 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite( |
| 781 browser_context.get(), GURL())); | 784 browser_context.get(), GURL())); |
| 782 | 785 |
| 783 DrainMessageLoops(); | 786 DrainMessageLoops(); |
| 784 } | 787 } |
| 785 | 788 |
| 786 } // namespace content | 789 } // namespace content |
| OLD | NEW |