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 15206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15217 public: | 15217 public: |
15218 FakeStreamFactory() {} | 15218 FakeStreamFactory() {} |
15219 ~FakeStreamFactory() override {} | 15219 ~FakeStreamFactory() override {} |
15220 | 15220 |
15221 // Returns a WeakPtr<> to the last HttpStreamRequest returned by | 15221 // Returns a WeakPtr<> to the last HttpStreamRequest returned by |
15222 // RequestStream() (which may be NULL if it was destroyed already). | 15222 // RequestStream() (which may be NULL if it was destroyed already). |
15223 base::WeakPtr<FakeStreamRequest> last_stream_request() { | 15223 base::WeakPtr<FakeStreamRequest> last_stream_request() { |
15224 return last_stream_request_; | 15224 return last_stream_request_; |
15225 } | 15225 } |
15226 | 15226 |
15227 HttpStreamRequest* RequestStream(const HttpRequestInfo& info, | 15227 std::unique_ptr<HttpStreamRequest> RequestStream( |
15228 RequestPriority priority, | |
15229 const SSLConfig& server_ssl_config, | |
15230 const SSLConfig& proxy_ssl_config, | |
15231 HttpStreamRequest::Delegate* delegate, | |
15232 bool enable_ip_based_pooling, | |
15233 bool enable_alternative_services, | |
15234 const NetLogWithSource& net_log) override { | |
15235 FakeStreamRequest* fake_request = new FakeStreamRequest(priority, delegate); | |
15236 last_stream_request_ = fake_request->AsWeakPtr(); | |
15237 return fake_request; | |
15238 } | |
15239 | |
15240 HttpStreamRequest* RequestBidirectionalStreamImpl( | |
15241 const HttpRequestInfo& info, | 15228 const HttpRequestInfo& info, |
15242 RequestPriority priority, | 15229 RequestPriority priority, |
15243 const SSLConfig& server_ssl_config, | 15230 const SSLConfig& server_ssl_config, |
15231 const SSLConfig& proxy_ssl_config, | |
15232 HttpStreamRequest::Delegate* delegate, | |
15233 bool enable_ip_based_pooling, | |
15234 bool enable_alternative_services, | |
15235 const NetLogWithSource& net_log) override { | |
15236 auto fake_request = base::MakeUnique<FakeStreamRequest>(priority, delegate); | |
15237 last_stream_request_ = fake_request->AsWeakPtr(); | |
15238 return std::move(fake_request); | |
Bence
2017/05/19 15:55:10
std::move is necessary here because |fake_request|
| |
15239 } | |
15240 | |
15241 std::unique_ptr<HttpStreamRequest> RequestBidirectionalStreamImpl( | |
15242 const HttpRequestInfo& info, | |
15243 RequestPriority priority, | |
15244 const SSLConfig& server_ssl_config, | |
15244 const SSLConfig& proxy_ssl_config, | 15245 const SSLConfig& proxy_ssl_config, |
15245 HttpStreamRequest::Delegate* delegate, | 15246 HttpStreamRequest::Delegate* delegate, |
15246 bool enable_ip_based_pooling, | 15247 bool enable_ip_based_pooling, |
15247 bool enable_alternative_services, | 15248 bool enable_alternative_services, |
15248 const NetLogWithSource& net_log) override { | 15249 const NetLogWithSource& net_log) override { |
15249 NOTREACHED(); | 15250 NOTREACHED(); |
15250 return nullptr; | 15251 return nullptr; |
15251 } | 15252 } |
15252 | 15253 |
15253 HttpStreamRequest* RequestWebSocketHandshakeStream( | 15254 std::unique_ptr<HttpStreamRequest> RequestWebSocketHandshakeStream( |
15254 const HttpRequestInfo& info, | 15255 const HttpRequestInfo& info, |
15255 RequestPriority priority, | 15256 RequestPriority priority, |
15256 const SSLConfig& server_ssl_config, | 15257 const SSLConfig& server_ssl_config, |
15257 const SSLConfig& proxy_ssl_config, | 15258 const SSLConfig& proxy_ssl_config, |
15258 HttpStreamRequest::Delegate* delegate, | 15259 HttpStreamRequest::Delegate* delegate, |
15259 WebSocketHandshakeStreamBase::CreateHelper* create_helper, | 15260 WebSocketHandshakeStreamBase::CreateHelper* create_helper, |
15260 bool enable_ip_based_pooling, | 15261 bool enable_ip_based_pooling, |
15261 bool enable_alternative_services, | 15262 bool enable_alternative_services, |
15262 const NetLogWithSource& net_log) override { | 15263 const NetLogWithSource& net_log) override { |
15263 FakeStreamRequest* fake_request = | 15264 auto fake_request = |
15264 new FakeStreamRequest(priority, delegate, create_helper); | 15265 base::MakeUnique<FakeStreamRequest>(priority, delegate, create_helper); |
15265 last_stream_request_ = fake_request->AsWeakPtr(); | 15266 last_stream_request_ = fake_request->AsWeakPtr(); |
15266 return fake_request; | 15267 return std::move(fake_request); |
Bence
2017/05/19 15:55:10
Same as above.
| |
15267 } | 15268 } |
15268 | 15269 |
15269 void PreconnectStreams(int num_streams, | 15270 void PreconnectStreams(int num_streams, |
15270 const HttpRequestInfo& info) override { | 15271 const HttpRequestInfo& info) override { |
15271 ADD_FAILURE(); | 15272 ADD_FAILURE(); |
15272 } | 15273 } |
15273 | 15274 |
15274 const HostMappingRules* GetHostMappingRules() const override { | 15275 const HostMappingRules* GetHostMappingRules() const override { |
15275 ADD_FAILURE(); | 15276 ADD_FAILURE(); |
15276 return NULL; | 15277 return NULL; |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16939 | 16940 |
16940 TestCompletionCallback callback; | 16941 TestCompletionCallback callback; |
16941 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | 16942 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
16942 int rv = trans.Start(&request, callback.callback(), NetLogWithSource()); | 16943 int rv = trans.Start(&request, callback.callback(), NetLogWithSource()); |
16943 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); | 16944 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); |
16944 | 16945 |
16945 EXPECT_THAT(callback.WaitForResult(), IsError(ERR_NO_SUPPORTED_PROXIES)); | 16946 EXPECT_THAT(callback.WaitForResult(), IsError(ERR_NO_SUPPORTED_PROXIES)); |
16946 } | 16947 } |
16947 | 16948 |
16948 } // namespace net | 16949 } // namespace net |
OLD | NEW |