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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2156 // The test must wait for a process to exit, but if the IPC message is | 2156 // The test must wait for a process to exit, but if the IPC message is |
| 2157 // properly ignored, there will be no crash. Therefore, navigate the | 2157 // properly ignored, there will be no crash. Therefore, navigate the |
| 2158 // original window to the same site as the popup, which will just exit the | 2158 // original window to the same site as the popup, which will just exit the |
| 2159 // process cleanly. | 2159 // process cleanly. |
| 2160 EXPECT_TRUE(NavigateToURL( | 2160 EXPECT_TRUE(NavigateToURL( |
| 2161 shell(), embedded_test_server()->GetURL("b.com", "/title3.html"))); | 2161 shell(), embedded_test_server()->GetURL("b.com", "/title3.html"))); |
| 2162 watcher.Wait(); | 2162 watcher.Wait(); |
| 2163 EXPECT_TRUE(watcher.did_exit_normally()); | 2163 EXPECT_TRUE(watcher.did_exit_normally()); |
| 2164 } | 2164 } |
| 2165 | 2165 |
| 2166 // Tests navigating cross-process and reusing an existing RenderViewHost, | |
|
Charlie Reis
2015/10/16 17:02:23
nit: Tests that
nasko
2015/10/16 22:17:38
Done.
| |
| 2167 // which process has been killed/crashed, doesn't result in creating | |
|
Charlie Reis
2015/10/16 17:02:23
nit: Put the killed/crash phrase in parentheses, n
nasko
2015/10/16 22:17:38
Done.
| |
| 2168 // a RenderView with no valid RenderFrame or RenderFrameProxy. | |
|
Charlie Reis
2015/10/16 17:02:24
nit: Mention https://crbug.com/543222 here.
nasko
2015/10/16 22:17:38
I ended up filing a master bug (https://crbug.com/
| |
| 2169 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | |
| 2170 RenderViewInitAfterProcessKill) { | |
| 2171 StartEmbeddedServer(); | |
| 2172 NavigateToURL(shell(), | |
| 2173 embedded_test_server()->GetURL("a.com", "/title1.html")); | |
| 2174 | |
| 2175 // Open a popup to navigate. | |
| 2176 Shell* new_shell = | |
| 2177 OpenPopup(shell()->web_contents(), GURL(url::kAboutBlankURL), "foo"); | |
| 2178 EXPECT_EQ(shell()->web_contents()->GetSiteInstance(), | |
| 2179 new_shell->web_contents()->GetSiteInstance()); | |
| 2180 WebContentsImpl* new_web_contents = | |
| 2181 static_cast<WebContentsImpl*>(new_shell->web_contents()); | |
| 2182 FrameTreeNode* popup_root = new_web_contents->GetFrameTree()->root(); | |
| 2183 RenderViewHostImpl* rvh = new_web_contents->GetRenderViewHost(); | |
| 2184 | |
| 2185 // Navigate the popup to a different site. | |
| 2186 NavigateToURL(new_shell, | |
| 2187 embedded_test_server()->GetURL("b.com", "/title2.html")); | |
| 2188 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | |
| 2189 new_shell->web_contents()->GetSiteInstance()); | |
| 2190 EXPECT_EQ(rvh, popup_root->render_manager()->GetSwappedOutRenderViewHost( | |
| 2191 shell()->web_contents()->GetSiteInstance())); | |
|
Charlie Reis
2015/10/16 17:02:24
I'm not sure I understand the bug, but it seems li
nasko
2015/10/16 22:17:38
Yes, you are correct. This RVH was a copy/paste fr
| |
| 2192 | |
| 2193 // Kill the process for the main tab. | |
| 2194 RenderProcessHost* process = popup_root->current_frame_host()->GetProcess(); | |
|
Charlie Reis
2015/10/16 17:02:23
Wait, are the comments wrong? This is killing the
nasko
2015/10/16 22:17:38
Yes, fixed.
| |
| 2195 RenderProcessHostWatcher crash_observer( | |
| 2196 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | |
| 2197 process->Shutdown(0, false); | |
| 2198 crash_observer.Wait(); | |
| 2199 EXPECT_FALSE(popup_root->current_frame_host()->IsRenderFrameLive()); | |
| 2200 EXPECT_FALSE( | |
| 2201 popup_root->current_frame_host()->render_view_host()->IsRenderViewLive()); | |
| 2202 | |
| 2203 // Navigate the main tab to the site of the popup. This will cause the | |
| 2204 // RenderView for b.com in the main tab to be created. | |
|
Charlie Reis
2015/10/16 17:02:23
Can you add some explanation of what this is verif
nasko
2015/10/16 22:17:38
The process crashes, so we don't complete the navi
| |
| 2205 NavigateToURL(shell(), | |
| 2206 embedded_test_server()->GetURL("b.com", "/title3.html")); | |
| 2207 } | |
| 2208 | |
| 2166 } // namespace content | 2209 } // namespace content |
| OLD | NEW |