Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 1408743005: Properly recreate swapped out RenderView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix formatting. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // (whose process has been killed/crashed) recreates properly the RenderView and
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(
2188 new_shell, 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(
2206 shell(), embedded_test_server()->GetURL("b.com", "/title3.html")));
2207 }
2208
2166 } // namespace content 2209 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698