| Index: content/browser/renderer_host/render_process_host_unittest.cc
|
| diff --git a/content/browser/renderer_host/render_process_host_unittest.cc b/content/browser/renderer_host/render_process_host_unittest.cc
|
| index 474a72bd166c310943037f2721e82280662f2e5c..1153e657544ecb056d7424a65a70cae4b90e0d17 100644
|
| --- a/content/browser/renderer_host/render_process_host_unittest.cc
|
| +++ b/content/browser/renderer_host/render_process_host_unittest.cc
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "content/public/common/content_constants.h"
|
| #include "content/public/test/mock_render_process_host.h"
|
| #include "content/test/test_render_view_host.h"
|
|
|
| @@ -26,4 +27,51 @@ TEST_F(RenderProcessHostUnitTest, GuestsAreNotSuitableHosts) {
|
| RenderProcessHost::GetExistingProcessHost(browser_context(), test_url));
|
| }
|
|
|
| +#if defined(OS_ANDROID)
|
| +TEST_F(RenderProcessHostUnitTest, NoRendererProcessLimitOnAndroid) {
|
| + // Disable any overrides.
|
| + RenderProcessHostImpl::SetMaxRendererProcessCount(0);
|
| +
|
| + // Verify that by default the limit on Android returns 0u, meaning there is no
|
| + // limit.
|
| + EXPECT_EQ(0u, RenderProcessHostImpl::GetMaxRendererProcessCount());
|
| +
|
| + // Add a few dummy process hosts.
|
| + ASSERT_NE(0u, kMaxRendererProcessCount);
|
| + ScopedVector<MockRenderProcessHost> hosts;
|
| + for (size_t i = 0; i < kMaxRendererProcessCount; ++i) {
|
| + hosts.push_back(new MockRenderProcessHost(browser_context()));
|
| + }
|
| +
|
| + // Verify that the renderer sharing still won't happen.
|
| + GURL test_url("http://foo.com");
|
| + EXPECT_FALSE(RenderProcessHostImpl::ShouldTryToUseExistingProcessHost(
|
| + browser_context(), test_url));
|
| +}
|
| +#endif
|
| +
|
| +#if !defined(OS_ANDROID)
|
| +TEST_F(RenderProcessHostUnitTest, RendererProcessLimit) {
|
| + // Disable any overrides.
|
| + RenderProcessHostImpl::SetMaxRendererProcessCount(0);
|
| +
|
| + // Verify that the limit is between 1 and kMaxRendererProcessCount.
|
| + EXPECT_GT(RenderProcessHostImpl::GetMaxRendererProcessCount(), 0u);
|
| + EXPECT_LE(RenderProcessHostImpl::GetMaxRendererProcessCount(),
|
| + kMaxRendererProcessCount);
|
| +
|
| + // Add dummy process hosts to saturate the limit.
|
| + ASSERT_NE(0u, kMaxRendererProcessCount);
|
| + ScopedVector<MockRenderProcessHost> hosts;
|
| + for (size_t i = 0; i < kMaxRendererProcessCount; ++i) {
|
| + hosts.push_back(new MockRenderProcessHost(browser_context()));
|
| + }
|
| +
|
| + // Verify that the renderer sharing will happen.
|
| + GURL test_url("http://foo.com");
|
| + EXPECT_TRUE(RenderProcessHostImpl::ShouldTryToUseExistingProcessHost(
|
| + browser_context(), test_url));
|
| +}
|
| +#endif
|
| +
|
| } // namespace content
|
|
|