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

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

Issue 208243019: Move SwapOut methods to RenderFrameHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Nasko's comment Created 6 years, 9 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 | Annotate | Revision Log
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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/frame_host/cross_site_transferring_request.h" 7 #include "content/browser/frame_host/cross_site_transferring_request.h"
8 #include "content/browser/frame_host/navigation_controller_impl.h" 8 #include "content/browser/frame_host/navigation_controller_impl.h"
9 #include "content/browser/frame_host/navigation_entry_impl.h" 9 #include "content/browser/frame_host/navigation_entry_impl.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 EXPECT_TRUE(test_process_host->sink().GetUniqueMessageMatching( 883 EXPECT_TRUE(test_process_host->sink().GetUniqueMessageMatching(
884 FrameMsg_BeforeUnload::ID)); 884 FrameMsg_BeforeUnload::ID));
885 test_host->SendBeforeUnloadACK(true); 885 test_host->SendBeforeUnloadACK(true);
886 886
887 // CrossSiteResourceHandler::StartCrossSiteTransition triggers a 887 // CrossSiteResourceHandler::StartCrossSiteTransition triggers a
888 // call of RenderFrameHostManager::SwapOutOldPage before 888 // call of RenderFrameHostManager::SwapOutOldPage before
889 // RenderFrameHostManager::DidNavigateFrame is called. 889 // RenderFrameHostManager::DidNavigateFrame is called.
890 // The RVH is swapped out after receiving the unload ack. 890 // The RVH is swapped out after receiving the unload ack.
891 manager->SwapOutOldPage(); 891 manager->SwapOutOldPage();
892 EXPECT_TRUE(test_process_host->sink().GetUniqueMessageMatching( 892 EXPECT_TRUE(test_process_host->sink().GetUniqueMessageMatching(
893 ViewMsg_SwapOut::ID)); 893 FrameMsg_SwapOut::ID));
894 test_host->OnSwappedOut(false); 894 test_host->OnSwappedOut(false);
895 895
896 EXPECT_EQ(host, manager->current_frame_host()); 896 EXPECT_EQ(host, manager->current_frame_host());
897 EXPECT_FALSE(manager->current_frame_host()->is_swapped_out()); 897 EXPECT_FALSE(manager->current_frame_host()->is_swapped_out());
898 EXPECT_EQ(host2, manager->pending_frame_host()); 898 EXPECT_EQ(host2, manager->pending_frame_host());
899 // There should be still no navigation messages being sent. 899 // There should be still no navigation messages being sent.
900 EXPECT_FALSE(test_process_host2->sink().GetUniqueMessageMatching( 900 EXPECT_FALSE(test_process_host2->sink().GetUniqueMessageMatching(
901 FrameMsg_Navigate::ID)); 901 FrameMsg_Navigate::ID));
902 902
903 // 3) Cross-site navigate to next site before 2) has committed. -------------- 903 // 3) Cross-site navigate to next site before 2) has committed. --------------
(...skipping 22 matching lines...) Expand all
926 FrameMsg_BeforeUnload::ID)); 926 FrameMsg_BeforeUnload::ID));
927 test_host->SendBeforeUnloadACK(true); 927 test_host->SendBeforeUnloadACK(true);
928 928
929 // CrossSiteResourceHandler::StartCrossSiteTransition triggers a 929 // CrossSiteResourceHandler::StartCrossSiteTransition triggers a
930 // call of RenderFrameHostManager::SwapOutOldPage before 930 // call of RenderFrameHostManager::SwapOutOldPage before
931 // RenderFrameHostManager::DidNavigateFrame is called. Since the previous 931 // RenderFrameHostManager::DidNavigateFrame is called. Since the previous
932 // navigation has already caused the renderer to start swapping out, there 932 // navigation has already caused the renderer to start swapping out, there
933 // will be no more SwapOut messages being sent. 933 // will be no more SwapOut messages being sent.
934 manager->SwapOutOldPage(); 934 manager->SwapOutOldPage();
935 EXPECT_FALSE(test_process_host->sink().GetUniqueMessageMatching( 935 EXPECT_FALSE(test_process_host->sink().GetUniqueMessageMatching(
936 ViewMsg_SwapOut::ID)); 936 FrameMsg_SwapOut::ID));
937 test_host->OnSwappedOut(false); 937 test_host->OnSwappedOut(false);
938 938
939 // Commit. 939 // Commit.
940 manager->DidNavigateFrame(host3); 940 manager->DidNavigateFrame(host3);
941 EXPECT_TRUE(host3 == manager->current_frame_host()); 941 EXPECT_TRUE(host3 == manager->current_frame_host());
942 ASSERT_TRUE(host3); 942 ASSERT_TRUE(host3);
943 EXPECT_TRUE(static_cast<SiteInstanceImpl*>(host3->GetSiteInstance())-> 943 EXPECT_TRUE(static_cast<SiteInstanceImpl*>(host3->GetSiteInstance())->
944 HasSite()); 944 HasSite());
945 // Check the pending RenderFrameHost has been committed. 945 // Check the pending RenderFrameHost has been committed.
946 EXPECT_FALSE(manager->pending_frame_host()); 946 EXPECT_FALSE(manager->pending_frame_host());
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 1714
1715 // Simulate the swap out ack. 1715 // Simulate the swap out ack.
1716 rvh1->OnSwappedOut(false); 1716 rvh1->OnSwappedOut(false);
1717 1717
1718 // rvh1 should be swapped out. 1718 // rvh1 should be swapped out.
1719 EXPECT_FALSE(rvh_deleted_observer.deleted()); 1719 EXPECT_FALSE(rvh_deleted_observer.deleted());
1720 EXPECT_TRUE(rvh1->IsSwappedOut()); 1720 EXPECT_TRUE(rvh1->IsSwappedOut());
1721 } 1721 }
1722 1722
1723 } // namespace content 1723 } // 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_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698