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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "content/browser/renderer_host/render_process_host_impl.h" | 6 #include "content/browser/renderer_host/render_process_host_impl.h" |
7 #include "content/common/child_process_messages.h" | 7 #include "content/common/child_process_messages.h" |
8 #include "content/public/browser/render_process_host.h" | 8 #include "content/public/browser/render_process_host.h" |
9 #include "content/public/browser/render_process_host_observer.h" | 9 #include "content/public/browser/render_process_host_observer.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 NavigateToURL(shell(), test_url); | 96 NavigateToURL(shell(), test_url); |
97 RenderProcessHost* rph = | 97 RenderProcessHost* rph = |
98 shell()->web_contents()->GetRenderViewHost()->GetProcess(); | 98 shell()->web_contents()->GetRenderViewHost()->GetProcess(); |
99 // Make it believe it's a guest. | 99 // Make it believe it's a guest. |
100 reinterpret_cast<RenderProcessHostImpl*>(rph)-> | 100 reinterpret_cast<RenderProcessHostImpl*>(rph)-> |
101 set_is_isolated_guest_for_testing(true); | 101 set_is_isolated_guest_for_testing(true); |
102 EXPECT_EQ(1, RenderProcessHostCount()); | 102 EXPECT_EQ(1, RenderProcessHostCount()); |
103 | 103 |
104 // Navigate to a different page. | 104 // Navigate to a different page. |
105 GURL::Replacements replace_host; | 105 GURL::Replacements replace_host; |
106 std::string host_str("localhost"); // Must stay in scope with replace_host. | 106 replace_host.SetHostStr("localhost"); |
107 replace_host.SetHostStr(host_str); | |
108 GURL another_url = embedded_test_server()->GetURL("/simple_page.html"); | 107 GURL another_url = embedded_test_server()->GetURL("/simple_page.html"); |
109 another_url = another_url.ReplaceComponents(replace_host); | 108 another_url = another_url.ReplaceComponents(replace_host); |
110 NavigateToURL(CreateBrowser(), another_url); | 109 NavigateToURL(CreateBrowser(), another_url); |
111 | 110 |
112 // Expect that we got another process (the guest renderer was not reused). | 111 // Expect that we got another process (the guest renderer was not reused). |
113 EXPECT_EQ(2, RenderProcessHostCount()); | 112 EXPECT_EQ(2, RenderProcessHostCount()); |
114 } | 113 } |
115 | 114 |
116 class ShellCloser : public RenderProcessHostObserver { | 115 class ShellCloser : public RenderProcessHostObserver { |
117 public: | 116 public: |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 GURL test_url = embedded_test_server()->GetURL("/simple_page.html"); | 229 GURL test_url = embedded_test_server()->GetURL("/simple_page.html"); |
231 NavigateToURL(shell(), test_url); | 230 NavigateToURL(shell(), test_url); |
232 | 231 |
233 EXPECT_EQ(1, RenderProcessHostCount()); | 232 EXPECT_EQ(1, RenderProcessHostCount()); |
234 EXPECT_EQ(0, process_exits_); | 233 EXPECT_EQ(0, process_exits_); |
235 } | 234 } |
236 #endif | 235 #endif |
237 | 236 |
238 } // namespace | 237 } // namespace |
239 } // namespace content | 238 } // namespace content |
OLD | NEW |