OLD | NEW |
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 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_TEST_UTIL_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_TEST_UTIL_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_TEST_UTIL_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_TEST_UTIL_H_ |
7 | 7 |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "net/http/http_stream.h" | 9 #include "net/http/http_stream.h" |
10 #include "net/http/http_stream_factory.h" | 10 #include "net/http/http_stream_factory.h" |
11 #include "net/http/http_stream_factory_impl.h" | 11 #include "net/http/http_stream_factory_impl.h" |
12 #include "net/http/http_stream_factory_impl_job.h" | 12 #include "net/http/http_stream_factory_impl_job.h" |
13 #include "net/http/http_stream_factory_impl_job_controller.h" | 13 #include "net/http/http_stream_factory_impl_job_controller.h" |
14 #include "net/proxy/proxy_info.h" | 14 #include "net/proxy/proxy_info.h" |
| 15 #include "net/proxy/proxy_server.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 | 17 |
17 using testing::_; | 18 using testing::_; |
18 using testing::Invoke; | 19 using testing::Invoke; |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 | 22 |
22 class HttpStreamFactoryImplPeer { | 23 class HttpStreamFactoryImplPeer { |
23 public: | 24 public: |
24 static void AddJobController( | 25 static void AddJobController( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 MockHttpStreamFactoryImplJob(HttpStreamFactoryImpl::Job::Delegate* delegate, | 106 MockHttpStreamFactoryImplJob(HttpStreamFactoryImpl::Job::Delegate* delegate, |
106 HttpStreamFactoryImpl::JobType job_type, | 107 HttpStreamFactoryImpl::JobType job_type, |
107 HttpNetworkSession* session, | 108 HttpNetworkSession* session, |
108 const HttpRequestInfo& request_info, | 109 const HttpRequestInfo& request_info, |
109 RequestPriority priority, | 110 RequestPriority priority, |
110 const SSLConfig& server_ssl_config, | 111 const SSLConfig& server_ssl_config, |
111 const SSLConfig& proxy_ssl_config, | 112 const SSLConfig& proxy_ssl_config, |
112 HostPortPair destination, | 113 HostPortPair destination, |
113 GURL origin_url, | 114 GURL origin_url, |
114 AlternativeService alternative_service, | 115 AlternativeService alternative_service, |
| 116 const ProxyServer& alternative_proxy_server, |
115 NetLog* net_log); | 117 NetLog* net_log); |
116 | 118 |
117 ~MockHttpStreamFactoryImplJob() override; | 119 ~MockHttpStreamFactoryImplJob() override; |
118 | 120 |
119 MOCK_METHOD0(Resume, void()); | 121 MOCK_METHOD0(Resume, void()); |
120 | 122 |
121 MOCK_METHOD1(MarkOtherJobComplete, void(const Job& job)); | 123 MOCK_METHOD1(MarkOtherJobComplete, void(const Job& job)); |
122 | 124 |
123 MOCK_METHOD0(Orphan, void()); | 125 MOCK_METHOD0(Orphan, void()); |
124 }; | 126 }; |
(...skipping 20 matching lines...) Expand all Loading... |
145 HttpStreamFactoryImpl::Job::Delegate* delegate, | 147 HttpStreamFactoryImpl::Job::Delegate* delegate, |
146 HttpStreamFactoryImpl::JobType job_type, | 148 HttpStreamFactoryImpl::JobType job_type, |
147 HttpNetworkSession* session, | 149 HttpNetworkSession* session, |
148 const HttpRequestInfo& request_info, | 150 const HttpRequestInfo& request_info, |
149 RequestPriority priority, | 151 RequestPriority priority, |
150 const SSLConfig& server_ssl_config, | 152 const SSLConfig& server_ssl_config, |
151 const SSLConfig& proxy_ssl_config, | 153 const SSLConfig& proxy_ssl_config, |
152 HostPortPair destination, | 154 HostPortPair destination, |
153 GURL origin_url, | 155 GURL origin_url, |
154 AlternativeService alternative_service, | 156 AlternativeService alternative_service, |
| 157 const ProxyServer& alternative_proxy_server, |
155 NetLog* net_log) override; | 158 NetLog* net_log) override; |
156 | 159 |
157 MockHttpStreamFactoryImplJob* main_job() const { return main_job_; } | 160 MockHttpStreamFactoryImplJob* main_job() const { return main_job_; } |
158 MockHttpStreamFactoryImplJob* alternative_job() const { | 161 MockHttpStreamFactoryImplJob* alternative_job() const { |
159 return alternative_job_; | 162 return alternative_job_; |
160 } | 163 } |
161 | 164 |
162 void UseDifferentURLForMainJob(GURL url) { | 165 void UseDifferentURLForMainJob(GURL url) { |
163 override_main_job_url_ = true; | 166 override_main_job_url_ = true; |
164 main_job_alternative_url_ = url; | 167 main_job_alternative_url_ = url; |
165 } | 168 } |
166 | 169 |
167 private: | 170 private: |
168 MockHttpStreamFactoryImplJob* main_job_; | 171 MockHttpStreamFactoryImplJob* main_job_; |
169 MockHttpStreamFactoryImplJob* alternative_job_; | 172 MockHttpStreamFactoryImplJob* alternative_job_; |
170 bool override_main_job_url_; | 173 bool override_main_job_url_; |
171 GURL main_job_alternative_url_; | 174 GURL main_job_alternative_url_; |
172 }; | 175 }; |
173 | 176 |
174 } // namespace net | 177 } // namespace net |
175 | 178 |
176 #endif // NET_HTTP_HTTP_STREAM_FACTORY_TEST_UTIL_H_ | 179 #endif // NET_HTTP_HTTP_STREAM_FACTORY_TEST_UTIL_H_ |
OLD | NEW |