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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 116 blink::WebMixedContentContextType::Blockable, |
117 false, // is_form_submission | 117 false, /* is_form_submission */ |
118 url::Origin()); | 118 url::Origin(), 0 /* renderer_navigation_id */); |
119 CommonNavigationParams common_params; | 119 CommonNavigationParams common_params; |
120 common_params.url = navigation_url_; | 120 common_params.url = navigation_url_; |
121 common_params.referrer = referrer_; | 121 common_params.referrer = referrer_; |
122 common_params.transition = transition_; | 122 common_params.transition = transition_; |
123 common_params.navigation_type = | 123 common_params.navigation_type = |
124 PageTransitionCoreTypeIs(transition_, ui::PAGE_TRANSITION_RELOAD) | 124 PageTransitionCoreTypeIs(transition_, ui::PAGE_TRANSITION_RELOAD) |
125 ? FrameMsg_Navigate_Type::RELOAD | 125 ? FrameMsg_Navigate_Type::RELOAD |
126 : FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; | 126 : FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; |
127 render_frame_host_->OnMessageReceived(FrameHostMsg_BeginNavigation( | 127 render_frame_host_->OnMessageReceived(FrameHostMsg_BeginNavigation( |
128 render_frame_host_->GetRoutingID(), common_params, begin_params)); | 128 render_frame_host_->GetRoutingID(), common_params, begin_params)); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() { | 563 RenderFrameHost* NavigationSimulator::GetFinalRenderFrameHost() { |
564 CHECK_EQ(state_, FINISHED); | 564 CHECK_EQ(state_, FINISHED); |
565 return render_frame_host_; | 565 return render_frame_host_; |
566 } | 566 } |
567 | 567 |
568 } // namespace content | 568 } // namespace content |
OLD | NEW |