| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_test_util.h" | 5 #include "net/http/http_stream_factory_test_util.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "net/proxy/proxy_info.h" | 9 #include "net/proxy/proxy_info.h" |
| 10 | 10 |
| 11 using ::testing::_; | 11 using ::testing::_; |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 MockHttpStreamRequestDelegate::MockHttpStreamRequestDelegate() {} | 14 MockHttpStreamRequestDelegate::MockHttpStreamRequestDelegate() {} |
| 15 | 15 |
| 16 MockHttpStreamRequestDelegate::~MockHttpStreamRequestDelegate() {} | 16 MockHttpStreamRequestDelegate::~MockHttpStreamRequestDelegate() {} |
| 17 | 17 |
| 18 MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob( | 18 MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob( |
| 19 HttpStreamFactoryImpl::Job::Delegate* delegate, | 19 HttpStreamFactoryImpl::Job::Delegate* delegate, |
| 20 HttpStreamFactoryImpl::JobType job_type, | 20 HttpStreamFactoryImpl::JobType job_type, |
| 21 HttpNetworkSession* session, | 21 HttpNetworkSession* session, |
| 22 const HttpRequestInfo& request_info, | 22 const HttpRequestInfo& request_info, |
| 23 RequestPriority priority, | 23 RequestPriority priority, |
| 24 ProxyInfo proxy_info, | 24 ProxyInfo proxy_info, |
| 25 const SSLConfig& server_ssl_config, | 25 const SSLConfig& server_ssl_config, |
| 26 const SSLConfig& proxy_ssl_config, | 26 const SSLConfig& proxy_ssl_config, |
| 27 HostPortPair destination, | 27 HostPortPair destination, |
| 28 GURL origin_url, | 28 GURL origin_url, |
| 29 NextProto alternative_protocol, | 29 NextProto alternative_protocol, |
| 30 QuicVersion quic_version, |
| 30 const ProxyServer& alternative_proxy_server, | 31 const ProxyServer& alternative_proxy_server, |
| 31 bool enable_ip_based_pooling, | 32 bool enable_ip_based_pooling, |
| 32 NetLog* net_log) | 33 NetLog* net_log) |
| 33 : HttpStreamFactoryImpl::Job(delegate, | 34 : HttpStreamFactoryImpl::Job(delegate, |
| 34 job_type, | 35 job_type, |
| 35 session, | 36 session, |
| 36 request_info, | 37 request_info, |
| 37 priority, | 38 priority, |
| 38 proxy_info, | 39 proxy_info, |
| 39 server_ssl_config, | 40 server_ssl_config, |
| 40 proxy_ssl_config, | 41 proxy_ssl_config, |
| 41 destination, | 42 destination, |
| 42 origin_url, | 43 origin_url, |
| 43 alternative_protocol, | 44 alternative_protocol, |
| 45 quic_version, |
| 44 alternative_proxy_server, | 46 alternative_proxy_server, |
| 45 enable_ip_based_pooling, | 47 enable_ip_based_pooling, |
| 46 net_log) { | 48 net_log) { |
| 47 DCHECK(!is_waiting()); | 49 DCHECK(!is_waiting()); |
| 48 } | 50 } |
| 49 | 51 |
| 50 MockHttpStreamFactoryImplJob::~MockHttpStreamFactoryImplJob() {} | 52 MockHttpStreamFactoryImplJob::~MockHttpStreamFactoryImplJob() {} |
| 51 | 53 |
| 52 TestJobFactory::TestJobFactory() | 54 TestJobFactory::TestJobFactory() |
| 53 : main_job_(nullptr), | 55 : main_job_(nullptr), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 68 HostPortPair destination, | 70 HostPortPair destination, |
| 69 GURL origin_url, | 71 GURL origin_url, |
| 70 bool enable_ip_based_pooling, | 72 bool enable_ip_based_pooling, |
| 71 NetLog* net_log) { | 73 NetLog* net_log) { |
| 72 if (override_main_job_url_) | 74 if (override_main_job_url_) |
| 73 origin_url = main_job_alternative_url_; | 75 origin_url = main_job_alternative_url_; |
| 74 | 76 |
| 75 auto main_job = base::MakeUnique<MockHttpStreamFactoryImplJob>( | 77 auto main_job = base::MakeUnique<MockHttpStreamFactoryImplJob>( |
| 76 delegate, job_type, session, request_info, priority, proxy_info, | 78 delegate, job_type, session, request_info, priority, proxy_info, |
| 77 SSLConfig(), SSLConfig(), destination, origin_url, kProtoUnknown, | 79 SSLConfig(), SSLConfig(), destination, origin_url, kProtoUnknown, |
| 78 ProxyServer(), enable_ip_based_pooling, net_log); | 80 QUIC_VERSION_UNSUPPORTED, ProxyServer(), enable_ip_based_pooling, |
| 81 net_log); |
| 79 | 82 |
| 80 // Keep raw pointer to Job but pass ownership. | 83 // Keep raw pointer to Job but pass ownership. |
| 81 main_job_ = main_job.get(); | 84 main_job_ = main_job.get(); |
| 82 | 85 |
| 83 return std::move(main_job); | 86 return std::move(main_job); |
| 84 } | 87 } |
| 85 | 88 |
| 86 std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltSvcJob( | 89 std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltSvcJob( |
| 87 HttpStreamFactoryImpl::Job::Delegate* delegate, | 90 HttpStreamFactoryImpl::Job::Delegate* delegate, |
| 88 HttpStreamFactoryImpl::JobType job_type, | 91 HttpStreamFactoryImpl::JobType job_type, |
| 89 HttpNetworkSession* session, | 92 HttpNetworkSession* session, |
| 90 const HttpRequestInfo& request_info, | 93 const HttpRequestInfo& request_info, |
| 91 RequestPriority priority, | 94 RequestPriority priority, |
| 92 const ProxyInfo& proxy_info, | 95 const ProxyInfo& proxy_info, |
| 93 const SSLConfig& server_ssl_config, | 96 const SSLConfig& server_ssl_config, |
| 94 const SSLConfig& proxy_ssl_config, | 97 const SSLConfig& proxy_ssl_config, |
| 95 HostPortPair destination, | 98 HostPortPair destination, |
| 96 GURL origin_url, | 99 GURL origin_url, |
| 97 NextProto alternative_protocol, | 100 NextProto alternative_protocol, |
| 101 QuicVersion quic_version, |
| 98 bool enable_ip_based_pooling, | 102 bool enable_ip_based_pooling, |
| 99 NetLog* net_log) { | 103 NetLog* net_log) { |
| 100 auto alternative_job = base::MakeUnique<MockHttpStreamFactoryImplJob>( | 104 auto alternative_job = base::MakeUnique<MockHttpStreamFactoryImplJob>( |
| 101 delegate, job_type, session, request_info, priority, proxy_info, | 105 delegate, job_type, session, request_info, priority, proxy_info, |
| 102 SSLConfig(), SSLConfig(), destination, origin_url, alternative_protocol, | 106 SSLConfig(), SSLConfig(), destination, origin_url, alternative_protocol, |
| 103 ProxyServer(), enable_ip_based_pooling, net_log); | 107 quic_version, ProxyServer(), enable_ip_based_pooling, net_log); |
| 104 | 108 |
| 105 // Keep raw pointer to Job but pass ownership. | 109 // Keep raw pointer to Job but pass ownership. |
| 106 alternative_job_ = alternative_job.get(); | 110 alternative_job_ = alternative_job.get(); |
| 107 | 111 |
| 108 return std::move(alternative_job); | 112 return std::move(alternative_job); |
| 109 } | 113 } |
| 110 | 114 |
| 111 std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltProxyJob( | 115 std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltProxyJob( |
| 112 HttpStreamFactoryImpl::Job::Delegate* delegate, | 116 HttpStreamFactoryImpl::Job::Delegate* delegate, |
| 113 HttpStreamFactoryImpl::JobType job_type, | 117 HttpStreamFactoryImpl::JobType job_type, |
| 114 HttpNetworkSession* session, | 118 HttpNetworkSession* session, |
| 115 const HttpRequestInfo& request_info, | 119 const HttpRequestInfo& request_info, |
| 116 RequestPriority priority, | 120 RequestPriority priority, |
| 117 const ProxyInfo& proxy_info, | 121 const ProxyInfo& proxy_info, |
| 118 const SSLConfig& server_ssl_config, | 122 const SSLConfig& server_ssl_config, |
| 119 const SSLConfig& proxy_ssl_config, | 123 const SSLConfig& proxy_ssl_config, |
| 120 HostPortPair destination, | 124 HostPortPair destination, |
| 121 GURL origin_url, | 125 GURL origin_url, |
| 122 const ProxyServer& alternative_proxy_server, | 126 const ProxyServer& alternative_proxy_server, |
| 123 bool enable_ip_based_pooling, | 127 bool enable_ip_based_pooling, |
| 124 NetLog* net_log) { | 128 NetLog* net_log) { |
| 125 auto alternative_job = base::MakeUnique<MockHttpStreamFactoryImplJob>( | 129 auto alternative_job = base::MakeUnique<MockHttpStreamFactoryImplJob>( |
| 126 delegate, job_type, session, request_info, priority, proxy_info, | 130 delegate, job_type, session, request_info, priority, proxy_info, |
| 127 SSLConfig(), SSLConfig(), destination, origin_url, kProtoUnknown, | 131 SSLConfig(), SSLConfig(), destination, origin_url, kProtoUnknown, |
| 128 alternative_proxy_server, enable_ip_based_pooling, net_log); | 132 QUIC_VERSION_UNSUPPORTED, alternative_proxy_server, |
| 133 enable_ip_based_pooling, net_log); |
| 129 | 134 |
| 130 // Keep raw pointer to Job but pass ownership. | 135 // Keep raw pointer to Job but pass ownership. |
| 131 alternative_job_ = alternative_job.get(); | 136 alternative_job_ = alternative_job.get(); |
| 132 | 137 |
| 133 return std::move(alternative_job); | 138 return std::move(alternative_job); |
| 134 } | 139 } |
| 135 | 140 |
| 136 } // namespace net | 141 } // namespace net |
| OLD | NEW |