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

Side by Side Diff: content/public/test/navigation_simulator.cc

Issue 2741313002: Renamed WasWithinSamePage to WasWithinSameDocument. (Closed)
Patch Set: Addressed review comments Created 3 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
« no previous file with comments | « content/public/test/navigation_simulator.h ('k') | content/renderer/navigation_state_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/public/test/navigation_simulator.h" 5 #include "content/public/test/navigation_simulator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/frame_host/navigation_handle_impl.h" 10 #include "content/browser/frame_host/navigation_handle_impl.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 !render_frame_host_->GetParent() || 292 !render_frame_host_->GetParent() ||
293 render_frame_host_->frame_tree_node()->has_committed_real_load(); 293 render_frame_host_->frame_tree_node()->has_committed_real_load();
294 params.gesture = NavigationGestureUser; 294 params.gesture = NavigationGestureUser;
295 params.contents_mime_type = "text/html"; 295 params.contents_mime_type = "text/html";
296 params.method = "GET"; 296 params.method = "GET";
297 params.http_status_code = 200; 297 params.http_status_code = 200;
298 params.socket_address.set_host("2001:db8::1"); 298 params.socket_address.set_host("2001:db8::1");
299 params.socket_address.set_port(80); 299 params.socket_address.set_port(80);
300 params.history_list_was_cleared = false; 300 params.history_list_was_cleared = false;
301 params.original_request_url = navigation_url_; 301 params.original_request_url = navigation_url_;
302 params.was_within_same_page = false; 302 params.was_within_same_document = false;
303 params.page_state = 303 params.page_state =
304 PageState::CreateForTesting(navigation_url_, false, nullptr, nullptr); 304 PageState::CreateForTesting(navigation_url_, false, nullptr, nullptr);
305 305
306 render_frame_host_->SendNavigateWithParams(&params); 306 render_frame_host_->SendNavigateWithParams(&params);
307 307
308 // Simulate the UnloadACK in the old RenderFrameHost if it was swapped out at 308 // Simulate the UnloadACK in the old RenderFrameHost if it was swapped out at
309 // commit time. 309 // commit time.
310 if (previous_rfh != render_frame_host_) { 310 if (previous_rfh != render_frame_host_) {
311 previous_rfh->OnMessageReceived( 311 previous_rfh->OnMessageReceived(
312 FrameHostMsg_SwapOut_ACK(previous_rfh->GetRoutingID())); 312 FrameHostMsg_SwapOut_ACK(previous_rfh->GetRoutingID()));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 383
384 GURL error_url = GURL(kUnreachableWebDataURL); 384 GURL error_url = GURL(kUnreachableWebDataURL);
385 render_frame_host_->OnMessageReceived(FrameHostMsg_DidStartProvisionalLoad( 385 render_frame_host_->OnMessageReceived(FrameHostMsg_DidStartProvisionalLoad(
386 render_frame_host_->GetRoutingID(), error_url, std::vector<GURL>(), 386 render_frame_host_->GetRoutingID(), error_url, std::vector<GURL>(),
387 base::TimeTicks::Now())); 387 base::TimeTicks::Now()));
388 FrameHostMsg_DidCommitProvisionalLoad_Params params; 388 FrameHostMsg_DidCommitProvisionalLoad_Params params;
389 params.nav_entry_id = 0; 389 params.nav_entry_id = 0;
390 params.did_create_new_entry = true; 390 params.did_create_new_entry = true;
391 params.url = navigation_url_; 391 params.url = navigation_url_;
392 params.transition = transition_; 392 params.transition = transition_;
393 params.was_within_same_page = false; 393 params.was_within_same_document = false;
394 params.url_is_unreachable = true; 394 params.url_is_unreachable = true;
395 params.page_state = 395 params.page_state =
396 PageState::CreateForTesting(navigation_url_, false, nullptr, nullptr); 396 PageState::CreateForTesting(navigation_url_, false, nullptr, nullptr);
397 render_frame_host_->SendNavigateWithParams(&params); 397 render_frame_host_->SendNavigateWithParams(&params);
398 398
399 // Simulate the UnloadACK in the old RenderFrameHost if it was swapped out at 399 // Simulate the UnloadACK in the old RenderFrameHost if it was swapped out at
400 // commit time. 400 // commit time.
401 if (previous_rfh != render_frame_host_) { 401 if (previous_rfh != render_frame_host_) {
402 previous_rfh->OnMessageReceived( 402 previous_rfh->OnMessageReceived(
403 FrameHostMsg_SwapOut_ACK(previous_rfh->GetRoutingID())); 403 FrameHostMsg_SwapOut_ACK(previous_rfh->GetRoutingID()));
404 } 404 }
405 405
406 state_ = FINISHED; 406 state_ = FINISHED;
407 407
408 CHECK_EQ(1, num_did_finish_navigation_called_); 408 CHECK_EQ(1, num_did_finish_navigation_called_);
409 } 409 }
410 410
411 void NavigationSimulator::CommitSamePage() { 411 void NavigationSimulator::CommitSameDocument() {
412 CHECK_EQ(INITIALIZATION, state_) 412 CHECK_EQ(INITIALIZATION, state_)
413 << "NavigationSimulator::CommitErrorPage should be the only " 413 << "NavigationSimulator::CommitErrorPage should be the only "
414 "navigation event function called on the NavigationSimulator"; 414 "navigation event function called on the NavigationSimulator";
415 415
416 render_frame_host_->OnMessageReceived( 416 render_frame_host_->OnMessageReceived(
417 FrameHostMsg_DidStartLoading(render_frame_host_->GetRoutingID(), false)); 417 FrameHostMsg_DidStartLoading(render_frame_host_->GetRoutingID(), false));
418 418
419 FrameHostMsg_DidCommitProvisionalLoad_Params params; 419 FrameHostMsg_DidCommitProvisionalLoad_Params params;
420 params.nav_entry_id = 0; 420 params.nav_entry_id = 0;
421 params.url = navigation_url_; 421 params.url = navigation_url_;
422 params.origin = url::Origin(navigation_url_); 422 params.origin = url::Origin(navigation_url_);
423 params.transition = transition_; 423 params.transition = transition_;
424 params.should_update_history = true; 424 params.should_update_history = true;
425 params.did_create_new_entry = false; 425 params.did_create_new_entry = false;
426 params.gesture = NavigationGestureUser; 426 params.gesture = NavigationGestureUser;
427 params.contents_mime_type = "text/html"; 427 params.contents_mime_type = "text/html";
428 params.method = "GET"; 428 params.method = "GET";
429 params.http_status_code = 200; 429 params.http_status_code = 200;
430 params.socket_address.set_host("2001:db8::1"); 430 params.socket_address.set_host("2001:db8::1");
431 params.socket_address.set_port(80); 431 params.socket_address.set_port(80);
432 params.history_list_was_cleared = false; 432 params.history_list_was_cleared = false;
433 params.original_request_url = navigation_url_; 433 params.original_request_url = navigation_url_;
434 params.was_within_same_page = true; 434 params.was_within_same_document = true;
435 params.page_state = 435 params.page_state =
436 PageState::CreateForTesting(navigation_url_, false, nullptr, nullptr); 436 PageState::CreateForTesting(navigation_url_, false, nullptr, nullptr);
437 437
438 render_frame_host_->SendNavigateWithParams(&params); 438 render_frame_host_->SendNavigateWithParams(&params);
439 439
440 render_frame_host_->OnMessageReceived( 440 render_frame_host_->OnMessageReceived(
441 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); 441 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID()));
442 442
443 state_ = FINISHED; 443 state_ = FINISHED;
444 444
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 552 }
553 553
554 void NavigationSimulator::PrepareCompleteCallbackOnHandle() { 554 void NavigationSimulator::PrepareCompleteCallbackOnHandle() {
555 last_throttle_check_result_.reset(); 555 last_throttle_check_result_.reset();
556 handle_->set_complete_callback_for_testing( 556 handle_->set_complete_callback_for_testing(
557 base::Bind(&NavigationSimulator::OnThrottleChecksComplete, 557 base::Bind(&NavigationSimulator::OnThrottleChecksComplete,
558 weak_factory_.GetWeakPtr())); 558 weak_factory_.GetWeakPtr()));
559 } 559 }
560 560
561 } // namespace content 561 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/navigation_simulator.h ('k') | content/renderer/navigation_state_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698