| 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 |
| 486 void NavigationSimulator::DidStartNavigation( | 491 void NavigationSimulator::DidStartNavigation( |
| 487 NavigationHandle* navigation_handle) { | 492 NavigationHandle* navigation_handle) { |
| 488 // Check if this navigation is the one we're simulating. | 493 // Check if this navigation is the one we're simulating. |
| 489 if (handle_) | 494 if (handle_) |
| 490 return; | 495 return; |
| 491 | 496 |
| 492 if (navigation_handle->GetURL() != navigation_url_) | 497 if (navigation_handle->GetURL() != navigation_url_) |
| 493 return; | 498 return; |
| 494 | 499 |
| 495 NavigationHandleImpl* handle = | 500 NavigationHandleImpl* handle = |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 if (!should_result_in_error_page) { | 621 if (!should_result_in_error_page) { |
| 617 render_frame_host_->OnMessageReceived( | 622 render_frame_host_->OnMessageReceived( |
| 618 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); | 623 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); |
| 619 CHECK_EQ(1, num_did_finish_navigation_called_); | 624 CHECK_EQ(1, num_did_finish_navigation_called_); |
| 620 } else { | 625 } else { |
| 621 CHECK_EQ(0, num_did_finish_navigation_called_); | 626 CHECK_EQ(0, num_did_finish_navigation_called_); |
| 622 } | 627 } |
| 623 } | 628 } |
| 624 | 629 |
| 625 } // namespace content | 630 } // namespace content |
| OLD | NEW |