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

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

Issue 782093002: Ensure that before creating proxy of site A, RVH of site A is initialized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 5 years, 10 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/cross_site_transferring_request.h" 10 #include "content/browser/frame_host/cross_site_transferring_request.h"
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost( 1403 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost(
1404 rvh1->GetSiteInstance())); 1404 rvh1->GetSiteInstance()));
1405 opener1->NavigateAndCommit(kUrl2); 1405 opener1->NavigateAndCommit(kUrl2);
1406 EXPECT_TRUE(opener1_manager->GetSwappedOutRenderViewHost( 1406 EXPECT_TRUE(opener1_manager->GetSwappedOutRenderViewHost(
1407 rvh1->GetSiteInstance())); 1407 rvh1->GetSiteInstance()));
1408 1408
1409 // Fake a process crash. 1409 // Fake a process crash.
1410 RenderProcessHost::RendererClosedDetails details( 1410 RenderProcessHost::RendererClosedDetails details(
1411 base::TERMINATION_STATUS_PROCESS_CRASHED, 1411 base::TERMINATION_STATUS_PROCESS_CRASHED,
1412 0); 1412 0);
1413 // TODO(nasko): Investigate whether this test can be made more realistic by
1414 // not faking the notification and just doing the RenderProcessGone. This
1415 // should also get rid of faking |set_render_view_created()| call below.
1413 NotificationService::current()->Notify( 1416 NotificationService::current()->Notify(
1414 NOTIFICATION_RENDERER_PROCESS_CLOSED, 1417 NOTIFICATION_RENDERER_PROCESS_CLOSED,
1415 Source<RenderProcessHost>(rvh1->GetProcess()), 1418 Source<RenderProcessHost>(rvh1->GetProcess()),
1416 Details<RenderProcessHost::RendererClosedDetails>(&details)); 1419 Details<RenderProcessHost::RendererClosedDetails>(&details));
1417 rvh1->set_render_view_created(false); 1420 rvh1->set_render_view_created(false);
1418 1421
1419 // Ensure that the swapped out RenderViewHost has been deleted. 1422 // Ensure that the RenderFrameProxyHost stays around and the RenderFrameProxy
1420 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost( 1423 // is deleted.
1421 rvh1->GetSiteInstance())); 1424 RenderFrameProxyHost* render_frame_proxy_host =
1425 opener1_manager->GetRenderFrameProxyHost(rvh1->GetSiteInstance());
1426 EXPECT_TRUE(render_frame_proxy_host);
1427 EXPECT_FALSE(render_frame_proxy_host->is_render_frame_proxy_live());
1428
1429 // Expect the swapped out RVH to exist.
1430 EXPECT_TRUE(opener1_manager->GetSwappedOutRenderViewHost(
1431 rvh1->GetSiteInstance()));
1422 1432
1423 // Reload the initial tab. This should recreate the opener's swapped out RVH 1433 // Reload the initial tab. This should recreate the opener's swapped out RVH
1424 // in the original SiteInstance. 1434 // in the original SiteInstance.
1425 contents()->GetController().Reload(true); 1435 contents()->GetController().Reload(true);
1426 contents()->GetMainFrame()->PrepareForCommit(kUrl1); 1436 contents()->GetMainFrame()->PrepareForCommit(kUrl1);
1427 EXPECT_EQ(opener1_manager->GetSwappedOutRenderViewHost( 1437 EXPECT_EQ(opener1_manager->GetSwappedOutRenderViewHost(
1428 rvh1->GetSiteInstance())->GetRoutingID(), 1438 rvh1->GetSiteInstance())->GetRoutingID(),
1429 test_rvh()->opener_route_id()); 1439 test_rvh()->opener_route_id());
1430 } 1440 }
1431 1441
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 #if 0 1891 #if 0
1882 // TODO(nick): Currently a proxy to the removed frame lingers in the parent. 1892 // TODO(nick): Currently a proxy to the removed frame lingers in the parent.
1883 // Enable this assert below once the proxies to the subframe are correctly 1893 // Enable this assert below once the proxies to the subframe are correctly
1884 // cleaned up after detach. http://crbug.com/444955. 1894 // cleaned up after detach. http://crbug.com/444955.
1885 ASSERT_TRUE(site_instance->HasOneRef()) 1895 ASSERT_TRUE(site_instance->HasOneRef())
1886 << "This SiteInstance should be destroyable now."; 1896 << "This SiteInstance should be destroyable now.";
1887 #endif 1897 #endif
1888 } 1898 }
1889 1899
1890 } // namespace content 1900 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/browser/frame_host/render_frame_proxy_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698