Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/common/content_constants.h" | 8 #include "content/public/common/content_constants.h" |
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 10 #include "content/public/test/mock_render_process_host.h" | 10 #include "content/public/test/mock_render_process_host.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 &guest_host, browser_context(), test_url)); | 26 &guest_host, browser_context(), test_url)); |
| 27 EXPECT_TRUE(RenderProcessHostImpl::IsSuitableHost( | 27 EXPECT_TRUE(RenderProcessHostImpl::IsSuitableHost( |
| 28 process(), browser_context(), test_url)); | 28 process(), browser_context(), test_url)); |
| 29 EXPECT_EQ( | 29 EXPECT_EQ( |
| 30 process(), | 30 process(), |
| 31 RenderProcessHost::GetExistingProcessHost(browser_context(), test_url)); | 31 RenderProcessHost::GetExistingProcessHost(browser_context(), test_url)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 #if !defined(OS_ANDROID) | 34 #if !defined(OS_ANDROID) |
| 35 TEST_F(RenderProcessHostUnitTest, RendererProcessLimit) { | 35 TEST_F(RenderProcessHostUnitTest, RendererProcessLimit) { |
| 36 // This test shouldn't run with --site-per-process or | 36 // This test shouldn't run with --site-per-process mode, which prohibits |
| 37 // --enable-strict-site-isolation modes, since they don't allow renderer | 37 // the render process reuse this test explicitly exercises. |
|
Charlie Reis
2015/06/05 23:06:18
nit: renderer process
ncarter (slow)
2015/06/06 18:24:34
Done.
| |
| 38 // process reuse, which this test explicitly exercises. | |
| 39 const base::CommandLine& command_line = | 38 const base::CommandLine& command_line = |
| 40 *base::CommandLine::ForCurrentProcess(); | 39 *base::CommandLine::ForCurrentProcess(); |
| 41 if (command_line.HasSwitch(switches::kSitePerProcess) || | 40 if (command_line.HasSwitch(switches::kSitePerProcess)) |
| 42 command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) | |
| 43 return; | 41 return; |
| 44 | 42 |
| 45 // Disable any overrides. | 43 // Disable any overrides. |
| 46 RenderProcessHostImpl::SetMaxRendererProcessCount(0); | 44 RenderProcessHostImpl::SetMaxRendererProcessCount(0); |
| 47 | 45 |
| 48 // Verify that the limit is between 1 and kMaxRendererProcessCount. | 46 // Verify that the limit is between 1 and kMaxRendererProcessCount. |
| 49 EXPECT_GT(RenderProcessHostImpl::GetMaxRendererProcessCount(), 0u); | 47 EXPECT_GT(RenderProcessHostImpl::GetMaxRendererProcessCount(), 0u); |
| 50 EXPECT_LE(RenderProcessHostImpl::GetMaxRendererProcessCount(), | 48 EXPECT_LE(RenderProcessHostImpl::GetMaxRendererProcessCount(), |
| 51 kMaxRendererProcessCount); | 49 kMaxRendererProcessCount); |
| 52 | 50 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 81 } | 79 } |
| 82 | 80 |
| 83 // Verify that the renderer sharing still won't happen. | 81 // Verify that the renderer sharing still won't happen. |
| 84 GURL test_url("http://foo.com"); | 82 GURL test_url("http://foo.com"); |
| 85 EXPECT_FALSE(RenderProcessHostImpl::ShouldTryToUseExistingProcessHost( | 83 EXPECT_FALSE(RenderProcessHostImpl::ShouldTryToUseExistingProcessHost( |
| 86 browser_context(), test_url)); | 84 browser_context(), test_url)); |
| 87 } | 85 } |
| 88 #endif | 86 #endif |
| 89 | 87 |
| 90 } // namespace content | 88 } // namespace content |
| OLD | NEW |