| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_stream_factory_impl_request.h" | 5 #include "net/http/http_stream_factory_impl_request.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "net/http/http_stream_factory_impl_job.h" | 8 #include "net/http/http_stream_factory_impl_job.h" |
| 9 #include "net/proxy/proxy_info.h" | 9 #include "net/proxy/proxy_info.h" |
| 10 #include "net/proxy/proxy_service.h" | 10 #include "net/proxy/proxy_service.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class DoNothingRequestDelegate : public HttpStreamRequest::Delegate { | 28 class DoNothingRequestDelegate : public HttpStreamRequest::Delegate { |
| 29 public: | 29 public: |
| 30 DoNothingRequestDelegate() {} | 30 DoNothingRequestDelegate() {} |
| 31 | 31 |
| 32 ~DoNothingRequestDelegate() override {} | 32 ~DoNothingRequestDelegate() override {} |
| 33 | 33 |
| 34 // HttpStreamRequest::Delegate | 34 // HttpStreamRequest::Delegate |
| 35 void OnStreamReady(const SSLConfig& used_ssl_config, | 35 void OnStreamReady(const SSLConfig& used_ssl_config, |
| 36 const ProxyInfo& used_proxy_info, | 36 const ProxyInfo& used_proxy_info, |
| 37 HttpStream* stream) override {} | 37 HttpStream* stream) override {} |
| 38 void OnBidirectionalStreamReady(const SSLConfig& used_ssl_config, |
| 39 const ProxyInfo& used_proxy_info, |
| 40 BidirectionalStream* stream) override {} |
| 41 |
| 38 void OnWebSocketHandshakeStreamReady( | 42 void OnWebSocketHandshakeStreamReady( |
| 39 const SSLConfig& used_ssl_config, | 43 const SSLConfig& used_ssl_config, |
| 40 const ProxyInfo& used_proxy_info, | 44 const ProxyInfo& used_proxy_info, |
| 41 WebSocketHandshakeStreamBase* stream) override {} | 45 WebSocketHandshakeStreamBase* stream) override {} |
| 42 void OnStreamFailed(int status, | 46 void OnStreamFailed(int status, |
| 43 const SSLConfig& used_ssl_config, | 47 const SSLConfig& used_ssl_config, |
| 44 SSLFailureState ssl_failure_state) override {} | 48 SSLFailureState ssl_failure_state) override {} |
| 45 void OnCertificateError(int status, | 49 void OnCertificateError(int status, |
| 46 const SSLConfig& used_ssl_config, | 50 const SSLConfig& used_ssl_config, |
| 47 const SSLInfo& ssl_info) override {} | 51 const SSLInfo& ssl_info) override {} |
| (...skipping 16 matching lines...) Expand all Loading... |
| 64 SpdySessionDependencies session_deps(GetParam(), | 68 SpdySessionDependencies session_deps(GetParam(), |
| 65 ProxyService::CreateDirect()); | 69 ProxyService::CreateDirect()); |
| 66 | 70 |
| 67 scoped_ptr<HttpNetworkSession> session = | 71 scoped_ptr<HttpNetworkSession> session = |
| 68 SpdySessionDependencies::SpdyCreateSession(&session_deps); | 72 SpdySessionDependencies::SpdyCreateSession(&session_deps); |
| 69 HttpStreamFactoryImpl* factory = | 73 HttpStreamFactoryImpl* factory = |
| 70 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory()); | 74 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory()); |
| 71 | 75 |
| 72 DoNothingRequestDelegate request_delegate; | 76 DoNothingRequestDelegate request_delegate; |
| 73 HttpStreamFactoryImpl::Request request( | 77 HttpStreamFactoryImpl::Request request( |
| 74 GURL(), factory, &request_delegate, NULL, BoundNetLog()); | 78 GURL(), factory, &request_delegate, NULL, BoundNetLog(), |
| 79 HttpStreamFactoryImpl::Request::HTTP_STREAM); |
| 75 | 80 |
| 76 HttpStreamFactoryImpl::Job* job = | 81 HttpStreamFactoryImpl::Job* job = |
| 77 new HttpStreamFactoryImpl::Job(factory, | 82 new HttpStreamFactoryImpl::Job(factory, |
| 78 session.get(), | 83 session.get(), |
| 79 HttpRequestInfo(), | 84 HttpRequestInfo(), |
| 80 DEFAULT_PRIORITY, | 85 DEFAULT_PRIORITY, |
| 81 SSLConfig(), | 86 SSLConfig(), |
| 82 SSLConfig(), | 87 SSLConfig(), |
| 83 NULL); | 88 NULL); |
| 84 request.AttachJob(job); | 89 request.AttachJob(job); |
| 85 EXPECT_EQ(DEFAULT_PRIORITY, job->priority()); | 90 EXPECT_EQ(DEFAULT_PRIORITY, job->priority()); |
| 86 | 91 |
| 87 request.SetPriority(MEDIUM); | 92 request.SetPriority(MEDIUM); |
| 88 EXPECT_EQ(MEDIUM, job->priority()); | 93 EXPECT_EQ(MEDIUM, job->priority()); |
| 89 | 94 |
| 90 // Make |job| the bound job. | 95 // Make |job| the bound job. |
| 91 request.OnStreamFailed(job, ERR_FAILED, SSLConfig(), SSL_FAILURE_NONE); | 96 request.OnStreamFailed(job, ERR_FAILED, SSLConfig(), SSL_FAILURE_NONE); |
| 92 | 97 |
| 93 request.SetPriority(IDLE); | 98 request.SetPriority(IDLE); |
| 94 EXPECT_EQ(IDLE, job->priority()); | 99 EXPECT_EQ(IDLE, job->priority()); |
| 95 } | 100 } |
| 96 | 101 |
| 97 } // namespace net | 102 } // namespace net |
| OLD | NEW |