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 OnBidirectionalStreamJobReady(const SSLConfig& used_ssl_config, | |
39 const ProxyInfo& used_proxy_info, | |
40 BidirectionalStreamJob* stream) override {} | |
mef
2015/12/21 23:21:31
stream -> stream_job?
xunjieli
2015/12/22 02:58:49
Done.
| |
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 17 matching lines...) Expand all Loading... | |
65 SpdySessionDependencies session_deps(GetParam(), | 69 SpdySessionDependencies session_deps(GetParam(), |
66 ProxyService::CreateDirect()); | 70 ProxyService::CreateDirect()); |
67 | 71 |
68 scoped_ptr<HttpNetworkSession> session = | 72 scoped_ptr<HttpNetworkSession> session = |
69 SpdySessionDependencies::SpdyCreateSession(&session_deps); | 73 SpdySessionDependencies::SpdyCreateSession(&session_deps); |
70 HttpStreamFactoryImpl* factory = | 74 HttpStreamFactoryImpl* factory = |
71 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory()); | 75 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory()); |
72 | 76 |
73 DoNothingRequestDelegate request_delegate; | 77 DoNothingRequestDelegate request_delegate; |
74 HttpStreamFactoryImpl::Request request( | 78 HttpStreamFactoryImpl::Request request( |
75 GURL(), factory, &request_delegate, NULL, BoundNetLog()); | 79 GURL(), factory, &request_delegate, NULL, BoundNetLog(), |
80 HttpStreamFactoryImpl::Request::HTTP_STREAM); | |
76 | 81 |
77 HttpStreamFactoryImpl::Job* job = | 82 HttpStreamFactoryImpl::Job* job = |
78 new HttpStreamFactoryImpl::Job(factory, | 83 new HttpStreamFactoryImpl::Job(factory, |
79 session.get(), | 84 session.get(), |
80 HttpRequestInfo(), | 85 HttpRequestInfo(), |
81 DEFAULT_PRIORITY, | 86 DEFAULT_PRIORITY, |
82 SSLConfig(), | 87 SSLConfig(), |
83 SSLConfig(), | 88 SSLConfig(), |
84 NULL); | 89 NULL); |
85 request.AttachJob(job); | 90 request.AttachJob(job); |
86 EXPECT_EQ(DEFAULT_PRIORITY, job->priority()); | 91 EXPECT_EQ(DEFAULT_PRIORITY, job->priority()); |
87 | 92 |
88 request.SetPriority(MEDIUM); | 93 request.SetPriority(MEDIUM); |
89 EXPECT_EQ(MEDIUM, job->priority()); | 94 EXPECT_EQ(MEDIUM, job->priority()); |
90 | 95 |
91 // Make |job| the bound job. | 96 // Make |job| the bound job. |
92 request.OnStreamFailed(job, ERR_FAILED, SSLConfig(), SSL_FAILURE_NONE); | 97 request.OnStreamFailed(job, ERR_FAILED, SSLConfig(), SSL_FAILURE_NONE); |
93 | 98 |
94 request.SetPriority(IDLE); | 99 request.SetPriority(IDLE); |
95 EXPECT_EQ(IDLE, job->priority()); | 100 EXPECT_EQ(IDLE, job->priority()); |
96 } | 101 } |
97 | 102 |
98 } // namespace net | 103 } // namespace net |
OLD | NEW |