| OLD | NEW |
| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 render_frame_host_->OnMessageReceived( | 347 render_frame_host_->OnMessageReceived( |
| 348 FrameHostMsg_DidFailProvisionalLoadWithError( | 348 FrameHostMsg_DidFailProvisionalLoadWithError( |
| 349 render_frame_host_->GetRoutingID(), error_params)); | 349 render_frame_host_->GetRoutingID(), error_params)); |
| 350 if (!should_result_in_error_page) { | 350 if (!should_result_in_error_page) { |
| 351 render_frame_host_->OnMessageReceived( | 351 render_frame_host_->OnMessageReceived( |
| 352 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); | 352 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 if (IsBrowserSideNavigationEnabled()) { | 356 if (IsBrowserSideNavigationEnabled()) { |
| 357 CHECK_EQ(1, num_ready_to_commit_called_); | |
| 358 if (should_result_in_error_page) { | 357 if (should_result_in_error_page) { |
| 358 CHECK_EQ(1, num_ready_to_commit_called_); |
| 359 // Update the RenderFrameHost now that we know which RenderFrameHost will | 359 // Update the RenderFrameHost now that we know which RenderFrameHost will |
| 360 // commit the error page. | 360 // commit the error page. |
| 361 render_frame_host_ = | 361 render_frame_host_ = |
| 362 static_cast<TestRenderFrameHost*>(handle_->GetRenderFrameHost()); | 362 static_cast<TestRenderFrameHost*>(handle_->GetRenderFrameHost()); |
| 363 } | 363 } |
| 364 } | 364 } |
| 365 | 365 |
| 366 if (should_result_in_error_page) | 366 if (should_result_in_error_page) |
| 367 CHECK_EQ(0, num_did_finish_navigation_called_); | 367 CHECK_EQ(0, num_did_finish_navigation_called_); |
| 368 else | 368 else |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 throttle_checks_wait_closure_.Run(); | 553 throttle_checks_wait_closure_.Run(); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void NavigationSimulator::PrepareCompleteCallbackOnHandle() { | 556 void NavigationSimulator::PrepareCompleteCallbackOnHandle() { |
| 557 last_throttle_check_result_.reset(); | 557 last_throttle_check_result_.reset(); |
| 558 handle_->set_complete_callback_for_testing( | 558 handle_->set_complete_callback_for_testing( |
| 559 base::Bind(&NavigationSimulator::OnThrottleChecksComplete, | 559 base::Bind(&NavigationSimulator::OnThrottleChecksComplete, |
| 560 weak_factory_.GetWeakPtr())); | 560 weak_factory_.GetWeakPtr())); |
| 561 } | 561 } |
| 562 | 562 |
| 563 RenderFrameHost* NavigationSimulator::GetFinalRenderFrameHost() { |
| 564 CHECK_EQ(state_, FINISHED); |
| 565 return render_frame_host_; |
| 566 } |
| 567 |
| 563 } // namespace content | 568 } // namespace content |
| OLD | NEW |