| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 redirect_info.new_referrer = referrer_.url.spec(); | 200 redirect_info.new_referrer = referrer_.url.spec(); |
| 201 redirect_info.new_referrer_policy = | 201 redirect_info.new_referrer_policy = |
| 202 Referrer::ReferrerPolicyForUrlRequest(referrer_); | 202 Referrer::ReferrerPolicyForUrlRequest(referrer_); |
| 203 | 203 |
| 204 url_loader->CallOnRequestRedirected( | 204 url_loader->CallOnRequestRedirected( |
| 205 redirect_info, scoped_refptr<ResourceResponse>(new ResourceResponse)); | 205 redirect_info, scoped_refptr<ResourceResponse>(new ResourceResponse)); |
| 206 } else { | 206 } else { |
| 207 handle_->WillRedirectRequest( | 207 handle_->WillRedirectRequest( |
| 208 new_url, "GET", referrer_.url, false /* is_external_protocol */, | 208 new_url, "GET", referrer_.url, false /* is_external_protocol */, |
| 209 scoped_refptr<net::HttpResponseHeaders>(), | 209 scoped_refptr<net::HttpResponseHeaders>(), |
| 210 net::HttpResponseInfo::ConnectionInfo(), | 210 net::HttpResponseInfo::ConnectionInfo(), nullptr, |
| 211 base::Callback<void(NavigationThrottle::ThrottleCheckResult)>()); | 211 base::Callback<void(NavigationThrottle::ThrottleCheckResult)>()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 WaitForThrottleChecksComplete(); | 214 WaitForThrottleChecksComplete(); |
| 215 | 215 |
| 216 if (GetLastThrottleCheckResult() == NavigationThrottle::PROCEED) { | 216 if (GetLastThrottleCheckResult() == NavigationThrottle::PROCEED) { |
| 217 CHECK_EQ(previous_num_will_redirect_request_called + 1, | 217 CHECK_EQ(previous_num_will_redirect_request_called + 1, |
| 218 num_will_redirect_request_called_); | 218 num_will_redirect_request_called_); |
| 219 CHECK_EQ(previous_did_redirect_navigation_called + 1, | 219 CHECK_EQ(previous_did_redirect_navigation_called + 1, |
| 220 num_did_redirect_navigation_called_); | 220 num_did_redirect_navigation_called_); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 if (!should_result_in_error_page) { | 627 if (!should_result_in_error_page) { |
| 628 render_frame_host_->OnMessageReceived( | 628 render_frame_host_->OnMessageReceived( |
| 629 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); | 629 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); |
| 630 CHECK_EQ(1, num_did_finish_navigation_called_); | 630 CHECK_EQ(1, num_did_finish_navigation_called_); |
| 631 } else { | 631 } else { |
| 632 CHECK_EQ(0, num_did_finish_navigation_called_); | 632 CHECK_EQ(0, num_did_finish_navigation_called_); |
| 633 } | 633 } |
| 634 } | 634 } |
| 635 | 635 |
| 636 } // namespace content | 636 } // namespace content |
| OLD | NEW |