OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 15209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15220 public: | 15220 public: |
15221 FakeStreamFactory() {} | 15221 FakeStreamFactory() {} |
15222 ~FakeStreamFactory() override {} | 15222 ~FakeStreamFactory() override {} |
15223 | 15223 |
15224 // Returns a WeakPtr<> to the last HttpStreamRequest returned by | 15224 // Returns a WeakPtr<> to the last HttpStreamRequest returned by |
15225 // RequestStream() (which may be NULL if it was destroyed already). | 15225 // RequestStream() (which may be NULL if it was destroyed already). |
15226 base::WeakPtr<FakeStreamRequest> last_stream_request() { | 15226 base::WeakPtr<FakeStreamRequest> last_stream_request() { |
15227 return last_stream_request_; | 15227 return last_stream_request_; |
15228 } | 15228 } |
15229 | 15229 |
15230 HttpStreamRequest* RequestStream(const HttpRequestInfo& info, | 15230 std::unique_ptr<HttpStreamRequest> RequestStream( |
15231 RequestPriority priority, | |
15232 const SSLConfig& server_ssl_config, | |
15233 const SSLConfig& proxy_ssl_config, | |
15234 HttpStreamRequest::Delegate* delegate, | |
15235 bool enable_ip_based_pooling, | |
15236 bool enable_alternative_services, | |
15237 const NetLogWithSource& net_log) override { | |
15238 FakeStreamRequest* fake_request = new FakeStreamRequest(priority, delegate); | |
15239 last_stream_request_ = fake_request->AsWeakPtr(); | |
15240 return fake_request; | |
15241 } | |
15242 | |
15243 HttpStreamRequest* RequestBidirectionalStreamImpl( | |
15244 const HttpRequestInfo& info, | 15231 const HttpRequestInfo& info, |
15245 RequestPriority priority, | 15232 RequestPriority priority, |
15246 const SSLConfig& server_ssl_config, | 15233 const SSLConfig& server_ssl_config, |
| 15234 const SSLConfig& proxy_ssl_config, |
| 15235 HttpStreamRequest::Delegate* delegate, |
| 15236 bool enable_ip_based_pooling, |
| 15237 bool enable_alternative_services, |
| 15238 const NetLogWithSource& net_log) override { |
| 15239 auto fake_request = base::MakeUnique<FakeStreamRequest>(priority, delegate); |
| 15240 last_stream_request_ = fake_request->AsWeakPtr(); |
| 15241 return std::move(fake_request); |
| 15242 } |
| 15243 |
| 15244 std::unique_ptr<HttpStreamRequest> RequestBidirectionalStreamImpl( |
| 15245 const HttpRequestInfo& info, |
| 15246 RequestPriority priority, |
| 15247 const SSLConfig& server_ssl_config, |
15247 const SSLConfig& proxy_ssl_config, | 15248 const SSLConfig& proxy_ssl_config, |
15248 HttpStreamRequest::Delegate* delegate, | 15249 HttpStreamRequest::Delegate* delegate, |
15249 bool enable_ip_based_pooling, | 15250 bool enable_ip_based_pooling, |
15250 bool enable_alternative_services, | 15251 bool enable_alternative_services, |
15251 const NetLogWithSource& net_log) override { | 15252 const NetLogWithSource& net_log) override { |
15252 NOTREACHED(); | 15253 NOTREACHED(); |
15253 return nullptr; | 15254 return nullptr; |
15254 } | 15255 } |
15255 | 15256 |
15256 HttpStreamRequest* RequestWebSocketHandshakeStream( | 15257 std::unique_ptr<HttpStreamRequest> RequestWebSocketHandshakeStream( |
15257 const HttpRequestInfo& info, | 15258 const HttpRequestInfo& info, |
15258 RequestPriority priority, | 15259 RequestPriority priority, |
15259 const SSLConfig& server_ssl_config, | 15260 const SSLConfig& server_ssl_config, |
15260 const SSLConfig& proxy_ssl_config, | 15261 const SSLConfig& proxy_ssl_config, |
15261 HttpStreamRequest::Delegate* delegate, | 15262 HttpStreamRequest::Delegate* delegate, |
15262 WebSocketHandshakeStreamBase::CreateHelper* create_helper, | 15263 WebSocketHandshakeStreamBase::CreateHelper* create_helper, |
15263 bool enable_ip_based_pooling, | 15264 bool enable_ip_based_pooling, |
15264 bool enable_alternative_services, | 15265 bool enable_alternative_services, |
15265 const NetLogWithSource& net_log) override { | 15266 const NetLogWithSource& net_log) override { |
15266 FakeStreamRequest* fake_request = | 15267 auto fake_request = |
15267 new FakeStreamRequest(priority, delegate, create_helper); | 15268 base::MakeUnique<FakeStreamRequest>(priority, delegate, create_helper); |
15268 last_stream_request_ = fake_request->AsWeakPtr(); | 15269 last_stream_request_ = fake_request->AsWeakPtr(); |
15269 return fake_request; | 15270 return std::move(fake_request); |
15270 } | 15271 } |
15271 | 15272 |
15272 void PreconnectStreams(int num_streams, | 15273 void PreconnectStreams(int num_streams, |
15273 const HttpRequestInfo& info) override { | 15274 const HttpRequestInfo& info) override { |
15274 ADD_FAILURE(); | 15275 ADD_FAILURE(); |
15275 } | 15276 } |
15276 | 15277 |
15277 const HostMappingRules* GetHostMappingRules() const override { | 15278 const HostMappingRules* GetHostMappingRules() const override { |
15278 ADD_FAILURE(); | 15279 ADD_FAILURE(); |
15279 return NULL; | 15280 return NULL; |
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16949 | 16950 |
16950 TestCompletionCallback callback; | 16951 TestCompletionCallback callback; |
16951 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | 16952 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
16952 int rv = trans.Start(&request, callback.callback(), NetLogWithSource()); | 16953 int rv = trans.Start(&request, callback.callback(), NetLogWithSource()); |
16953 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); | 16954 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); |
16954 | 16955 |
16955 EXPECT_THAT(callback.WaitForResult(), IsError(ERR_NO_SUPPORTED_PROXIES)); | 16956 EXPECT_THAT(callback.WaitForResult(), IsError(ERR_NO_SUPPORTED_PROXIES)); |
16956 } | 16957 } |
16957 | 16958 |
16958 } // namespace net | 16959 } // namespace net |
OLD | NEW |