| 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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 560 |
| 561 static SiteInstanceImpl* CreateSiteInstance(BrowserContext* browser_context, | 561 static SiteInstanceImpl* CreateSiteInstance(BrowserContext* browser_context, |
| 562 const GURL& url) { | 562 const GURL& url) { |
| 563 return static_cast<SiteInstanceImpl*>( | 563 return static_cast<SiteInstanceImpl*>( |
| 564 SiteInstance::CreateForURL(browser_context, url)); | 564 SiteInstance::CreateForURL(browser_context, url)); |
| 565 } | 565 } |
| 566 | 566 |
| 567 // Test to ensure that pages that require certain privileges are grouped | 567 // Test to ensure that pages that require certain privileges are grouped |
| 568 // in processes with similar pages. | 568 // in processes with similar pages. |
| 569 TEST_F(SiteInstanceTest, ProcessSharingByType) { | 569 TEST_F(SiteInstanceTest, ProcessSharingByType) { |
| 570 // This test shouldn't run with --site-per-process or | 570 // This test shouldn't run with --site-per-process mode, which prohibits |
| 571 // --enable-strict-site-isolation modes, since they don't allow render | 571 // the renderer process reuse this test explicitly exercises. |
| 572 // process reuse, which this test explicitly exercises. | |
| 573 const base::CommandLine& command_line = | 572 const base::CommandLine& command_line = |
| 574 *base::CommandLine::ForCurrentProcess(); | 573 *base::CommandLine::ForCurrentProcess(); |
| 575 if (command_line.HasSwitch(switches::kSitePerProcess) || | 574 if (command_line.HasSwitch(switches::kSitePerProcess)) |
| 576 command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) | |
| 577 return; | 575 return; |
| 578 | 576 |
| 579 // On Android by default the number of renderer hosts is unlimited and process | 577 // On Android by default the number of renderer hosts is unlimited and process |
| 580 // sharing doesn't happen. We set the override so that the test can run | 578 // sharing doesn't happen. We set the override so that the test can run |
| 581 // everywhere. | 579 // everywhere. |
| 582 RenderProcessHost::SetMaxRendererProcessCount(kMaxRendererProcessCount); | 580 RenderProcessHost::SetMaxRendererProcessCount(kMaxRendererProcessCount); |
| 583 | 581 |
| 584 ChildProcessSecurityPolicyImpl* policy = | 582 ChildProcessSecurityPolicyImpl* policy = |
| 585 ChildProcessSecurityPolicyImpl::GetInstance(); | 583 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 586 | 584 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 EXPECT_TRUE(instance->GetSiteURL().is_empty()); | 778 EXPECT_TRUE(instance->GetSiteURL().is_empty()); |
| 781 host.reset(instance->GetProcess()); | 779 host.reset(instance->GetProcess()); |
| 782 | 780 |
| 783 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite( | 781 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite( |
| 784 browser_context.get(), GURL())); | 782 browser_context.get(), GURL())); |
| 785 | 783 |
| 786 DrainMessageLoops(); | 784 DrainMessageLoops(); |
| 787 } | 785 } |
| 788 | 786 |
| 789 } // namespace content | 787 } // namespace content |
| OLD | NEW |