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

Side by Side Diff: content/test/test_render_frame_host.cc

Issue 872473003: PlzNavigate: Remove the RequestNavigation IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 "content/test/test_render_frame_host.h" 5 #include "content/test/test_render_frame_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/frame_host/navigation_request.h" 9 #include "content/browser/frame_host/navigation_request.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
11 #include "content/browser/frame_host/navigator_impl.h" 11 #include "content/browser/frame_host/navigator_impl.h"
12 #include "content/browser/frame_host/render_frame_host_delegate.h" 12 #include "content/browser/frame_host/render_frame_host_delegate.h"
13 #include "content/common/frame_messages.h"
13 #include "content/public/browser/stream_handle.h" 14 #include "content/public/browser/stream_handle.h"
14 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
15 #include "content/test/browser_side_navigation_test_utils.h" 16 #include "content/test/browser_side_navigation_test_utils.h"
16 #include "content/test/test_navigation_url_loader.h" 17 #include "content/test/test_navigation_url_loader.h"
17 #include "content/test/test_render_view_host.h" 18 #include "content/test/test_render_view_host.h"
18 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
19 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" 20 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
20 #include "ui/base/page_transition_types.h" 21 #include "ui/base/page_transition_types.h"
21 22
22 namespace content { 23 namespace content {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 url, 179 url,
179 false, 180 false,
180 file_path_for_history_item ? "data" : NULL, 181 file_path_for_history_item ? "data" : NULL,
181 file_path_for_history_item); 182 file_path_for_history_item);
182 183
183 FrameHostMsg_DidCommitProvisionalLoad msg(GetRoutingID(), params); 184 FrameHostMsg_DidCommitProvisionalLoad msg(GetRoutingID(), params);
184 OnDidCommitProvisionalLoad(msg); 185 OnDidCommitProvisionalLoad(msg);
185 } 186 }
186 187
187 void TestRenderFrameHost::SendBeginNavigationWithURL(const GURL& url) { 188 void TestRenderFrameHost::SendBeginNavigationWithURL(const GURL& url) {
188 FrameHostMsg_BeginNavigation_Params begin_params; 189 BeginNavigationParams begin_params;
189 CommonNavigationParams common_params; 190 CommonNavigationParams common_params;
190 begin_params.method = "GET"; 191 begin_params.method = "GET";
191 begin_params.load_flags = net::LOAD_NORMAL; 192 begin_params.load_flags = net::LOAD_NORMAL;
192 begin_params.has_user_gesture = false; 193 begin_params.has_user_gesture = false;
193 common_params.url = url; 194 common_params.url = url;
194 common_params.referrer = Referrer(GURL(), blink::WebReferrerPolicyDefault); 195 common_params.referrer = Referrer(GURL(), blink::WebReferrerPolicyDefault);
195 common_params.transition = ui::PAGE_TRANSITION_LINK; 196 common_params.transition = ui::PAGE_TRANSITION_LINK;
196 OnBeginNavigation(begin_params, common_params); 197 OnBeginNavigation(common_params, begin_params,
198 scoped_refptr<ResourceRequestBody>());
197 } 199 }
198 200
199 void TestRenderFrameHost::DidDisownOpener() { 201 void TestRenderFrameHost::DidDisownOpener() {
200 OnDidDisownOpener(); 202 OnDidDisownOpener();
201 } 203 }
202 204
203 void TestRenderFrameHost::PrepareForCommit(const GURL& url) { 205 void TestRenderFrameHost::PrepareForCommit(const GURL& url) {
204 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 206 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
205 switches::kEnableBrowserSideNavigation)) { 207 switches::kEnableBrowserSideNavigation)) {
206 SendBeforeUnloadACK(true); 208 SendBeforeUnloadACK(true);
(...skipping 10 matching lines...) Expand all
217 if (!request) { 219 if (!request) {
218 SendBeginNavigationWithURL(url); 220 SendBeginNavigationWithURL(url);
219 request = static_cast<NavigatorImpl*>(frame_tree_node_->navigator()) 221 request = static_cast<NavigatorImpl*>(frame_tree_node_->navigator())
220 ->GetNavigationRequestForNodeForTesting(frame_tree_node_); 222 ->GetNavigationRequestForNodeForTesting(frame_tree_node_);
221 } 223 }
222 ASSERT_TRUE(request); 224 ASSERT_TRUE(request);
223 225
224 // We may not have simulated the renderer response to the navigation request. 226 // We may not have simulated the renderer response to the navigation request.
225 // Do that now. 227 // Do that now.
226 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) 228 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE)
227 SendBeginNavigationWithURL(url); 229 SendBeforeUnloadACK(true);
228 230
229 // We have already simulated the IO thread commit. Only the 231 // We have already simulated the IO thread commit. Only the
230 // DidCommitProvisionalLoad from the renderer is missing. 232 // DidCommitProvisionalLoad from the renderer is missing.
231 if (request->state() == NavigationRequest::RESPONSE_STARTED) 233 if (request->state() == NavigationRequest::RESPONSE_STARTED)
232 return; 234 return;
233 235
234 ASSERT_TRUE(request->state() == NavigationRequest::STARTED); 236 ASSERT_TRUE(request->state() == NavigationRequest::STARTED);
235 TestNavigationURLLoader* url_loader = 237 TestNavigationURLLoader* url_loader =
236 static_cast<TestNavigationURLLoader*>(request->loader_for_testing()); 238 static_cast<TestNavigationURLLoader*>(request->loader_for_testing());
237 ASSERT_TRUE(url_loader); 239 ASSERT_TRUE(url_loader);
238 scoped_refptr<ResourceResponse> response(new ResourceResponse); 240 scoped_refptr<ResourceResponse> response(new ResourceResponse);
239 url_loader->CallOnResponseStarted(response, MakeEmptyStream()); 241 url_loader->CallOnResponseStarted(response, MakeEmptyStream());
240 } 242 }
241 243
242 } // namespace content 244 } // namespace content
OLDNEW
« content/common/navigation_params.h ('K') | « content/test/test_navigation_url_loader_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698