OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/test/test_navigation_url_loader.h" | 5 #include "content/test/test_navigation_url_loader.h" |
6 | 6 |
7 #include "content/browser/loader/navigation_url_loader_delegate.h" | 7 #include "content/browser/loader/navigation_url_loader_delegate.h" |
8 #include "content/public/browser/stream_handle.h" | 8 #include "content/public/browser/stream_handle.h" |
9 #include "content/public/common/resource_response.h" | 9 #include "content/public/common/resource_response.h" |
10 #include "net/url_request/redirect_info.h" | 10 #include "net/url_request/redirect_info.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 TestNavigationURLLoader::TestNavigationURLLoader( | 14 TestNavigationURLLoader::TestNavigationURLLoader( |
15 scoped_ptr<NavigationRequestInfo> request_info, | 15 scoped_ptr<NavigationRequestInfo> request_info, |
16 NavigationURLLoaderDelegate* delegate) | 16 NavigationURLLoaderDelegate* delegate) |
17 : request_info_(request_info.Pass()), | 17 : request_info_(request_info.Pass()), |
18 delegate_(delegate), | 18 delegate_(delegate), |
19 redirect_count_(0) { | 19 redirect_count_(0) { |
20 } | 20 } |
21 | 21 |
22 void TestNavigationURLLoader::FollowRedirect() { | 22 void TestNavigationURLLoader::FollowRedirect( |
| 23 const std::vector<std::pair<std::string, std::string>>& extra_headers) { |
23 redirect_count_++; | 24 redirect_count_++; |
24 } | 25 } |
25 | 26 |
26 void TestNavigationURLLoader::SimulateServerRedirect(const GURL& redirect_url) { | 27 void TestNavigationURLLoader::SimulateServerRedirect(const GURL& redirect_url) { |
27 net::RedirectInfo redirect_info; | 28 net::RedirectInfo redirect_info; |
28 redirect_info.status_code = 302; | 29 redirect_info.status_code = 302; |
29 redirect_info.new_method = "GET"; | 30 redirect_info.new_method = "GET"; |
30 redirect_info.new_url = redirect_url; | 31 redirect_info.new_url = redirect_url; |
31 redirect_info.new_first_party_for_cookies = redirect_url; | 32 redirect_info.new_first_party_for_cookies = redirect_url; |
32 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 33 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
(...skipping 12 matching lines...) Expand all Loading... |
45 | 46 |
46 void TestNavigationURLLoader::CallOnResponseStarted( | 47 void TestNavigationURLLoader::CallOnResponseStarted( |
47 const scoped_refptr<ResourceResponse>& response, | 48 const scoped_refptr<ResourceResponse>& response, |
48 scoped_ptr<StreamHandle> body) { | 49 scoped_ptr<StreamHandle> body) { |
49 delegate_->OnResponseStarted(response, body.Pass()); | 50 delegate_->OnResponseStarted(response, body.Pass()); |
50 } | 51 } |
51 | 52 |
52 TestNavigationURLLoader::~TestNavigationURLLoader() {} | 53 TestNavigationURLLoader::~TestNavigationURLLoader() {} |
53 | 54 |
54 } // namespace content | 55 } // namespace content |
OLD | NEW |