| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 redirect_info.new_referrer = referrer_.url.spec(); | 199 redirect_info.new_referrer = referrer_.url.spec(); |
| 200 redirect_info.new_referrer_policy = | 200 redirect_info.new_referrer_policy = |
| 201 Referrer::ReferrerPolicyForUrlRequest(referrer_); | 201 Referrer::ReferrerPolicyForUrlRequest(referrer_); |
| 202 | 202 |
| 203 url_loader->CallOnRequestRedirected( | 203 url_loader->CallOnRequestRedirected( |
| 204 redirect_info, scoped_refptr<ResourceResponse>(new ResourceResponse)); | 204 redirect_info, scoped_refptr<ResourceResponse>(new ResourceResponse)); |
| 205 } else { | 205 } else { |
| 206 handle_->WillRedirectRequest( | 206 handle_->WillRedirectRequest( |
| 207 new_url, "GET", referrer_.url, false /* is_external_protocol */, | 207 new_url, "GET", referrer_.url, false /* is_external_protocol */, |
| 208 scoped_refptr<net::HttpResponseHeaders>(), | 208 scoped_refptr<net::HttpResponseHeaders>(), |
| 209 net::HttpResponseInfo::ConnectionInfo(), | 209 net::HttpResponseInfo::ConnectionInfo(), nullptr, |
| 210 base::Callback<void(NavigationThrottle::ThrottleCheckResult)>()); | 210 base::Callback<void(NavigationThrottle::ThrottleCheckResult)>()); |
| 211 } | 211 } |
| 212 | 212 |
| 213 WaitForThrottleChecksComplete(); | 213 WaitForThrottleChecksComplete(); |
| 214 | 214 |
| 215 if (GetLastThrottleCheckResult() == NavigationThrottle::PROCEED) { | 215 if (GetLastThrottleCheckResult() == NavigationThrottle::PROCEED) { |
| 216 CHECK_EQ(previous_num_will_redirect_request_called + 1, | 216 CHECK_EQ(previous_num_will_redirect_request_called + 1, |
| 217 num_will_redirect_request_called_); | 217 num_will_redirect_request_called_); |
| 218 CHECK_EQ(previous_did_redirect_navigation_called + 1, | 218 CHECK_EQ(previous_did_redirect_navigation_called + 1, |
| 219 num_did_redirect_navigation_called_); | 219 num_did_redirect_navigation_called_); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (!should_result_in_error_page) { | 639 if (!should_result_in_error_page) { |
| 640 render_frame_host_->OnMessageReceived( | 640 render_frame_host_->OnMessageReceived( |
| 641 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); | 641 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); |
| 642 CHECK_EQ(1, num_did_finish_navigation_called_); | 642 CHECK_EQ(1, num_did_finish_navigation_called_); |
| 643 } else { | 643 } else { |
| 644 CHECK_EQ(0, num_did_finish_navigation_called_); | 644 CHECK_EQ(0, num_did_finish_navigation_called_); |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 | 647 |
| 648 } // namespace content | 648 } // namespace content |
| OLD | NEW |