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/macros.h" | 6 #include "base/macros.h" |
6 #include "base/time/time.h" | 7 #include "base/time/time.h" |
7 #include "content/browser/frame_host/navigation_controller_impl.h" | 8 #include "content/browser/frame_host/navigation_controller_impl.h" |
8 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
9 #include "content/browser/frame_host/navigation_request.h" | 10 #include "content/browser/frame_host/navigation_request.h" |
10 #include "content/browser/frame_host/navigation_request_info.h" | 11 #include "content/browser/frame_host/navigation_request_info.h" |
11 #include "content/browser/frame_host/navigator.h" | 12 #include "content/browser/frame_host/navigator.h" |
12 #include "content/browser/frame_host/navigator_impl.h" | 13 #include "content/browser/frame_host/navigator_impl.h" |
13 #include "content/browser/frame_host/render_frame_host_manager.h" | 14 #include "content/browser/frame_host/render_frame_host_manager.h" |
14 #include "content/browser/site_instance_impl.h" | 15 #include "content/browser/site_instance_impl.h" |
15 #include "content/browser/streams/stream.h" | 16 #include "content/browser/streams/stream.h" |
16 #include "content/common/navigation_params.h" | 17 #include "content/common/navigation_params.h" |
17 #include "content/public/browser/stream_handle.h" | 18 #include "content/public/browser/stream_handle.h" |
19 #include "content/public/common/content_switches.h" | |
18 #include "content/public/common/url_constants.h" | 20 #include "content/public/common/url_constants.h" |
19 #include "content/public/common/url_utils.h" | 21 #include "content/public/common/url_utils.h" |
20 #include "content/test/browser_side_navigation_test_utils.h" | 22 #include "content/test/browser_side_navigation_test_utils.h" |
21 #include "content/test/test_navigation_url_loader.h" | 23 #include "content/test/test_navigation_url_loader.h" |
22 #include "content/test/test_render_frame_host.h" | 24 #include "content/test/test_render_frame_host.h" |
23 #include "content/test/test_web_contents.h" | 25 #include "content/test/test_web_contents.h" |
24 #include "net/base/load_flags.h" | 26 #include "net/base/load_flags.h" |
25 #include "net/http/http_response_headers.h" | 27 #include "net/http/http_response_headers.h" |
26 #include "net/url_request/redirect_info.h" | 28 #include "net/url_request/redirect_info.h" |
27 #include "ui/base/page_transition_types.h" | 29 #include "ui/base/page_transition_types.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 controller().GetBrowserContext()))); | 68 controller().GetBrowserContext()))); |
67 static_cast<NavigatorImpl*>(node->navigator())->RequestNavigation( | 69 static_cast<NavigatorImpl*>(node->navigator())->RequestNavigation( |
68 node, *entry, reload_type, base::TimeTicks::Now()); | 70 node, *entry, reload_type, base::TimeTicks::Now()); |
69 } | 71 } |
70 | 72 |
71 NavigationRequest* GetNavigationRequestForFrameTreeNode( | 73 NavigationRequest* GetNavigationRequestForFrameTreeNode( |
72 FrameTreeNode* frame_tree_node) { | 74 FrameTreeNode* frame_tree_node) { |
73 return static_cast<NavigatorImpl*>(frame_tree_node->navigator()) | 75 return static_cast<NavigatorImpl*>(frame_tree_node->navigator()) |
74 ->GetNavigationRequestForNodeForTesting(frame_tree_node); | 76 ->GetNavigationRequestForNodeForTesting(frame_tree_node); |
75 } | 77 } |
78 | |
79 TestRenderFrameHost* GetSpeculativeRenderFrameHost( | |
80 RenderFrameHostManager* rfhm) { | |
81 return static_cast<TestRenderFrameHost*>( | |
82 rfhm->speculative_render_frame_host_.get()); | |
83 } | |
84 | |
85 void LoadURLAndBeginNavigationOnMainFrame(const GURL& url) { | |
86 contents()->GetController().LoadURL( | |
87 url, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | |
88 main_test_rfh()->SendBeginNavigationWithURL(url); | |
89 } | |
76 }; | 90 }; |
77 | 91 |
92 // PlzNavigate: Test final state after a complete navigation (to avoid repeating | |
93 // these checks). | |
94 TEST_F(NavigatorTestWithBrowserSideNavigation, NavigationFinishedState) { | |
95 const GURL kUrl("http://chromium.org/"); | |
96 contents()->NavigateAndCommit(kUrl); | |
97 ASSERT_TRUE(main_test_rfh()); | |
98 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, main_test_rfh()->rfh_state()); | |
99 EXPECT_EQ(SiteInstanceImpl::GetSiteForURL(browser_context(), kUrl), | |
100 main_test_rfh()->GetSiteInstance()->GetSiteURL()); | |
101 // After a navigation is finished no speculative RenderFrameHost should | |
102 // exist. | |
103 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
nasko
2014/12/20 00:09:09
I'd rather not add more code to contents(), as peo
carlosk
2014/12/29 16:40:16
I complied with what nasko@ and clamy@ asked for b
| |
104 // With PlzNavigate enabled a pending RenderFrameHost should never exist. | |
105 EXPECT_FALSE(contents()->GetPendingMainFrame()); | |
106 } | |
107 | |
78 // PlzNavigate: Test that a proper NavigationRequest is created by | 108 // PlzNavigate: Test that a proper NavigationRequest is created by |
79 // BeginNavigation. | 109 // BeginNavigation. |
80 // Note that all PlzNavigate methods on the browser side require the use of the | 110 // Note that all PlzNavigate methods on the browser side require the use of the |
81 // flag kEnableBrowserSideNavigation. | 111 // flag kEnableBrowserSideNavigation. |
82 TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) { | 112 TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) { |
83 const GURL kUrl1("http://www.google.com/"); | 113 const GURL kUrl1("http://www.google.com/"); |
84 const GURL kUrl2("http://www.chromium.org/"); | 114 const GURL kUrl2("http://www.chromium.org/"); |
85 const GURL kUrl3("http://www.gmail.com/"); | 115 const GURL kUrl3("http://www.gmail.com/"); |
86 | 116 |
87 contents()->NavigateAndCommit(kUrl1); | 117 contents()->NavigateAndCommit(kUrl1); |
118 FrameTreeNode* root = contents()->GetFrameTree()->root(); | |
119 RenderFrameHostManager* root_rfhm = root->render_manager(); | |
88 | 120 |
89 // Add a subframe. | 121 // Add a subframe. |
90 FrameTreeNode* root = contents()->GetFrameTree()->root(); | |
91 TestRenderFrameHost* subframe_rfh = static_cast<TestRenderFrameHost*>( | 122 TestRenderFrameHost* subframe_rfh = static_cast<TestRenderFrameHost*>( |
92 contents()->GetFrameTree()->AddFrame( | 123 contents()->GetFrameTree()->AddFrame( |
93 root, root->current_frame_host()->GetProcess()->GetID(), 14, | 124 root, root->current_frame_host()->GetProcess()->GetID(), 14, |
94 "Child")); | 125 "Child")); |
95 EXPECT_TRUE(subframe_rfh); | 126 EXPECT_TRUE(subframe_rfh); |
96 | 127 |
97 FrameTreeNode* subframe_node = subframe_rfh->frame_tree_node(); | 128 FrameTreeNode* subframe_node = subframe_rfh->frame_tree_node(); |
129 RenderFrameHostManager* subframe_rfhm = subframe_node->render_manager(); | |
130 EXPECT_NE(root_rfhm, subframe_rfhm); | |
131 | |
98 SendRequestNavigation(subframe_rfh->frame_tree_node(), kUrl2); | 132 SendRequestNavigation(subframe_rfh->frame_tree_node(), kUrl2); |
99 // There is no previous renderer in the subframe, so BeginNavigation is | 133 // There is no previous renderer in the subframe, so BeginNavigation is |
100 // handled already. | 134 // handled already. |
101 NavigationRequest* subframe_request = | 135 NavigationRequest* subframe_request = |
102 GetNavigationRequestForFrameTreeNode(subframe_node); | 136 GetNavigationRequestForFrameTreeNode(subframe_node); |
103 TestNavigationURLLoader* subframe_loader = | 137 TestNavigationURLLoader* subframe_loader = |
104 GetLoaderForNavigationRequest(subframe_request); | 138 GetLoaderForNavigationRequest(subframe_request); |
105 ASSERT_TRUE(subframe_request); | 139 ASSERT_TRUE(subframe_request); |
106 EXPECT_EQ(kUrl2, subframe_request->common_params().url); | 140 EXPECT_EQ(kUrl2, subframe_request->common_params().url); |
107 EXPECT_EQ(kUrl2, subframe_loader->common_params().url); | 141 EXPECT_EQ(kUrl2, subframe_loader->common_params().url); |
108 // First party for cookies url should be that of the main frame. | 142 // First party for cookies url should be that of the main frame. |
109 EXPECT_EQ(kUrl1, subframe_loader->request_info()->first_party_for_cookies); | 143 EXPECT_EQ(kUrl1, subframe_loader->request_info()->first_party_for_cookies); |
110 EXPECT_FALSE(subframe_loader->request_info()->is_main_frame); | 144 EXPECT_FALSE(subframe_loader->request_info()->is_main_frame); |
111 EXPECT_TRUE(subframe_loader->request_info()->parent_is_main_frame); | 145 EXPECT_TRUE(subframe_loader->request_info()->parent_is_main_frame); |
146 EXPECT_FALSE(GetSpeculativeRenderFrameHost(root_rfhm)); | |
147 | |
148 // Subframe navigations should not create a speculative RenderFrameHost. | |
149 // (unless site-per-process is enabled). | |
150 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
151 switches::kSitePerProcess)) { | |
152 EXPECT_TRUE(GetSpeculativeRenderFrameHost(subframe_rfhm)); | |
153 } else { | |
154 EXPECT_FALSE(GetSpeculativeRenderFrameHost(subframe_rfhm)); | |
155 } | |
112 | 156 |
113 SendRequestNavigation(root, kUrl3); | 157 SendRequestNavigation(root, kUrl3); |
114 // Simulate a BeginNavigation IPC on the main frame. | 158 // Simulate a BeginNavigation IPC on the main frame. |
115 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl3); | 159 main_test_rfh()->SendBeginNavigationWithURL(kUrl3); |
116 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(root); | 160 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(root); |
117 TestNavigationURLLoader* main_loader = | 161 TestNavigationURLLoader* main_loader = |
118 GetLoaderForNavigationRequest(main_request); | 162 GetLoaderForNavigationRequest(main_request); |
119 ASSERT_TRUE(main_request); | 163 ASSERT_TRUE(main_request); |
120 EXPECT_EQ(kUrl3, main_request->common_params().url); | 164 EXPECT_EQ(kUrl3, main_request->common_params().url); |
121 EXPECT_EQ(kUrl3, main_loader->common_params().url); | 165 EXPECT_EQ(kUrl3, main_loader->common_params().url); |
122 EXPECT_EQ(kUrl3, main_loader->request_info()->first_party_for_cookies); | 166 EXPECT_EQ(kUrl3, main_loader->request_info()->first_party_for_cookies); |
123 EXPECT_TRUE(main_loader->request_info()->is_main_frame); | 167 EXPECT_TRUE(main_loader->request_info()->is_main_frame); |
124 EXPECT_FALSE(main_loader->request_info()->parent_is_main_frame); | 168 EXPECT_FALSE(main_loader->request_info()->parent_is_main_frame); |
169 | |
170 // Main frame navigations to different sites should use a speculative | |
171 // RenderFrameHost. | |
172 EXPECT_TRUE(GetSpeculativeRenderFrameHost(root_rfhm)); | |
173 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
174 switches::kSitePerProcess)) { | |
175 EXPECT_TRUE(GetSpeculativeRenderFrameHost(subframe_rfhm)); | |
176 } else { | |
177 EXPECT_FALSE(GetSpeculativeRenderFrameHost(subframe_rfhm)); | |
178 } | |
125 } | 179 } |
126 | 180 |
127 // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that | 181 // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that |
128 // RenderFrameHost is not modified when the navigation commits. | 182 // RenderFrameHost is not modified when the navigation commits. |
129 TEST_F(NavigatorTestWithBrowserSideNavigation, NoLiveRenderer) { | 183 TEST_F(NavigatorTestWithBrowserSideNavigation, NoLiveRenderer) { |
130 const GURL kUrl("http://www.google.com/"); | 184 const GURL kUrl("http://www.google.com/"); |
131 | 185 |
132 EXPECT_FALSE(main_test_rfh()->render_view_host()->IsRenderViewLive()); | 186 EXPECT_FALSE(main_test_rfh()->render_view_host()->IsRenderViewLive()); |
133 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | 187 RenderFrameHostImpl* rfh = main_test_rfh(); |
188 FrameTreeNode* node = rfh->frame_tree_node(); | |
134 SendRequestNavigation(node, kUrl); | 189 SendRequestNavigation(node, kUrl); |
190 | |
191 // A NavigationRequest should have been generated. | |
135 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); | 192 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); |
136 // A NavigationRequest should have been generated. | |
137 EXPECT_TRUE(main_request != NULL); | 193 EXPECT_TRUE(main_request != NULL); |
138 RenderFrameHostImpl* rfh = main_test_rfh(); | 194 |
195 // As we're re-using the current RenderFrameHost, no speculative one should be | |
196 // created. | |
197 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
139 | 198 |
140 // Now return the response without any redirects. This will cause the | 199 // Now return the response without any redirects. This will cause the |
141 // navigation to commit at the same URL. | 200 // navigation to commit at the same URL. |
142 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 201 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
143 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( | 202 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( |
144 response, MakeEmptyStream()); | 203 response, MakeEmptyStream()); |
145 main_request = GetNavigationRequestForFrameTreeNode(node); | 204 main_request = GetNavigationRequestForFrameTreeNode(node); |
146 | 205 |
147 // The main RFH should not have been changed, and the renderer should have | 206 // The main RFH should not have been changed, and the renderer should have |
148 // been initialized. | 207 // been initialized. |
149 EXPECT_EQ(rfh, main_test_rfh()); | 208 EXPECT_EQ(rfh, main_test_rfh()); |
150 EXPECT_TRUE(main_test_rfh()->IsRenderFrameLive()); | 209 EXPECT_TRUE(main_test_rfh()->IsRenderFrameLive()); |
151 EXPECT_TRUE(main_test_rfh()->render_view_host()->IsRenderViewLive()); | 210 EXPECT_TRUE(main_test_rfh()->render_view_host()->IsRenderViewLive()); |
152 } | 211 } |
153 | 212 |
154 // PlzNavigate: Test that commiting an HTTP 204 or HTTP 205 response cancels the | 213 // PlzNavigate: Test that committing an HTTP 204 or HTTP 205 response cancels |
155 // navigation. | 214 // the navigation. |
156 TEST_F(NavigatorTestWithBrowserSideNavigation, NoContent) { | 215 TEST_F(NavigatorTestWithBrowserSideNavigation, NoContent) { |
157 const GURL kUrl1("http://www.chromium.org/"); | 216 const GURL kUrl1("http://www.chromium.org/"); |
158 const GURL kUrl2("http://www.google.com/"); | 217 const GURL kUrl2("http://www.google.com/"); |
159 | 218 |
160 // Load a URL. | 219 // Load a URL. |
161 contents()->NavigateAndCommit(kUrl1); | 220 contents()->NavigateAndCommit(kUrl1); |
162 RenderFrameHostImpl* rfh = main_test_rfh(); | |
163 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh->rfh_state()); | |
164 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | 221 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); |
165 | 222 |
166 // Navigate to a different site. | 223 // Navigate to a different site. |
167 SendRequestNavigation(node, kUrl2); | 224 LoadURLAndBeginNavigationOnMainFrame(kUrl2); |
clamy
2014/12/19 13:35:57
Considering that the unit tests are for NavigatorI
nasko
2014/12/20 00:09:09
I'd second that, mainly since the abstraction is j
carlosk
2014/12/29 16:40:16
They were 2 repetitive calls that apart from the U
| |
168 main_test_rfh()->SendBeginNavigationWithURL(kUrl2); | |
169 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); | 225 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); |
170 ASSERT_TRUE(main_request); | 226 ASSERT_TRUE(main_request); |
171 | 227 |
228 // Navigations to a different site do create a speculative RenderFrameHost. | |
229 EXPECT_TRUE(contents()->GetSpeculativeMainFrame()); | |
230 | |
172 // Commit an HTTP 204 response. | 231 // Commit an HTTP 204 response. |
173 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 232 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
174 const char kNoContentHeaders[] = "HTTP/1.1 204 No Content\0\0"; | 233 const char kNoContentHeaders[] = "HTTP/1.1 204 No Content\0\0"; |
175 response->head.headers = new net::HttpResponseHeaders( | 234 response->head.headers = new net::HttpResponseHeaders( |
176 std::string(kNoContentHeaders, arraysize(kNoContentHeaders))); | 235 std::string(kNoContentHeaders, arraysize(kNoContentHeaders))); |
177 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( | 236 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( |
178 response, MakeEmptyStream()); | 237 response, MakeEmptyStream()); |
179 | 238 |
180 // There should be no pending RenderFrameHost; the navigation was aborted. | 239 // There should be no pending nor speculative RenderFrameHost; the navigation |
240 // was aborted. | |
181 EXPECT_FALSE(GetNavigationRequestForFrameTreeNode(node)); | 241 EXPECT_FALSE(GetNavigationRequestForFrameTreeNode(node)); |
182 EXPECT_FALSE(node->render_manager()->pending_frame_host()); | 242 EXPECT_FALSE(contents()->GetPendingMainFrame()); |
243 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
183 | 244 |
184 // Now, repeat the test with 205 Reset Content. | 245 // Now, repeat the test with 205 Reset Content. |
185 | 246 |
186 // Navigate to a different site again. | 247 // Navigate to a different site again. |
187 SendRequestNavigation(node, kUrl2); | 248 LoadURLAndBeginNavigationOnMainFrame(kUrl2); |
188 main_test_rfh()->SendBeginNavigationWithURL(kUrl2); | |
189 main_request = GetNavigationRequestForFrameTreeNode(node); | 249 main_request = GetNavigationRequestForFrameTreeNode(node); |
190 ASSERT_TRUE(main_request); | 250 ASSERT_TRUE(main_request); |
251 EXPECT_TRUE(contents()->GetSpeculativeMainFrame()); | |
191 | 252 |
192 // Commit an HTTP 205 response. | 253 // Commit an HTTP 205 response. |
193 response = new ResourceResponse; | 254 response = new ResourceResponse; |
194 const char kResetContentHeaders[] = "HTTP/1.1 205 Reset Content\0\0"; | 255 const char kResetContentHeaders[] = "HTTP/1.1 205 Reset Content\0\0"; |
195 response->head.headers = new net::HttpResponseHeaders( | 256 response->head.headers = new net::HttpResponseHeaders( |
196 std::string(kResetContentHeaders, arraysize(kResetContentHeaders))); | 257 std::string(kResetContentHeaders, arraysize(kResetContentHeaders))); |
197 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( | 258 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( |
198 response, MakeEmptyStream()); | 259 response, MakeEmptyStream()); |
199 | 260 |
200 // There should be no pending RenderFrameHost; the navigation was aborted. | 261 // There should be no pending nor speculative RenderFrameHost; the navigation |
262 // was aborted. | |
201 EXPECT_FALSE(GetNavigationRequestForFrameTreeNode(node)); | 263 EXPECT_FALSE(GetNavigationRequestForFrameTreeNode(node)); |
202 EXPECT_FALSE(node->render_manager()->pending_frame_host()); | 264 EXPECT_FALSE(contents()->GetPendingMainFrame()); |
265 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
203 } | 266 } |
204 | 267 |
205 // PlzNavigate: Test that a new RenderFrameHost is created when doing a cross | 268 // PlzNavigate: Test that a new RenderFrameHost is created when doing a cross |
206 // site navigation. | 269 // site navigation. |
207 TEST_F(NavigatorTestWithBrowserSideNavigation, CrossSiteNavigation) { | 270 TEST_F(NavigatorTestWithBrowserSideNavigation, CrossSiteNavigation) { |
208 const GURL kUrl1("http://www.chromium.org/"); | 271 const GURL kUrl1("http://www.chromium.org/"); |
209 const GURL kUrl2("http://www.google.com/"); | 272 const GURL kUrl2("http://www.google.com/"); |
210 | 273 |
211 contents()->NavigateAndCommit(kUrl1); | 274 contents()->NavigateAndCommit(kUrl1); |
212 RenderFrameHostImpl* rfh = main_test_rfh(); | 275 RenderFrameHostImpl* rfh = main_test_rfh(); |
213 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh->rfh_state()); | |
214 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | 276 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); |
215 | 277 |
216 // Navigate to a different site. | 278 // Navigate to a different site. |
217 SendRequestNavigation(node, kUrl2); | 279 LoadURLAndBeginNavigationOnMainFrame(kUrl2); |
218 main_test_rfh()->SendBeginNavigationWithURL(kUrl2); | |
219 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); | 280 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); |
220 ASSERT_TRUE(main_request); | 281 ASSERT_TRUE(main_request); |
282 EXPECT_TRUE(contents()->GetSpeculativeMainFrame()); | |
221 | 283 |
222 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 284 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
223 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( | 285 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( |
224 response, MakeEmptyStream()); | 286 response, MakeEmptyStream()); |
225 RenderFrameHostImpl* pending_rfh = | 287 EXPECT_TRUE(contents()->GetSpeculativeMainFrame()); |
226 node->render_manager()->pending_frame_host(); | 288 |
227 ASSERT_TRUE(pending_rfh); | 289 contents()->CommitPendingNavigation(); |
228 EXPECT_NE(pending_rfh, rfh); | 290 RenderFrameHostImpl* final_rfh = main_test_rfh(); |
229 EXPECT_TRUE(pending_rfh->IsRenderFrameLive()); | 291 ASSERT_TRUE(final_rfh); |
230 EXPECT_TRUE(pending_rfh->render_view_host()->IsRenderViewLive()); | 292 EXPECT_NE(rfh, final_rfh); |
293 EXPECT_TRUE(final_rfh->IsRenderFrameLive()); | |
294 EXPECT_TRUE(final_rfh->render_view_host()->IsRenderViewLive()); | |
295 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
231 } | 296 } |
232 | 297 |
233 // PlzNavigate: Test that redirects are followed. | 298 // PlzNavigate: Test that redirects are followed and the speculative renderer |
299 // logic behaves as expected. | |
234 TEST_F(NavigatorTestWithBrowserSideNavigation, RedirectCrossSite) { | 300 TEST_F(NavigatorTestWithBrowserSideNavigation, RedirectCrossSite) { |
235 const GURL kUrl1("http://www.chromium.org/"); | 301 const GURL kUrl1("http://www.chromium.org/"); |
236 const GURL kUrl2("http://www.google.com/"); | 302 const GURL kUrl2("http://www.google.com/"); |
237 | 303 |
238 contents()->NavigateAndCommit(kUrl1); | 304 contents()->NavigateAndCommit(kUrl1); |
239 RenderFrameHostImpl* rfh = main_test_rfh(); | 305 RenderFrameHostImpl* rfh = main_test_rfh(); |
240 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh->rfh_state()); | |
241 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | 306 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); |
242 | 307 |
243 // Navigate to a URL on the same site. | 308 // Navigate to a URL on the same site. |
244 SendRequestNavigation(node, kUrl1); | 309 LoadURLAndBeginNavigationOnMainFrame(kUrl1); |
245 main_test_rfh()->SendBeginNavigationWithURL(kUrl1); | |
246 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); | 310 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); |
247 ASSERT_TRUE(main_request); | 311 ASSERT_TRUE(main_request); |
312 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
248 | 313 |
249 // It then redirects to another site. | 314 // It then redirects to another site. |
250 net::RedirectInfo redirect_info; | 315 net::RedirectInfo redirect_info; |
251 redirect_info.status_code = 302; | 316 redirect_info.status_code = 302; |
252 redirect_info.new_method = "GET"; | 317 redirect_info.new_method = "GET"; |
253 redirect_info.new_url = kUrl2; | 318 redirect_info.new_url = kUrl2; |
254 redirect_info.new_first_party_for_cookies = kUrl2; | 319 redirect_info.new_first_party_for_cookies = kUrl2; |
255 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 320 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
256 GetLoaderForNavigationRequest(main_request)->CallOnRequestRedirected( | 321 GetLoaderForNavigationRequest(main_request)->CallOnRequestRedirected( |
257 redirect_info, response); | 322 redirect_info, response); |
258 | 323 |
259 // The redirect should have been followed. | 324 // The redirect should have been followed. |
260 EXPECT_EQ(1, GetLoaderForNavigationRequest(main_request)->redirect_count()); | 325 EXPECT_EQ(1, GetLoaderForNavigationRequest(main_request)->redirect_count()); |
326 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
261 | 327 |
262 // Then it commits. | 328 // Then it commits. |
263 response = new ResourceResponse; | 329 response = new ResourceResponse; |
264 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( | 330 GetLoaderForNavigationRequest(main_request)->CallOnResponseStarted( |
265 response, MakeEmptyStream()); | 331 response, MakeEmptyStream()); |
266 RenderFrameHostImpl* pending_rfh = | 332 RenderFrameHost* last_speculative_rfh = contents()->GetSpeculativeMainFrame(); |
267 node->render_manager()->pending_frame_host(); | 333 EXPECT_TRUE(last_speculative_rfh); |
268 ASSERT_TRUE(pending_rfh); | 334 |
269 EXPECT_NE(pending_rfh, rfh); | 335 // And commits provisional load. |
270 EXPECT_TRUE(pending_rfh->IsRenderFrameLive()); | 336 contents()->CommitPendingNavigation(); |
271 EXPECT_TRUE(pending_rfh->render_view_host()->IsRenderViewLive()); | 337 RenderFrameHostImpl* final_rfh = main_test_rfh(); |
338 ASSERT_TRUE(final_rfh); | |
339 EXPECT_NE(rfh, final_rfh); | |
340 EXPECT_EQ(last_speculative_rfh, final_rfh); | |
341 EXPECT_TRUE(final_rfh->IsRenderFrameLive()); | |
342 EXPECT_TRUE(final_rfh->render_view_host()->IsRenderViewLive()); | |
343 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
272 } | 344 } |
273 | 345 |
274 // PlzNavigate: Test that a navigation is cancelled if another request has been | 346 // PlzNavigate: Test that a navigation is canceled if another request has been |
275 // issued in the meantime. | 347 // issued in the meantime. Also confirms that the speculative renderer is |
348 // correctly updated in the process. | |
276 TEST_F(NavigatorTestWithBrowserSideNavigation, ReplacePendingNavigation) { | 349 TEST_F(NavigatorTestWithBrowserSideNavigation, ReplacePendingNavigation) { |
277 const GURL kUrl0("http://www.wikipedia.org/"); | 350 const GURL kUrl0("http://www.wikipedia.org/"); |
278 const GURL kUrl0_site = SiteInstance::GetSiteForURL(browser_context(), kUrl0); | |
279 const GURL kUrl1("http://www.chromium.org/"); | 351 const GURL kUrl1("http://www.chromium.org/"); |
352 const GURL kUrl1_site = SiteInstance::GetSiteForURL(browser_context(), kUrl1); | |
280 const GURL kUrl2("http://www.google.com/"); | 353 const GURL kUrl2("http://www.google.com/"); |
281 const GURL kUrl2_site = SiteInstance::GetSiteForURL(browser_context(), kUrl2); | 354 const GURL kUrl2_site = SiteInstance::GetSiteForURL(browser_context(), kUrl2); |
282 | 355 |
283 // Initialization. | 356 // Initialization. |
284 contents()->NavigateAndCommit(kUrl0); | 357 contents()->NavigateAndCommit(kUrl0); |
285 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | 358 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); |
286 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); | |
287 | 359 |
288 // Request navigation to the 1st URL. | 360 // Request navigation to the 1st URL. |
289 SendRequestNavigation(node, kUrl1); | 361 LoadURLAndBeginNavigationOnMainFrame(kUrl1); |
290 main_test_rfh()->SendBeginNavigationWithURL(kUrl1); | |
291 NavigationRequest* request1 = GetNavigationRequestForFrameTreeNode(node); | 362 NavigationRequest* request1 = GetNavigationRequestForFrameTreeNode(node); |
292 ASSERT_TRUE(request1); | 363 ASSERT_TRUE(request1); |
293 EXPECT_EQ(kUrl1, request1->common_params().url); | 364 EXPECT_EQ(kUrl1, request1->common_params().url); |
294 base::WeakPtr<TestNavigationURLLoader> loader1 = | 365 base::WeakPtr<TestNavigationURLLoader> loader1 = |
295 GetLoaderForNavigationRequest(request1)->AsWeakPtr(); | 366 GetLoaderForNavigationRequest(request1)->AsWeakPtr(); |
296 | 367 |
368 // Confirm a speculative RFH was created. | |
369 ASSERT_TRUE(contents()->GetSpeculativeMainFrame()); | |
370 int32 site_instance_id_1 = | |
371 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetId(); | |
372 EXPECT_EQ( | |
373 kUrl1_site, | |
374 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetSiteURL()); | |
375 | |
297 // Request navigation to the 2nd URL; the NavigationRequest must have been | 376 // Request navigation to the 2nd URL; the NavigationRequest must have been |
298 // replaced by a new one with a different URL. | 377 // replaced by a new one with a different URL. |
299 SendRequestNavigation(node, kUrl2); | 378 LoadURLAndBeginNavigationOnMainFrame(kUrl2); |
300 main_test_rfh()->SendBeginNavigationWithURL(kUrl2); | |
301 NavigationRequest* request2 = GetNavigationRequestForFrameTreeNode(node); | 379 NavigationRequest* request2 = GetNavigationRequestForFrameTreeNode(node); |
302 ASSERT_TRUE(request2); | 380 ASSERT_TRUE(request2); |
303 EXPECT_EQ(kUrl2, request2->common_params().url); | 381 EXPECT_EQ(kUrl2, request2->common_params().url); |
304 | 382 |
305 // Confirm that the first loader got destroyed. | 383 // Confirm that the first loader got destroyed. |
306 EXPECT_FALSE(loader1); | 384 EXPECT_FALSE(loader1); |
307 | 385 |
308 // Confirm that the commit corresponds to the new request. | 386 // Confirm that a new speculative RFH was created. |
387 ASSERT_TRUE(contents()->GetSpeculativeMainFrame()); | |
388 int32 site_instance_id_2 = | |
389 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetId(); | |
390 EXPECT_NE(site_instance_id_1, site_instance_id_2); | |
391 | |
392 // Commit. | |
309 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 393 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
310 GetLoaderForNavigationRequest(request2)->CallOnResponseStarted( | 394 GetLoaderForNavigationRequest(request2)->CallOnResponseStarted( |
311 response, MakeEmptyStream()); | 395 response, MakeEmptyStream()); |
312 RenderFrameHostImpl* pending_rfh = | 396 |
313 node->render_manager()->pending_frame_host(); | 397 // And commit provisional load. |
314 ASSERT_TRUE(pending_rfh); | 398 contents()->CommitPendingNavigation(); |
315 EXPECT_EQ(kUrl2_site, pending_rfh->GetSiteInstance()->GetSiteURL()); | 399 |
400 // Confirm that the commit corresponds to the new request. | |
401 ASSERT_TRUE(main_test_rfh()); | |
402 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); | |
403 | |
404 // Confirm that the committed RFH is the new speculative one. | |
405 EXPECT_EQ(site_instance_id_2, main_test_rfh()->GetSiteInstance()->GetId()); | |
316 } | 406 } |
317 | 407 |
318 // PlzNavigate: Test that a reload navigation is properly signaled to the | 408 // PlzNavigate: Test that a reload navigation is properly signaled to the |
319 // renderer when the navigation can commit. | 409 // renderer when the navigation can commit. Speculative renderers should not be |
410 // created at any step. | |
320 TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { | 411 TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { |
321 const GURL kUrl("http://www.google.com/"); | 412 const GURL kUrl("http://www.google.com/"); |
322 contents()->NavigateAndCommit(kUrl); | 413 contents()->NavigateAndCommit(kUrl); |
323 | 414 |
324 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | 415 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); |
325 SendRequestNavigationWithParameters( | 416 SendRequestNavigationWithParameters( |
326 node, kUrl, Referrer(), ui::PAGE_TRANSITION_LINK, | 417 node, kUrl, Referrer(), ui::PAGE_TRANSITION_LINK, |
327 NavigationController::RELOAD); | 418 NavigationController::RELOAD); |
328 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl); | 419 main_test_rfh()->SendBeginNavigationWithURL(kUrl); |
329 // A NavigationRequest should have been generated. | 420 // A NavigationRequest should have been generated. |
330 NavigationRequest* main_request = | 421 NavigationRequest* main_request = |
331 GetNavigationRequestForFrameTreeNode(node); | 422 GetNavigationRequestForFrameTreeNode(node); |
332 ASSERT_TRUE(main_request != NULL); | 423 ASSERT_TRUE(main_request != NULL); |
333 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD, | 424 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD, |
334 main_request->common_params().navigation_type); | 425 main_request->common_params().navigation_type); |
335 int page_id = contents()->GetMaxPageIDForSiteInstance( | 426 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); |
336 main_test_rfh()->GetSiteInstance()) + 1; | 427 |
337 main_test_rfh()->SendNavigate(page_id, kUrl); | 428 main_test_rfh()->SendNavigate(10, kUrl); |
clamy
2014/12/19 13:35:57
Why 10?
carlosk
2014/12/29 16:40:16
I was just setting a value high enough. I fixed th
| |
429 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
338 | 430 |
339 // Now do a shift+reload. | 431 // Now do a shift+reload. |
340 SendRequestNavigationWithParameters( | 432 SendRequestNavigationWithParameters( |
341 node, kUrl, Referrer(), ui::PAGE_TRANSITION_LINK, | 433 node, kUrl, Referrer(), ui::PAGE_TRANSITION_LINK, |
342 NavigationController::RELOAD_IGNORING_CACHE); | 434 NavigationController::RELOAD_IGNORING_CACHE); |
343 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl); | 435 main_test_rfh()->SendBeginNavigationWithURL(kUrl); |
344 // A NavigationRequest should have been generated. | 436 // A NavigationRequest should have been generated. |
345 main_request = GetNavigationRequestForFrameTreeNode(node); | 437 main_request = GetNavigationRequestForFrameTreeNode(node); |
346 ASSERT_TRUE(main_request != NULL); | 438 ASSERT_TRUE(main_request != NULL); |
347 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE, | 439 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE, |
348 main_request->common_params().navigation_type); | 440 main_request->common_params().navigation_type); |
441 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
442 } | |
443 | |
444 // PlzNavigate: Confirm that a speculative RenderFrameHost is used when | |
445 // navigating from one site to the another. | |
446 TEST_F(NavigatorTestWithBrowserSideNavigation, | |
447 SpeculativeRendererWorksBaseCase) { | |
448 // Navigate to an initial site. | |
449 const GURL kUrlInit("http://wikipedia.org/"); | |
450 contents()->NavigateAndCommit(kUrlInit); | |
451 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | |
452 | |
453 // Begin navigating to another site. | |
454 const GURL kUrl("http://google.com/"); | |
455 LoadURLAndBeginNavigationOnMainFrame(kUrl); | |
456 ASSERT_TRUE(contents()->GetSpeculativeMainFrame()); | |
457 EXPECT_NE(contents()->GetSpeculativeMainFrame(), main_test_rfh()); | |
458 EXPECT_EQ( | |
459 SiteInstanceImpl::GetSiteForURL(browser_context(), kUrl), | |
460 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetSiteURL()); | |
461 EXPECT_FALSE(contents()->GetPendingMainFrame()); | |
462 int32 site_instance_id = | |
463 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetId(); | |
464 | |
465 // Ask Navigator to commit the navigation by simulating a call to | |
466 // OnResponseStarted. | |
467 scoped_refptr<ResourceResponse> response(new ResourceResponse); | |
468 GetLoaderForNavigationRequest(GetNavigationRequestForFrameTreeNode(node)) | |
469 ->CallOnResponseStarted(response, MakeEmptyStream()); | |
470 ASSERT_TRUE(contents()->GetSpeculativeMainFrame()); | |
471 EXPECT_EQ(site_instance_id, | |
472 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetId()); | |
473 EXPECT_FALSE(contents()->GetPendingMainFrame()); | |
474 | |
475 // Invoke OnDidCommitProvisionalLoad. | |
476 contents()->CommitPendingNavigation(); | |
477 EXPECT_EQ(site_instance_id, main_test_rfh()->GetSiteInstance()->GetId()); | |
478 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
479 EXPECT_FALSE(contents()->GetPendingMainFrame()); | |
480 } | |
481 | |
482 // PlzNavigate: Confirm that a speculative RenderFrameHost is thrown away when | |
483 // the final URL's site differs from the initial one due to redirects. | |
484 TEST_F(NavigatorTestWithBrowserSideNavigation, | |
485 SpeculativeRendererDiscardedAfterRedirectToAnotherSite) { | |
486 // Navigate to an initial site. | |
487 const GURL kUrlInit("http://wikipedia.org/"); | |
488 contents()->NavigateAndCommit(kUrlInit); | |
489 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | |
490 int32 init_site_instance_id = main_test_rfh()->GetSiteInstance()->GetId(); | |
491 | |
492 // Begin navigating to another site. | |
493 const GURL kUrl("http://google.com/"); | |
494 LoadURLAndBeginNavigationOnMainFrame(kUrl); | |
495 int32 site_instance_id = | |
496 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetId(); | |
497 EXPECT_EQ(init_site_instance_id, main_test_rfh()->GetSiteInstance()->GetId()); | |
498 ASSERT_TRUE(contents()->GetSpeculativeMainFrame()); | |
499 EXPECT_NE(contents()->GetSpeculativeMainFrame(), main_test_rfh()); | |
500 EXPECT_EQ( | |
501 SiteInstanceImpl::GetSiteForURL(browser_context(), kUrl), | |
502 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetSiteURL()); | |
503 | |
504 // It then redirects to yet another site. | |
505 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); | |
506 ASSERT_TRUE(main_request); | |
507 const GURL kUrlRedirect("https://www.google.com/"); | |
508 net::RedirectInfo redirect_info; | |
509 redirect_info.status_code = 302; | |
510 redirect_info.new_method = "GET"; | |
511 redirect_info.new_url = kUrlRedirect; | |
512 redirect_info.new_first_party_for_cookies = kUrlRedirect; | |
513 scoped_refptr<ResourceResponse> response(new ResourceResponse); | |
514 GetLoaderForNavigationRequest(main_request) | |
515 ->CallOnRequestRedirected(redirect_info, response); | |
516 EXPECT_EQ(init_site_instance_id, main_test_rfh()->GetSiteInstance()->GetId()); | |
517 ASSERT_TRUE(contents()->GetSpeculativeMainFrame()); | |
518 | |
519 // TODO(carlosk): once the speculative RenderFrameHost updates with redirects | |
520 // this next check will be changed to verify that it actually happens. | |
521 EXPECT_EQ(site_instance_id, | |
522 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetId()); | |
523 | |
524 // Commit the navigation with Navigator by simulating the call to | |
525 // OnResponseStarted. | |
526 response = new ResourceResponse; | |
527 GetLoaderForNavigationRequest(main_request) | |
528 ->CallOnResponseStarted(response, MakeEmptyStream()); | |
529 EXPECT_EQ(init_site_instance_id, main_test_rfh()->GetSiteInstance()->GetId()); | |
530 | |
531 // Once commit happens the speculative RenderFrameHost is already updated to | |
532 // match the known final SiteInstance. | |
533 ASSERT_TRUE(contents()->GetSpeculativeMainFrame()); | |
534 EXPECT_EQ( | |
535 SiteInstanceImpl::GetSiteForURL(browser_context(), kUrlRedirect), | |
536 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetSiteURL()); | |
537 int32 redirect_site_instance_id = | |
538 contents()->GetSpeculativeMainFrame()->GetSiteInstance()->GetId(); | |
539 | |
540 // Invoke OnDidCommitProvisionalLoad. | |
541 contents()->CommitPendingNavigation(); | |
542 | |
543 // And finally on commit-provisional-load the already created RenderFrameHost | |
544 // is made active. | |
545 EXPECT_EQ(redirect_site_instance_id, | |
546 main_test_rfh()->GetSiteInstance()->GetId()); | |
547 EXPECT_FALSE(contents()->GetSpeculativeMainFrame()); | |
548 } | |
549 | |
550 // PlzNavigate: Verify that a previously swapped-out RenderFrameHost is | |
551 // correctly reused when spawning a speculative RenderFrameHost in a navigation | |
552 // using the same SiteInstance. | |
553 TEST_F(NavigatorTestWithBrowserSideNavigation, | |
554 SpeculativeRendererReuseSwappedOutRFH) { | |
555 // Navigate to an initial site. | |
556 const GURL kUrl1("http://wikipedia.org/"); | |
557 contents()->NavigateAndCommit(kUrl1); | |
558 RenderFrameHostImpl* rfh1 = main_test_rfh(); | |
559 FrameTreeNode* node = rfh1->frame_tree_node(); | |
560 RenderFrameHostManager* rfhm = node->render_manager(); | |
561 | |
562 // Increment active frame count to cause the RenderFrameHost to be swapped out | |
563 // (instead of immediately destroyed). | |
564 rfh1->GetSiteInstance()->increment_active_frame_count(); | |
565 | |
566 // Navigate to another site to swap-out the initial RenderFrameHost. | |
567 const GURL kUrl2("http://chromium.org/"); | |
568 contents()->NavigateAndCommit(kUrl2); | |
569 ASSERT_NE(rfh1, main_test_rfh()); | |
570 EXPECT_NE(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | |
571 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, main_test_rfh()->rfh_state()); | |
572 EXPECT_TRUE(rfhm->IsOnSwappedOutList(rfh1)); | |
573 | |
574 // Now go back to the initial site so the swapped-out RenderFrameHost should | |
575 // be reused. | |
576 LoadURLAndBeginNavigationOnMainFrame(kUrl1); | |
577 EXPECT_EQ(rfh1, contents()->GetSpeculativeMainFrame()); | |
578 EXPECT_NE(RenderFrameHostImpl::STATE_DEFAULT, | |
579 contents()->GetSpeculativeMainFrame()->rfh_state()); | |
580 | |
581 scoped_refptr<ResourceResponse> response(new ResourceResponse); | |
582 GetLoaderForNavigationRequest(GetNavigationRequestForFrameTreeNode(node)) | |
583 ->CallOnResponseStarted(response, MakeEmptyStream()); | |
584 EXPECT_EQ(rfh1, contents()->GetSpeculativeMainFrame()); | |
585 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, | |
586 contents()->GetSpeculativeMainFrame()->rfh_state()); | |
587 | |
588 contents()->CommitPendingNavigation(); | |
589 EXPECT_EQ(rfh1, main_test_rfh()); | |
590 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | |
591 EXPECT_FALSE(rfhm->IsOnSwappedOutList(rfh1)); | |
349 } | 592 } |
350 | 593 |
351 } // namespace content | 594 } // namespace content |
OLD | NEW |