Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: net/http/http_stream_factory_test_util.cc

Issue 2771263002: Retry upon 421 status code without IP pooling. (Closed)
Patch Set: Rebase. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "net/http/http_stream_factory_test_util.h" 5 #include "net/http/http_stream_factory_test_util.h"
6 6
7 #include "net/proxy/proxy_info.h" 7 #include "net/proxy/proxy_info.h"
8 8
9 using ::testing::_; 9 using ::testing::_;
10 10
11 namespace net { 11 namespace net {
12 MockHttpStreamRequestDelegate::MockHttpStreamRequestDelegate() {} 12 MockHttpStreamRequestDelegate::MockHttpStreamRequestDelegate() {}
13 13
14 MockHttpStreamRequestDelegate::~MockHttpStreamRequestDelegate() {} 14 MockHttpStreamRequestDelegate::~MockHttpStreamRequestDelegate() {}
15 15
16 MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob( 16 MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
17 HttpStreamFactoryImpl::Job::Delegate* delegate, 17 HttpStreamFactoryImpl::Job::Delegate* delegate,
18 HttpStreamFactoryImpl::JobType job_type, 18 HttpStreamFactoryImpl::JobType job_type,
19 HttpNetworkSession* session, 19 HttpNetworkSession* session,
20 const HttpRequestInfo& request_info, 20 const HttpRequestInfo& request_info,
21 RequestPriority priority, 21 RequestPriority priority,
22 const SSLConfig& server_ssl_config, 22 const SSLConfig& server_ssl_config,
23 const SSLConfig& proxy_ssl_config, 23 const SSLConfig& proxy_ssl_config,
24 HostPortPair destination, 24 HostPortPair destination,
25 GURL origin_url, 25 GURL origin_url,
26 bool enable_ip_based_pooling,
26 NetLog* net_log) 27 NetLog* net_log)
27 : HttpStreamFactoryImpl::Job(delegate, 28 : HttpStreamFactoryImpl::Job(delegate,
28 job_type, 29 job_type,
29 session, 30 session,
30 request_info, 31 request_info,
31 priority, 32 priority,
32 server_ssl_config, 33 server_ssl_config,
33 proxy_ssl_config, 34 proxy_ssl_config,
34 destination, 35 destination,
35 origin_url, 36 origin_url,
37 enable_ip_based_pooling,
36 net_log) { 38 net_log) {
37 DCHECK(!is_waiting()); 39 DCHECK(!is_waiting());
38 } 40 }
39 41
40 MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob( 42 MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
41 HttpStreamFactoryImpl::Job::Delegate* delegate, 43 HttpStreamFactoryImpl::Job::Delegate* delegate,
42 HttpStreamFactoryImpl::JobType job_type, 44 HttpStreamFactoryImpl::JobType job_type,
43 HttpNetworkSession* session, 45 HttpNetworkSession* session,
44 const HttpRequestInfo& request_info, 46 const HttpRequestInfo& request_info,
45 RequestPriority priority, 47 RequestPriority priority,
46 const SSLConfig& server_ssl_config, 48 const SSLConfig& server_ssl_config,
47 const SSLConfig& proxy_ssl_config, 49 const SSLConfig& proxy_ssl_config,
48 HostPortPair destination, 50 HostPortPair destination,
49 GURL origin_url, 51 GURL origin_url,
50 AlternativeService alternative_service, 52 AlternativeService alternative_service,
51 const ProxyServer& alternative_proxy_server, 53 const ProxyServer& alternative_proxy_server,
54 bool enable_ip_based_pooling,
52 NetLog* net_log) 55 NetLog* net_log)
53 : HttpStreamFactoryImpl::Job(delegate, 56 : HttpStreamFactoryImpl::Job(delegate,
54 job_type, 57 job_type,
55 session, 58 session,
56 request_info, 59 request_info,
57 priority, 60 priority,
58 server_ssl_config, 61 server_ssl_config,
59 proxy_ssl_config, 62 proxy_ssl_config,
60 destination, 63 destination,
61 origin_url, 64 origin_url,
62 alternative_service, 65 alternative_service,
63 alternative_proxy_server, 66 alternative_proxy_server,
67 enable_ip_based_pooling,
64 net_log) {} 68 net_log) {}
65 69
66 MockHttpStreamFactoryImplJob::~MockHttpStreamFactoryImplJob() {} 70 MockHttpStreamFactoryImplJob::~MockHttpStreamFactoryImplJob() {}
67 71
68 TestJobFactory::TestJobFactory() 72 TestJobFactory::TestJobFactory()
69 : main_job_(nullptr), 73 : main_job_(nullptr),
70 alternative_job_(nullptr), 74 alternative_job_(nullptr),
71 override_main_job_url_(false) {} 75 override_main_job_url_(false) {}
72 76
73 TestJobFactory::~TestJobFactory() {} 77 TestJobFactory::~TestJobFactory() {}
74 78
75 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( 79 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
76 HttpStreamFactoryImpl::Job::Delegate* delegate, 80 HttpStreamFactoryImpl::Job::Delegate* delegate,
77 HttpStreamFactoryImpl::JobType job_type, 81 HttpStreamFactoryImpl::JobType job_type,
78 HttpNetworkSession* session, 82 HttpNetworkSession* session,
79 const HttpRequestInfo& request_info, 83 const HttpRequestInfo& request_info,
80 RequestPriority priority, 84 RequestPriority priority,
81 const SSLConfig& server_ssl_config, 85 const SSLConfig& server_ssl_config,
82 const SSLConfig& proxy_ssl_config, 86 const SSLConfig& proxy_ssl_config,
83 HostPortPair destination, 87 HostPortPair destination,
84 GURL origin_url, 88 GURL origin_url,
89 bool enable_ip_based_pooling,
85 NetLog* net_log) { 90 NetLog* net_log) {
86 DCHECK(!main_job_); 91 DCHECK(!main_job_);
87 92
88 if (override_main_job_url_) 93 if (override_main_job_url_)
89 origin_url = main_job_alternative_url_; 94 origin_url = main_job_alternative_url_;
90 95
91 main_job_ = new MockHttpStreamFactoryImplJob( 96 main_job_ = new MockHttpStreamFactoryImplJob(
92 delegate, job_type, session, request_info, priority, SSLConfig(), 97 delegate, job_type, session, request_info, priority, SSLConfig(),
93 SSLConfig(), destination, origin_url, nullptr); 98 SSLConfig(), destination, origin_url, enable_ip_based_pooling, nullptr);
94 99
95 return main_job_; 100 return main_job_;
96 } 101 }
97 102
98 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( 103 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
99 HttpStreamFactoryImpl::Job::Delegate* delegate, 104 HttpStreamFactoryImpl::Job::Delegate* delegate,
100 HttpStreamFactoryImpl::JobType job_type, 105 HttpStreamFactoryImpl::JobType job_type,
101 HttpNetworkSession* session, 106 HttpNetworkSession* session,
102 const HttpRequestInfo& request_info, 107 const HttpRequestInfo& request_info,
103 RequestPriority priority, 108 RequestPriority priority,
104 const SSLConfig& server_ssl_config, 109 const SSLConfig& server_ssl_config,
105 const SSLConfig& proxy_ssl_config, 110 const SSLConfig& proxy_ssl_config,
106 HostPortPair destination, 111 HostPortPair destination,
107 GURL origin_url, 112 GURL origin_url,
108 AlternativeService alternative_service, 113 AlternativeService alternative_service,
114 bool enable_ip_based_pooling,
109 NetLog* net_log) { 115 NetLog* net_log) {
110 DCHECK(!alternative_job_); 116 DCHECK(!alternative_job_);
111 alternative_job_ = new MockHttpStreamFactoryImplJob( 117 alternative_job_ = new MockHttpStreamFactoryImplJob(
112 delegate, job_type, session, request_info, priority, SSLConfig(), 118 delegate, job_type, session, request_info, priority, SSLConfig(),
113 SSLConfig(), destination, origin_url, alternative_service, ProxyServer(), 119 SSLConfig(), destination, origin_url, alternative_service, ProxyServer(),
114 nullptr); 120 enable_ip_based_pooling, nullptr);
115 121
116 return alternative_job_; 122 return alternative_job_;
117 } 123 }
118 124
119 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( 125 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
120 HttpStreamFactoryImpl::Job::Delegate* delegate, 126 HttpStreamFactoryImpl::Job::Delegate* delegate,
121 HttpStreamFactoryImpl::JobType job_type, 127 HttpStreamFactoryImpl::JobType job_type,
122 HttpNetworkSession* session, 128 HttpNetworkSession* session,
123 const HttpRequestInfo& request_info, 129 const HttpRequestInfo& request_info,
124 RequestPriority priority, 130 RequestPriority priority,
125 const SSLConfig& server_ssl_config, 131 const SSLConfig& server_ssl_config,
126 const SSLConfig& proxy_ssl_config, 132 const SSLConfig& proxy_ssl_config,
127 HostPortPair destination, 133 HostPortPair destination,
128 GURL origin_url, 134 GURL origin_url,
129 const ProxyServer& alternative_proxy_server, 135 const ProxyServer& alternative_proxy_server,
136 bool enable_ip_based_pooling,
130 NetLog* net_log) { 137 NetLog* net_log) {
131 DCHECK(!alternative_job_); 138 DCHECK(!alternative_job_);
132 alternative_job_ = new MockHttpStreamFactoryImplJob( 139 alternative_job_ = new MockHttpStreamFactoryImplJob(
133 delegate, job_type, session, request_info, priority, SSLConfig(), 140 delegate, job_type, session, request_info, priority, SSLConfig(),
134 SSLConfig(), destination, origin_url, AlternativeService(), 141 SSLConfig(), destination, origin_url, AlternativeService(),
135 alternative_proxy_server, nullptr); 142 alternative_proxy_server, enable_ip_based_pooling, nullptr);
136 143
137 return alternative_job_; 144 return alternative_job_;
138 } 145 }
139 146
140 } // namespace net 147 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698