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 that navigating cross-process and reusing an existing RenderViewHost | |
2167 // (which process has been killed/crashed) recreates properly the RenderView and | |
Charlie Reis
2015/10/16 23:09:57
nit: s/which/whose/
nasko
2015/10/16 23:42:09
Done.
| |
2168 // RenderFrameProxy on the renderer side. | |
2169 // See https://crbug.com/544271 | |
2170 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | |
2171 RenderViewInitAfterProcessKill) { | |
2172 StartEmbeddedServer(); | |
2173 EXPECT_TRUE(NavigateToURL( | |
2174 shell(), embedded_test_server()->GetURL("a.com", "/title1.html"))); | |
2175 | |
2176 // Open a popup to navigate. | |
2177 Shell* new_shell = | |
2178 OpenPopup(shell()->web_contents(), GURL(url::kAboutBlankURL), "foo"); | |
2179 FrameTreeNode* popup_root = | |
2180 static_cast<WebContentsImpl*>(new_shell->web_contents()) | |
2181 ->GetFrameTree() | |
2182 ->root(); | |
2183 EXPECT_EQ(shell()->web_contents()->GetSiteInstance(), | |
2184 new_shell->web_contents()->GetSiteInstance()); | |
2185 | |
2186 // Navigate the popup to a different site. | |
2187 EXPECT_TRUE(NavigateToURL(new_shell, | |
2188 embedded_test_server()->GetURL("b.com", "/title2.html"))); | |
2189 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | |
2190 new_shell->web_contents()->GetSiteInstance()); | |
2191 | |
2192 // Kill the process hosting the popup. | |
2193 RenderProcessHost* process = popup_root->current_frame_host()->GetProcess(); | |
2194 RenderProcessHostWatcher crash_observer( | |
2195 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | |
2196 process->Shutdown(0, false); | |
2197 crash_observer.Wait(); | |
2198 EXPECT_FALSE(popup_root->current_frame_host()->IsRenderFrameLive()); | |
2199 EXPECT_FALSE( | |
2200 popup_root->current_frame_host()->render_view_host()->IsRenderViewLive()); | |
2201 | |
2202 // Navigate the main tab to the site of the popup. This will cause the | |
2203 // RenderView for b.com in the main tab to be recreated. If the issue | |
2204 // is not fixed, this will result in process crash and failing test. | |
2205 EXPECT_TRUE(NavigateToURL(shell(), | |
2206 embedded_test_server()->GetURL("b.com", "/title3.html"))); | |
2207 } | |
2208 | |
2166 } // namespace content | 2209 } // namespace content |
OLD | NEW |