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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2798673002: Revert "Destroy the old RenderWidgetHostView when swapping out a main frame." (Closed)
Patch Set: Created 3 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 9222 matching lines...) Expand 10 before | Expand all | Expand 10 after
9233 mouse_event.setType(blink::WebInputEvent::MouseUp); 9233 mouse_event.setType(blink::WebInputEvent::MouseUp);
9234 mouse_event.x = 75; 9234 mouse_event.x = 75;
9235 mouse_event.y = 75; 9235 mouse_event.y = 75;
9236 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); 9236 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
9237 9237
9238 EXPECT_TRUE(event_monitor.EventWasReceived()); 9238 EXPECT_TRUE(event_monitor.EventWasReceived());
9239 EXPECT_EQ(mouse_down_coords, 9239 EXPECT_EQ(mouse_down_coords,
9240 gfx::Point(event_monitor.event().x, event_monitor.event().y)); 9240 gfx::Point(event_monitor.event().x, event_monitor.event().y));
9241 } 9241 }
9242 9242
9243 // This tests that we don't hide the RenderViewHost when reusing the
9244 // RenderViewHost for a subframe. See https://crbug.com/638375.
9245 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ReusedRenderViewNotHidden) {
9246 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
9247 GURL b_url_a_subframe(embedded_test_server()->GetURL(
9248 "b.com", "/cross_site_iframe_factory.html?b(a)"));
9249
9250 EXPECT_TRUE(NavigateToURL(shell(), a_url));
9251
9252 // Open a popup in a.com.
9253 Shell* popup = OpenPopup(shell(), a_url, "popup");
9254
9255 // Navigate this popup to b.com with an a.com subframe.
9256 EXPECT_TRUE(NavigateToURL(popup, b_url_a_subframe));
9257
9258 FrameTreeNode* root = static_cast<WebContentsImpl*>(popup->web_contents())
9259 ->GetFrameTree()
9260 ->root();
9261 FrameTreeNode* child_node = root->child_at(0);
9262
9263 EXPECT_FALSE(child_node->current_frame_host()
9264 ->render_view_host()
9265 ->GetWidget()
9266 ->is_hidden());
9267 }
9268
9269 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
9270 RenderViewHostStaysActiveWithLateSwapoutACK) {
9271 EXPECT_TRUE(NavigateToURL(
9272 shell(), embedded_test_server()->GetURL("a.com", "/title1.html")));
9273
9274 // Open a popup and navigate it to b.com.
9275 Shell* popup = OpenPopup(
9276 shell(), embedded_test_server()->GetURL("a.com", "/title2.html"), "foo");
9277
9278 RenderFrameHostImpl* rfh =
9279 static_cast<RenderFrameHostImpl*>(popup->web_contents()->GetMainFrame());
9280 RenderViewHostImpl* rvh = rfh->render_view_host();
9281
9282 // Disable the swapout ACK and the swapout timer.
9283 scoped_refptr<SwapoutACKMessageFilter> filter = new SwapoutACKMessageFilter();
9284 rfh->GetProcess()->AddFilter(filter.get());
9285 rfh->DisableSwapOutTimerForTesting();
9286
9287 // Navigate popup to b.com. Because there's an opener, the RVH for a.com
9288 // stays around in swapped-out state.
9289 EXPECT_TRUE(NavigateToURL(
9290 popup, embedded_test_server()->GetURL("b.com", "/title3.html")));
9291 EXPECT_FALSE(rvh->is_active());
9292
9293 // Kill the b.com process.
9294 RenderProcessHost* b_process =
9295 popup->web_contents()->GetMainFrame()->GetProcess();
9296 RenderProcessHostWatcher crash_observer(
9297 b_process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
9298 b_process->Shutdown(0, false);
9299 crash_observer.Wait();
9300
9301 // Go back in the popup from b.com to a.com/title2.html. Because the current
9302 // b.com RFH is dead, the new RFH is committed right away (without waiting
9303 // for renderer to commit), so that users don't need to look at the sad tab.
9304 TestNavigationObserver back_observer(popup->web_contents());
9305 popup->web_contents()->GetController().GoBack();
9306
9307 // Pretend that the original RFH in a.com now finishes running its unload
9308 // handler and sends the swapout ACK.
9309 rfh->OnSwappedOut();
9310
9311 // Wait for the new a.com navigation to finish.
9312 back_observer.Wait();
9313
9314 // The RVH for a.com should've been reused, and it should be active.
9315 EXPECT_TRUE(rvh->is_active());
9316 }
9317
9318 // Verify that a remote-to-local navigation in a crashed subframe works. See 9243 // Verify that a remote-to-local navigation in a crashed subframe works. See
9319 // https://crbug.com/487872. 9244 // https://crbug.com/487872.
9320 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 9245 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
9321 RemoteToLocalNavigationInCrashedSubframe) { 9246 RemoteToLocalNavigationInCrashedSubframe) {
9322 GURL main_url(embedded_test_server()->GetURL( 9247 GURL main_url(embedded_test_server()->GetURL(
9323 "a.com", "/cross_site_iframe_factory.html?a(b)")); 9248 "a.com", "/cross_site_iframe_factory.html?a(b)"));
9324 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 9249 EXPECT_TRUE(NavigateToURL(shell(), main_url));
9325 9250
9326 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); 9251 FrameTreeNode* root = web_contents()->GetFrameTree()->root();
9327 FrameTreeNode* child = root->child_at(0); 9252 FrameTreeNode* child = root->child_at(0);
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
9770 9695
9771 // Try the same navigation, but use the browser-initiated path. 9696 // Try the same navigation, but use the browser-initiated path.
9772 NavigateFrameToURL(root->child_at(0), frame_url); 9697 NavigateFrameToURL(root->child_at(0), frame_url);
9773 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host()); 9698 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host());
9774 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url); 9699 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url);
9775 EXPECT_EQ(b_site_instance, 9700 EXPECT_EQ(b_site_instance,
9776 root->child_at(0)->current_frame_host()->GetSiteInstance()); 9701 root->child_at(0)->current_frame_host()->GetSiteInstance());
9777 } 9702 }
9778 9703
9779 } // namespace content 9704 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698