| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 void NavigationSimulator::Start() { | 107 void NavigationSimulator::Start() { |
| 108 CHECK(state_ == INITIALIZATION) | 108 CHECK(state_ == INITIALIZATION) |
| 109 << "NavigationSimulator::Start should only be called once."; | 109 << "NavigationSimulator::Start should only be called once."; |
| 110 state_ = STARTED; | 110 state_ = STARTED; |
| 111 | 111 |
| 112 if (IsBrowserSideNavigationEnabled()) { | 112 if (IsBrowserSideNavigationEnabled()) { |
| 113 BeginNavigationParams begin_params( | 113 BeginNavigationParams begin_params( |
| 114 std::string(), net::LOAD_NORMAL, true /* has_user_gesture */, | 114 std::string(), net::LOAD_NORMAL, true /* has_user_gesture */, |
| 115 false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_HYPERLINK, | 115 false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_HYPERLINK, |
| 116 blink::WebMixedContentContextType::Blockable, url::Origin()); | 116 blink::WebMixedContentContextType::Blockable, |
| 117 false, // is_form_submission |
| 118 url::Origin()); |
| 117 CommonNavigationParams common_params; | 119 CommonNavigationParams common_params; |
| 118 common_params.url = navigation_url_; | 120 common_params.url = navigation_url_; |
| 119 common_params.referrer = referrer_; | 121 common_params.referrer = referrer_; |
| 120 common_params.transition = transition_; | 122 common_params.transition = transition_; |
| 121 common_params.navigation_type = | 123 common_params.navigation_type = |
| 122 PageTransitionCoreTypeIs(transition_, ui::PAGE_TRANSITION_RELOAD) | 124 PageTransitionCoreTypeIs(transition_, ui::PAGE_TRANSITION_RELOAD) |
| 123 ? FrameMsg_Navigate_Type::RELOAD | 125 ? FrameMsg_Navigate_Type::RELOAD |
| 124 : FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; | 126 : FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; |
| 125 render_frame_host_->OnMessageReceived(FrameHostMsg_BeginNavigation( | 127 render_frame_host_->OnMessageReceived(FrameHostMsg_BeginNavigation( |
| 126 render_frame_host_->GetRoutingID(), common_params, begin_params)); | 128 render_frame_host_->GetRoutingID(), common_params, begin_params)); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } | 554 } |
| 553 | 555 |
| 554 void NavigationSimulator::PrepareCompleteCallbackOnHandle() { | 556 void NavigationSimulator::PrepareCompleteCallbackOnHandle() { |
| 555 last_throttle_check_result_.reset(); | 557 last_throttle_check_result_.reset(); |
| 556 handle_->set_complete_callback_for_testing( | 558 handle_->set_complete_callback_for_testing( |
| 557 base::Bind(&NavigationSimulator::OnThrottleChecksComplete, | 559 base::Bind(&NavigationSimulator::OnThrottleChecksComplete, |
| 558 weak_factory_.GetWeakPtr())); | 560 weak_factory_.GetWeakPtr())); |
| 559 } | 561 } |
| 560 | 562 |
| 561 } // namespace content | 563 } // namespace content |
| OLD | NEW |