| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 render_frame_host_->OnMessageReceived( | 345 render_frame_host_->OnMessageReceived( |
| 346 FrameHostMsg_DidFailProvisionalLoadWithError( | 346 FrameHostMsg_DidFailProvisionalLoadWithError( |
| 347 render_frame_host_->GetRoutingID(), error_params)); | 347 render_frame_host_->GetRoutingID(), error_params)); |
| 348 if (!should_result_in_error_page) { | 348 if (!should_result_in_error_page) { |
| 349 render_frame_host_->OnMessageReceived( | 349 render_frame_host_->OnMessageReceived( |
| 350 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); | 350 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (IsBrowserSideNavigationEnabled()) { | 354 if (IsBrowserSideNavigationEnabled()) { |
| 355 CHECK_EQ(1, num_ready_to_commit_called_); | |
| 356 if (should_result_in_error_page) { | 355 if (should_result_in_error_page) { |
| 356 CHECK_EQ(1, num_ready_to_commit_called_); |
| 357 // Update the RenderFrameHost now that we know which RenderFrameHost will | 357 // Update the RenderFrameHost now that we know which RenderFrameHost will |
| 358 // commit the error page. | 358 // commit the error page. |
| 359 render_frame_host_ = | 359 render_frame_host_ = |
| 360 static_cast<TestRenderFrameHost*>(handle_->GetRenderFrameHost()); | 360 static_cast<TestRenderFrameHost*>(handle_->GetRenderFrameHost()); |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| 364 if (should_result_in_error_page) | 364 if (should_result_in_error_page) |
| 365 CHECK_EQ(0, num_did_finish_navigation_called_); | 365 CHECK_EQ(0, num_did_finish_navigation_called_); |
| 366 else | 366 else |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 throttle_checks_wait_closure_.Run(); | 551 throttle_checks_wait_closure_.Run(); |
| 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 RenderFrameHost* NavigationSimulator::GetFinalRenderFrameHost() { |
| 562 CHECK_EQ(state_, FINISHED); |
| 563 return render_frame_host_; |
| 564 } |
| 565 |
| 561 } // namespace content | 566 } // namespace content |
| OLD | NEW |