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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 8180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8191 | 8191 |
8192 TEST_P(HttpNetworkTransactionTest, CancelDuringInitRequestBody) { | 8192 TEST_P(HttpNetworkTransactionTest, CancelDuringInitRequestBody) { |
8193 class FakeUploadElementReader : public UploadElementReader { | 8193 class FakeUploadElementReader : public UploadElementReader { |
8194 public: | 8194 public: |
8195 FakeUploadElementReader() {} | 8195 FakeUploadElementReader() {} |
8196 virtual ~FakeUploadElementReader() {} | 8196 virtual ~FakeUploadElementReader() {} |
8197 | 8197 |
8198 const CompletionCallback& callback() const { return callback_; } | 8198 const CompletionCallback& callback() const { return callback_; } |
8199 | 8199 |
8200 // UploadElementReader overrides: | 8200 // UploadElementReader overrides: |
8201 virtual int Init(const CompletionCallback& callback) OVERRIDE { | 8201 virtual int Init(const CompletionCallback& callback) override { |
8202 callback_ = callback; | 8202 callback_ = callback; |
8203 return ERR_IO_PENDING; | 8203 return ERR_IO_PENDING; |
8204 } | 8204 } |
8205 virtual uint64 GetContentLength() const OVERRIDE { return 0; } | 8205 virtual uint64 GetContentLength() const override { return 0; } |
8206 virtual uint64 BytesRemaining() const OVERRIDE { return 0; } | 8206 virtual uint64 BytesRemaining() const override { return 0; } |
8207 virtual int Read(IOBuffer* buf, | 8207 virtual int Read(IOBuffer* buf, |
8208 int buf_length, | 8208 int buf_length, |
8209 const CompletionCallback& callback) OVERRIDE { | 8209 const CompletionCallback& callback) override { |
8210 return ERR_FAILED; | 8210 return ERR_FAILED; |
8211 } | 8211 } |
8212 | 8212 |
8213 private: | 8213 private: |
8214 CompletionCallback callback_; | 8214 CompletionCallback callback_; |
8215 }; | 8215 }; |
8216 | 8216 |
8217 FakeUploadElementReader* fake_reader = new FakeUploadElementReader; | 8217 FakeUploadElementReader* fake_reader = new FakeUploadElementReader; |
8218 ScopedVector<UploadElementReader> element_readers; | 8218 ScopedVector<UploadElementReader> element_readers; |
8219 element_readers.push_back(fake_reader); | 8219 element_readers.push_back(fake_reader); |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9098 | 9098 |
9099 class CapturingProxyResolver : public ProxyResolver { | 9099 class CapturingProxyResolver : public ProxyResolver { |
9100 public: | 9100 public: |
9101 CapturingProxyResolver() : ProxyResolver(false /* expects_pac_bytes */) {} | 9101 CapturingProxyResolver() : ProxyResolver(false /* expects_pac_bytes */) {} |
9102 virtual ~CapturingProxyResolver() {} | 9102 virtual ~CapturingProxyResolver() {} |
9103 | 9103 |
9104 virtual int GetProxyForURL(const GURL& url, | 9104 virtual int GetProxyForURL(const GURL& url, |
9105 ProxyInfo* results, | 9105 ProxyInfo* results, |
9106 const CompletionCallback& callback, | 9106 const CompletionCallback& callback, |
9107 RequestHandle* request, | 9107 RequestHandle* request, |
9108 const BoundNetLog& net_log) OVERRIDE { | 9108 const BoundNetLog& net_log) override { |
9109 ProxyServer proxy_server(ProxyServer::SCHEME_HTTP, | 9109 ProxyServer proxy_server(ProxyServer::SCHEME_HTTP, |
9110 HostPortPair("myproxy", 80)); | 9110 HostPortPair("myproxy", 80)); |
9111 results->UseProxyServer(proxy_server); | 9111 results->UseProxyServer(proxy_server); |
9112 resolved_.push_back(url); | 9112 resolved_.push_back(url); |
9113 return OK; | 9113 return OK; |
9114 } | 9114 } |
9115 | 9115 |
9116 virtual void CancelRequest(RequestHandle request) OVERRIDE { | 9116 virtual void CancelRequest(RequestHandle request) override { |
9117 NOTREACHED(); | 9117 NOTREACHED(); |
9118 } | 9118 } |
9119 | 9119 |
9120 virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE { | 9120 virtual LoadState GetLoadState(RequestHandle request) const override { |
9121 NOTREACHED(); | 9121 NOTREACHED(); |
9122 return LOAD_STATE_IDLE; | 9122 return LOAD_STATE_IDLE; |
9123 } | 9123 } |
9124 | 9124 |
9125 virtual void CancelSetPacScript() OVERRIDE { | 9125 virtual void CancelSetPacScript() override { |
9126 NOTREACHED(); | 9126 NOTREACHED(); |
9127 } | 9127 } |
9128 | 9128 |
9129 virtual int SetPacScript(const scoped_refptr<ProxyResolverScriptData>&, | 9129 virtual int SetPacScript(const scoped_refptr<ProxyResolverScriptData>&, |
9130 const CompletionCallback& /*callback*/) OVERRIDE { | 9130 const CompletionCallback& /*callback*/) override { |
9131 return OK; | 9131 return OK; |
9132 } | 9132 } |
9133 | 9133 |
9134 const std::vector<GURL>& resolved() const { return resolved_; } | 9134 const std::vector<GURL>& resolved() const { return resolved_; } |
9135 | 9135 |
9136 private: | 9136 private: |
9137 std::vector<GURL> resolved_; | 9137 std::vector<GURL> resolved_; |
9138 | 9138 |
9139 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); | 9139 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); |
9140 }; | 9140 }; |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10062 class UrlRecordingHttpAuthHandlerMock : public HttpAuthHandlerMock { | 10062 class UrlRecordingHttpAuthHandlerMock : public HttpAuthHandlerMock { |
10063 public: | 10063 public: |
10064 explicit UrlRecordingHttpAuthHandlerMock(GURL* url) : url_(url) {} | 10064 explicit UrlRecordingHttpAuthHandlerMock(GURL* url) : url_(url) {} |
10065 | 10065 |
10066 virtual ~UrlRecordingHttpAuthHandlerMock() {} | 10066 virtual ~UrlRecordingHttpAuthHandlerMock() {} |
10067 | 10067 |
10068 protected: | 10068 protected: |
10069 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, | 10069 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
10070 const HttpRequestInfo* request, | 10070 const HttpRequestInfo* request, |
10071 const CompletionCallback& callback, | 10071 const CompletionCallback& callback, |
10072 std::string* auth_token) OVERRIDE { | 10072 std::string* auth_token) override { |
10073 *url_ = request->url; | 10073 *url_ = request->url; |
10074 return HttpAuthHandlerMock::GenerateAuthTokenImpl( | 10074 return HttpAuthHandlerMock::GenerateAuthTokenImpl( |
10075 credentials, request, callback, auth_token); | 10075 credentials, request, callback, auth_token); |
10076 } | 10076 } |
10077 | 10077 |
10078 private: | 10078 private: |
10079 GURL* url_; | 10079 GURL* url_; |
10080 }; | 10080 }; |
10081 | 10081 |
10082 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { | 10082 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11159 virtual ~OneTimeCachingHostResolver() {} | 11159 virtual ~OneTimeCachingHostResolver() {} |
11160 | 11160 |
11161 RuleBasedHostResolverProc* rules() { return host_resolver_.rules(); } | 11161 RuleBasedHostResolverProc* rules() { return host_resolver_.rules(); } |
11162 | 11162 |
11163 // HostResolver methods: | 11163 // HostResolver methods: |
11164 virtual int Resolve(const RequestInfo& info, | 11164 virtual int Resolve(const RequestInfo& info, |
11165 RequestPriority priority, | 11165 RequestPriority priority, |
11166 AddressList* addresses, | 11166 AddressList* addresses, |
11167 const CompletionCallback& callback, | 11167 const CompletionCallback& callback, |
11168 RequestHandle* out_req, | 11168 RequestHandle* out_req, |
11169 const BoundNetLog& net_log) OVERRIDE { | 11169 const BoundNetLog& net_log) override { |
11170 return host_resolver_.Resolve( | 11170 return host_resolver_.Resolve( |
11171 info, priority, addresses, callback, out_req, net_log); | 11171 info, priority, addresses, callback, out_req, net_log); |
11172 } | 11172 } |
11173 | 11173 |
11174 virtual int ResolveFromCache(const RequestInfo& info, | 11174 virtual int ResolveFromCache(const RequestInfo& info, |
11175 AddressList* addresses, | 11175 AddressList* addresses, |
11176 const BoundNetLog& net_log) OVERRIDE { | 11176 const BoundNetLog& net_log) override { |
11177 int rv = host_resolver_.ResolveFromCache(info, addresses, net_log); | 11177 int rv = host_resolver_.ResolveFromCache(info, addresses, net_log); |
11178 if (rv == OK && info.host_port_pair().Equals(host_port_)) | 11178 if (rv == OK && info.host_port_pair().Equals(host_port_)) |
11179 host_resolver_.GetHostCache()->clear(); | 11179 host_resolver_.GetHostCache()->clear(); |
11180 return rv; | 11180 return rv; |
11181 } | 11181 } |
11182 | 11182 |
11183 virtual void CancelRequest(RequestHandle req) OVERRIDE { | 11183 virtual void CancelRequest(RequestHandle req) override { |
11184 host_resolver_.CancelRequest(req); | 11184 host_resolver_.CancelRequest(req); |
11185 } | 11185 } |
11186 | 11186 |
11187 MockCachingHostResolver* GetMockHostResolver() { | 11187 MockCachingHostResolver* GetMockHostResolver() { |
11188 return &host_resolver_; | 11188 return &host_resolver_; |
11189 } | 11189 } |
11190 | 11190 |
11191 private: | 11191 private: |
11192 MockCachingHostResolver host_resolver_; | 11192 MockCachingHostResolver host_resolver_; |
11193 const HostPortPair host_port_; | 11193 const HostPortPair host_port_; |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12205 public base::SupportsWeakPtr<FakeStream> { | 12205 public base::SupportsWeakPtr<FakeStream> { |
12206 public: | 12206 public: |
12207 explicit FakeStream(RequestPriority priority) : priority_(priority) {} | 12207 explicit FakeStream(RequestPriority priority) : priority_(priority) {} |
12208 virtual ~FakeStream() {} | 12208 virtual ~FakeStream() {} |
12209 | 12209 |
12210 RequestPriority priority() const { return priority_; } | 12210 RequestPriority priority() const { return priority_; } |
12211 | 12211 |
12212 virtual int InitializeStream(const HttpRequestInfo* request_info, | 12212 virtual int InitializeStream(const HttpRequestInfo* request_info, |
12213 RequestPriority priority, | 12213 RequestPriority priority, |
12214 const BoundNetLog& net_log, | 12214 const BoundNetLog& net_log, |
12215 const CompletionCallback& callback) OVERRIDE { | 12215 const CompletionCallback& callback) override { |
12216 return ERR_IO_PENDING; | 12216 return ERR_IO_PENDING; |
12217 } | 12217 } |
12218 | 12218 |
12219 virtual int SendRequest(const HttpRequestHeaders& request_headers, | 12219 virtual int SendRequest(const HttpRequestHeaders& request_headers, |
12220 HttpResponseInfo* response, | 12220 HttpResponseInfo* response, |
12221 const CompletionCallback& callback) OVERRIDE { | 12221 const CompletionCallback& callback) override { |
12222 ADD_FAILURE(); | 12222 ADD_FAILURE(); |
12223 return ERR_UNEXPECTED; | 12223 return ERR_UNEXPECTED; |
12224 } | 12224 } |
12225 | 12225 |
12226 virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE { | 12226 virtual int ReadResponseHeaders(const CompletionCallback& callback) override { |
12227 ADD_FAILURE(); | 12227 ADD_FAILURE(); |
12228 return ERR_UNEXPECTED; | 12228 return ERR_UNEXPECTED; |
12229 } | 12229 } |
12230 | 12230 |
12231 virtual int ReadResponseBody(IOBuffer* buf, int buf_len, | 12231 virtual int ReadResponseBody(IOBuffer* buf, int buf_len, |
12232 const CompletionCallback& callback) OVERRIDE { | 12232 const CompletionCallback& callback) override { |
12233 ADD_FAILURE(); | 12233 ADD_FAILURE(); |
12234 return ERR_UNEXPECTED; | 12234 return ERR_UNEXPECTED; |
12235 } | 12235 } |
12236 | 12236 |
12237 virtual void Close(bool not_reusable) OVERRIDE {} | 12237 virtual void Close(bool not_reusable) override {} |
12238 | 12238 |
12239 virtual bool IsResponseBodyComplete() const OVERRIDE { | 12239 virtual bool IsResponseBodyComplete() const override { |
12240 ADD_FAILURE(); | 12240 ADD_FAILURE(); |
12241 return false; | 12241 return false; |
12242 } | 12242 } |
12243 | 12243 |
12244 virtual bool CanFindEndOfResponse() const OVERRIDE { | 12244 virtual bool CanFindEndOfResponse() const override { |
12245 return false; | 12245 return false; |
12246 } | 12246 } |
12247 | 12247 |
12248 virtual bool IsConnectionReused() const OVERRIDE { | 12248 virtual bool IsConnectionReused() const override { |
12249 ADD_FAILURE(); | 12249 ADD_FAILURE(); |
12250 return false; | 12250 return false; |
12251 } | 12251 } |
12252 | 12252 |
12253 virtual void SetConnectionReused() OVERRIDE { | 12253 virtual void SetConnectionReused() override { |
12254 ADD_FAILURE(); | 12254 ADD_FAILURE(); |
12255 } | 12255 } |
12256 | 12256 |
12257 virtual bool IsConnectionReusable() const OVERRIDE { | 12257 virtual bool IsConnectionReusable() const override { |
12258 ADD_FAILURE(); | 12258 ADD_FAILURE(); |
12259 return false; | 12259 return false; |
12260 } | 12260 } |
12261 | 12261 |
12262 virtual int64 GetTotalReceivedBytes() const OVERRIDE { | 12262 virtual int64 GetTotalReceivedBytes() const override { |
12263 ADD_FAILURE(); | 12263 ADD_FAILURE(); |
12264 return 0; | 12264 return 0; |
12265 } | 12265 } |
12266 | 12266 |
12267 virtual bool GetLoadTimingInfo( | 12267 virtual bool GetLoadTimingInfo( |
12268 LoadTimingInfo* load_timing_info) const OVERRIDE { | 12268 LoadTimingInfo* load_timing_info) const override { |
12269 ADD_FAILURE(); | 12269 ADD_FAILURE(); |
12270 return false; | 12270 return false; |
12271 } | 12271 } |
12272 | 12272 |
12273 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { | 12273 virtual void GetSSLInfo(SSLInfo* ssl_info) override { |
12274 ADD_FAILURE(); | 12274 ADD_FAILURE(); |
12275 } | 12275 } |
12276 | 12276 |
12277 virtual void GetSSLCertRequestInfo( | 12277 virtual void GetSSLCertRequestInfo( |
12278 SSLCertRequestInfo* cert_request_info) OVERRIDE { | 12278 SSLCertRequestInfo* cert_request_info) override { |
12279 ADD_FAILURE(); | 12279 ADD_FAILURE(); |
12280 } | 12280 } |
12281 | 12281 |
12282 virtual bool IsSpdyHttpStream() const OVERRIDE { | 12282 virtual bool IsSpdyHttpStream() const override { |
12283 ADD_FAILURE(); | 12283 ADD_FAILURE(); |
12284 return false; | 12284 return false; |
12285 } | 12285 } |
12286 | 12286 |
12287 virtual void Drain(HttpNetworkSession* session) OVERRIDE { | 12287 virtual void Drain(HttpNetworkSession* session) override { |
12288 ADD_FAILURE(); | 12288 ADD_FAILURE(); |
12289 } | 12289 } |
12290 | 12290 |
12291 virtual void SetPriority(RequestPriority priority) OVERRIDE { | 12291 virtual void SetPriority(RequestPriority priority) override { |
12292 priority_ = priority; | 12292 priority_ = priority; |
12293 } | 12293 } |
12294 | 12294 |
12295 private: | 12295 private: |
12296 RequestPriority priority_; | 12296 RequestPriority priority_; |
12297 | 12297 |
12298 DISALLOW_COPY_AND_ASSIGN(FakeStream); | 12298 DISALLOW_COPY_AND_ASSIGN(FakeStream); |
12299 }; | 12299 }; |
12300 | 12300 |
12301 // Fake HttpStreamRequest that simply records calls to SetPriority() | 12301 // Fake HttpStreamRequest that simply records calls to SetPriority() |
(...skipping 28 matching lines...) Expand all Loading... |
12330 base::WeakPtr<FakeStream> FinishStreamRequest() { | 12330 base::WeakPtr<FakeStream> FinishStreamRequest() { |
12331 FakeStream* fake_stream = new FakeStream(priority_); | 12331 FakeStream* fake_stream = new FakeStream(priority_); |
12332 // Do this before calling OnStreamReady() as OnStreamReady() may | 12332 // Do this before calling OnStreamReady() as OnStreamReady() may |
12333 // immediately delete |fake_stream|. | 12333 // immediately delete |fake_stream|. |
12334 base::WeakPtr<FakeStream> weak_stream = fake_stream->AsWeakPtr(); | 12334 base::WeakPtr<FakeStream> weak_stream = fake_stream->AsWeakPtr(); |
12335 delegate_->OnStreamReady(SSLConfig(), ProxyInfo(), fake_stream); | 12335 delegate_->OnStreamReady(SSLConfig(), ProxyInfo(), fake_stream); |
12336 return weak_stream; | 12336 return weak_stream; |
12337 } | 12337 } |
12338 | 12338 |
12339 virtual int RestartTunnelWithProxyAuth( | 12339 virtual int RestartTunnelWithProxyAuth( |
12340 const AuthCredentials& credentials) OVERRIDE { | 12340 const AuthCredentials& credentials) override { |
12341 ADD_FAILURE(); | 12341 ADD_FAILURE(); |
12342 return ERR_UNEXPECTED; | 12342 return ERR_UNEXPECTED; |
12343 } | 12343 } |
12344 | 12344 |
12345 virtual LoadState GetLoadState() const OVERRIDE { | 12345 virtual LoadState GetLoadState() const override { |
12346 ADD_FAILURE(); | 12346 ADD_FAILURE(); |
12347 return LoadState(); | 12347 return LoadState(); |
12348 } | 12348 } |
12349 | 12349 |
12350 virtual void SetPriority(RequestPriority priority) OVERRIDE { | 12350 virtual void SetPriority(RequestPriority priority) override { |
12351 priority_ = priority; | 12351 priority_ = priority; |
12352 } | 12352 } |
12353 | 12353 |
12354 virtual bool was_npn_negotiated() const OVERRIDE { | 12354 virtual bool was_npn_negotiated() const override { |
12355 return false; | 12355 return false; |
12356 } | 12356 } |
12357 | 12357 |
12358 virtual NextProto protocol_negotiated() const OVERRIDE { | 12358 virtual NextProto protocol_negotiated() const override { |
12359 return kProtoUnknown; | 12359 return kProtoUnknown; |
12360 } | 12360 } |
12361 | 12361 |
12362 virtual bool using_spdy() const OVERRIDE { | 12362 virtual bool using_spdy() const override { |
12363 return false; | 12363 return false; |
12364 } | 12364 } |
12365 | 12365 |
12366 private: | 12366 private: |
12367 RequestPriority priority_; | 12367 RequestPriority priority_; |
12368 HttpStreamRequest::Delegate* const delegate_; | 12368 HttpStreamRequest::Delegate* const delegate_; |
12369 WebSocketHandshakeStreamBase::CreateHelper* websocket_stream_create_helper_; | 12369 WebSocketHandshakeStreamBase::CreateHelper* websocket_stream_create_helper_; |
12370 | 12370 |
12371 DISALLOW_COPY_AND_ASSIGN(FakeStreamRequest); | 12371 DISALLOW_COPY_AND_ASSIGN(FakeStreamRequest); |
12372 }; | 12372 }; |
12373 | 12373 |
12374 // Fake HttpStreamFactory that vends FakeStreamRequests. | 12374 // Fake HttpStreamFactory that vends FakeStreamRequests. |
12375 class FakeStreamFactory : public HttpStreamFactory { | 12375 class FakeStreamFactory : public HttpStreamFactory { |
12376 public: | 12376 public: |
12377 FakeStreamFactory() {} | 12377 FakeStreamFactory() {} |
12378 virtual ~FakeStreamFactory() {} | 12378 virtual ~FakeStreamFactory() {} |
12379 | 12379 |
12380 // Returns a WeakPtr<> to the last HttpStreamRequest returned by | 12380 // Returns a WeakPtr<> to the last HttpStreamRequest returned by |
12381 // RequestStream() (which may be NULL if it was destroyed already). | 12381 // RequestStream() (which may be NULL if it was destroyed already). |
12382 base::WeakPtr<FakeStreamRequest> last_stream_request() { | 12382 base::WeakPtr<FakeStreamRequest> last_stream_request() { |
12383 return last_stream_request_; | 12383 return last_stream_request_; |
12384 } | 12384 } |
12385 | 12385 |
12386 virtual HttpStreamRequest* RequestStream( | 12386 virtual HttpStreamRequest* RequestStream( |
12387 const HttpRequestInfo& info, | 12387 const HttpRequestInfo& info, |
12388 RequestPriority priority, | 12388 RequestPriority priority, |
12389 const SSLConfig& server_ssl_config, | 12389 const SSLConfig& server_ssl_config, |
12390 const SSLConfig& proxy_ssl_config, | 12390 const SSLConfig& proxy_ssl_config, |
12391 HttpStreamRequest::Delegate* delegate, | 12391 HttpStreamRequest::Delegate* delegate, |
12392 const BoundNetLog& net_log) OVERRIDE { | 12392 const BoundNetLog& net_log) override { |
12393 FakeStreamRequest* fake_request = new FakeStreamRequest(priority, delegate); | 12393 FakeStreamRequest* fake_request = new FakeStreamRequest(priority, delegate); |
12394 last_stream_request_ = fake_request->AsWeakPtr(); | 12394 last_stream_request_ = fake_request->AsWeakPtr(); |
12395 return fake_request; | 12395 return fake_request; |
12396 } | 12396 } |
12397 | 12397 |
12398 virtual HttpStreamRequest* RequestWebSocketHandshakeStream( | 12398 virtual HttpStreamRequest* RequestWebSocketHandshakeStream( |
12399 const HttpRequestInfo& info, | 12399 const HttpRequestInfo& info, |
12400 RequestPriority priority, | 12400 RequestPriority priority, |
12401 const SSLConfig& server_ssl_config, | 12401 const SSLConfig& server_ssl_config, |
12402 const SSLConfig& proxy_ssl_config, | 12402 const SSLConfig& proxy_ssl_config, |
12403 HttpStreamRequest::Delegate* delegate, | 12403 HttpStreamRequest::Delegate* delegate, |
12404 WebSocketHandshakeStreamBase::CreateHelper* create_helper, | 12404 WebSocketHandshakeStreamBase::CreateHelper* create_helper, |
12405 const BoundNetLog& net_log) OVERRIDE { | 12405 const BoundNetLog& net_log) override { |
12406 FakeStreamRequest* fake_request = | 12406 FakeStreamRequest* fake_request = |
12407 new FakeStreamRequest(priority, delegate, create_helper); | 12407 new FakeStreamRequest(priority, delegate, create_helper); |
12408 last_stream_request_ = fake_request->AsWeakPtr(); | 12408 last_stream_request_ = fake_request->AsWeakPtr(); |
12409 return fake_request; | 12409 return fake_request; |
12410 } | 12410 } |
12411 | 12411 |
12412 virtual void PreconnectStreams(int num_streams, | 12412 virtual void PreconnectStreams(int num_streams, |
12413 const HttpRequestInfo& info, | 12413 const HttpRequestInfo& info, |
12414 RequestPriority priority, | 12414 RequestPriority priority, |
12415 const SSLConfig& server_ssl_config, | 12415 const SSLConfig& server_ssl_config, |
12416 const SSLConfig& proxy_ssl_config) OVERRIDE { | 12416 const SSLConfig& proxy_ssl_config) override { |
12417 ADD_FAILURE(); | 12417 ADD_FAILURE(); |
12418 } | 12418 } |
12419 | 12419 |
12420 virtual const HostMappingRules* GetHostMappingRules() const OVERRIDE { | 12420 virtual const HostMappingRules* GetHostMappingRules() const override { |
12421 ADD_FAILURE(); | 12421 ADD_FAILURE(); |
12422 return NULL; | 12422 return NULL; |
12423 } | 12423 } |
12424 | 12424 |
12425 private: | 12425 private: |
12426 base::WeakPtr<FakeStreamRequest> last_stream_request_; | 12426 base::WeakPtr<FakeStreamRequest> last_stream_request_; |
12427 | 12427 |
12428 DISALLOW_COPY_AND_ASSIGN(FakeStreamFactory); | 12428 DISALLOW_COPY_AND_ASSIGN(FakeStreamFactory); |
12429 }; | 12429 }; |
12430 | 12430 |
12431 // TODO(yhirano): Split this class out into a net/websockets file, if it is | 12431 // TODO(yhirano): Split this class out into a net/websockets file, if it is |
12432 // worth doing. | 12432 // worth doing. |
12433 class FakeWebSocketStreamCreateHelper : | 12433 class FakeWebSocketStreamCreateHelper : |
12434 public WebSocketHandshakeStreamBase::CreateHelper { | 12434 public WebSocketHandshakeStreamBase::CreateHelper { |
12435 public: | 12435 public: |
12436 virtual WebSocketHandshakeStreamBase* CreateBasicStream( | 12436 virtual WebSocketHandshakeStreamBase* CreateBasicStream( |
12437 scoped_ptr<ClientSocketHandle> connection, | 12437 scoped_ptr<ClientSocketHandle> connection, |
12438 bool using_proxy) OVERRIDE { | 12438 bool using_proxy) override { |
12439 NOTREACHED(); | 12439 NOTREACHED(); |
12440 return NULL; | 12440 return NULL; |
12441 } | 12441 } |
12442 | 12442 |
12443 virtual WebSocketHandshakeStreamBase* CreateSpdyStream( | 12443 virtual WebSocketHandshakeStreamBase* CreateSpdyStream( |
12444 const base::WeakPtr<SpdySession>& session, | 12444 const base::WeakPtr<SpdySession>& session, |
12445 bool use_relative_url) OVERRIDE { | 12445 bool use_relative_url) override { |
12446 NOTREACHED(); | 12446 NOTREACHED(); |
12447 return NULL; | 12447 return NULL; |
12448 }; | 12448 }; |
12449 | 12449 |
12450 virtual ~FakeWebSocketStreamCreateHelper() {} | 12450 virtual ~FakeWebSocketStreamCreateHelper() {} |
12451 | 12451 |
12452 virtual scoped_ptr<WebSocketStream> Upgrade() { | 12452 virtual scoped_ptr<WebSocketStream> Upgrade() { |
12453 NOTREACHED(); | 12453 NOTREACHED(); |
12454 return scoped_ptr<WebSocketStream>(); | 12454 return scoped_ptr<WebSocketStream>(); |
12455 } | 12455 } |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13205 EXPECT_EQ(ERR_IO_PENDING, rv); | 13205 EXPECT_EQ(ERR_IO_PENDING, rv); |
13206 | 13206 |
13207 rv = callback.WaitForResult(); | 13207 rv = callback.WaitForResult(); |
13208 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 13208 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
13209 | 13209 |
13210 const HttpResponseInfo* response = trans->GetResponseInfo(); | 13210 const HttpResponseInfo* response = trans->GetResponseInfo(); |
13211 EXPECT_TRUE(response == NULL); | 13211 EXPECT_TRUE(response == NULL); |
13212 } | 13212 } |
13213 | 13213 |
13214 } // namespace net | 13214 } // namespace net |
OLD | NEW |