OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/macros.h" | 6 #include "base/macros.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.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/navigation_request.h" | 10 #include "content/browser/frame_host/navigation_request.h" |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 EXPECT_EQ(redirect_site_instance_id, | 924 EXPECT_EQ(redirect_site_instance_id, |
925 main_test_rfh()->GetSiteInstance()->GetId()); | 925 main_test_rfh()->GetSiteInstance()->GetId()); |
926 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); | 926 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); |
927 } | 927 } |
928 | 928 |
929 // PlzNavigate: Verify that a previously swapped out RenderFrameHost is | 929 // PlzNavigate: Verify that a previously swapped out RenderFrameHost is |
930 // correctly reused when spawning a speculative RenderFrameHost in a navigation | 930 // correctly reused when spawning a speculative RenderFrameHost in a navigation |
931 // using the same SiteInstance. | 931 // using the same SiteInstance. |
932 TEST_F(NavigatorTestWithBrowserSideNavigation, | 932 TEST_F(NavigatorTestWithBrowserSideNavigation, |
933 SpeculativeRendererReuseSwappedOutRFH) { | 933 SpeculativeRendererReuseSwappedOutRFH) { |
| 934 // This test doesn't make sense in --site-per-process where swapped out |
| 935 // RenderFrameHost is no longer used. |
| 936 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 937 switches::kSitePerProcess)) { |
| 938 return; |
| 939 } |
| 940 |
934 // Navigate to an initial site. | 941 // Navigate to an initial site. |
935 const GURL kUrl1("http://wikipedia.org/"); | 942 const GURL kUrl1("http://wikipedia.org/"); |
936 contents()->NavigateAndCommit(kUrl1); | 943 contents()->NavigateAndCommit(kUrl1); |
937 TestRenderFrameHost* rfh1 = main_test_rfh(); | 944 TestRenderFrameHost* rfh1 = main_test_rfh(); |
938 FrameTreeNode* node = rfh1->frame_tree_node(); | 945 FrameTreeNode* node = rfh1->frame_tree_node(); |
939 RenderFrameHostManager* rfhm = node->render_manager(); | 946 RenderFrameHostManager* rfhm = node->render_manager(); |
940 | 947 |
941 // Increment active frame count to cause the RenderFrameHost to be swapped out | 948 // Increment active frame count to cause the RenderFrameHost to be swapped out |
942 // (instead of immediately destroyed). | 949 // (instead of immediately destroyed). |
943 rfh1->GetSiteInstance()->increment_active_frame_count(); | 950 rfh1->GetSiteInstance()->increment_active_frame_count(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 | 1144 |
1138 SiteInstance* converted_instance_2 = | 1145 SiteInstance* converted_instance_2 = |
1139 ConvertToSiteInstance(rfhm, descriptor, unrelated_instance.get()); | 1146 ConvertToSiteInstance(rfhm, descriptor, unrelated_instance.get()); |
1140 // Should return |unrelated_instance| because its site matches and it is | 1147 // Should return |unrelated_instance| because its site matches and it is |
1141 // unrelated to the current SiteInstance. | 1148 // unrelated to the current SiteInstance. |
1142 EXPECT_EQ(unrelated_instance.get(), converted_instance_2); | 1149 EXPECT_EQ(unrelated_instance.get(), converted_instance_2); |
1143 } | 1150 } |
1144 } | 1151 } |
1145 | 1152 |
1146 } // namespace content | 1153 } // namespace content |
OLD | NEW |