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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 CHECK_LE(state_, STARTED) << "The referrer cannot be set after the " | 476 CHECK_LE(state_, STARTED) << "The referrer cannot be set after the " |
477 "navigation has committed or has failed"; | 477 "navigation has committed or has failed"; |
478 referrer_ = referrer; | 478 referrer_ = referrer; |
479 } | 479 } |
480 | 480 |
481 NavigationThrottle::ThrottleCheckResult | 481 NavigationThrottle::ThrottleCheckResult |
482 NavigationSimulator::GetLastThrottleCheckResult() { | 482 NavigationSimulator::GetLastThrottleCheckResult() { |
483 return last_throttle_check_result_.value(); | 483 return last_throttle_check_result_.value(); |
484 } | 484 } |
485 | 485 |
486 NavigationHandle* NavigationSimulator::GetNavigationHandle() const { | |
487 CHECK_EQ(STARTED, state_); | |
488 return handle_; | |
489 } | |
490 | |
491 void NavigationSimulator::DidStartNavigation( | 486 void NavigationSimulator::DidStartNavigation( |
492 NavigationHandle* navigation_handle) { | 487 NavigationHandle* navigation_handle) { |
493 // Check if this navigation is the one we're simulating. | 488 // Check if this navigation is the one we're simulating. |
494 if (handle_) | 489 if (handle_) |
495 return; | 490 return; |
496 | 491 |
497 if (navigation_handle->GetURL() != navigation_url_) | 492 if (navigation_handle->GetURL() != navigation_url_) |
498 return; | 493 return; |
499 | 494 |
500 NavigationHandleImpl* handle = | 495 NavigationHandleImpl* handle = |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 if (!should_result_in_error_page) { | 616 if (!should_result_in_error_page) { |
622 render_frame_host_->OnMessageReceived( | 617 render_frame_host_->OnMessageReceived( |
623 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); | 618 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); |
624 CHECK_EQ(1, num_did_finish_navigation_called_); | 619 CHECK_EQ(1, num_did_finish_navigation_called_); |
625 } else { | 620 } else { |
626 CHECK_EQ(0, num_did_finish_navigation_called_); | 621 CHECK_EQ(0, num_did_finish_navigation_called_); |
627 } | 622 } |
628 } | 623 } |
629 | 624 |
630 } // namespace content | 625 } // namespace content |
OLD | NEW |