| 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 "net/proxy/proxy_info.h" | 7 #include "net/proxy/proxy_info.h" |
| 8 | 8 |
| 9 using ::testing::_; | 9 using ::testing::_; |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 server_ssl_config, | 55 server_ssl_config, |
| 56 proxy_ssl_config, | 56 proxy_ssl_config, |
| 57 destination, | 57 destination, |
| 58 origin_url, | 58 origin_url, |
| 59 alternative_service, | 59 alternative_service, |
| 60 net_log) {} | 60 net_log) {} |
| 61 | 61 |
| 62 MockHttpStreamFactoryImplJob::~MockHttpStreamFactoryImplJob() {} | 62 MockHttpStreamFactoryImplJob::~MockHttpStreamFactoryImplJob() {} |
| 63 | 63 |
| 64 TestJobFactory::TestJobFactory() | 64 TestJobFactory::TestJobFactory() |
| 65 : main_job_(nullptr), alternative_job_(nullptr) {} | 65 : main_job_(nullptr), |
| 66 alternative_job_(nullptr), |
| 67 override_main_job_url_(false) {} |
| 66 | 68 |
| 67 TestJobFactory::~TestJobFactory() {} | 69 TestJobFactory::~TestJobFactory() {} |
| 68 | 70 |
| 69 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( | 71 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( |
| 70 HttpStreamFactoryImpl::Job::Delegate* delegate, | 72 HttpStreamFactoryImpl::Job::Delegate* delegate, |
| 71 HttpStreamFactoryImpl::JobType job_type, | 73 HttpStreamFactoryImpl::JobType job_type, |
| 72 HttpNetworkSession* session, | 74 HttpNetworkSession* session, |
| 73 const HttpRequestInfo& request_info, | 75 const HttpRequestInfo& request_info, |
| 74 RequestPriority priority, | 76 RequestPriority priority, |
| 75 const SSLConfig& server_ssl_config, | 77 const SSLConfig& server_ssl_config, |
| 76 const SSLConfig& proxy_ssl_config, | 78 const SSLConfig& proxy_ssl_config, |
| 77 HostPortPair destination, | 79 HostPortPair destination, |
| 78 GURL origin_url, | 80 GURL origin_url, |
| 79 NetLog* net_log) { | 81 NetLog* net_log) { |
| 80 DCHECK(!main_job_); | 82 DCHECK(!main_job_); |
| 83 |
| 84 if (override_main_job_url_) |
| 85 origin_url = main_job_alternative_url_; |
| 86 |
| 81 main_job_ = new MockHttpStreamFactoryImplJob( | 87 main_job_ = new MockHttpStreamFactoryImplJob( |
| 82 delegate, job_type, session, request_info, priority, SSLConfig(), | 88 delegate, job_type, session, request_info, priority, SSLConfig(), |
| 83 SSLConfig(), destination, origin_url, nullptr); | 89 SSLConfig(), destination, origin_url, nullptr); |
| 84 | 90 |
| 85 EXPECT_CALL(*main_job_, Start(_)).Times(1); | |
| 86 | |
| 87 return main_job_; | 91 return main_job_; |
| 88 } | 92 } |
| 89 | 93 |
| 90 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( | 94 HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( |
| 91 HttpStreamFactoryImpl::Job::Delegate* delegate, | 95 HttpStreamFactoryImpl::Job::Delegate* delegate, |
| 92 HttpStreamFactoryImpl::JobType job_type, | 96 HttpStreamFactoryImpl::JobType job_type, |
| 93 HttpNetworkSession* session, | 97 HttpNetworkSession* session, |
| 94 const HttpRequestInfo& request_info, | 98 const HttpRequestInfo& request_info, |
| 95 RequestPriority priority, | 99 RequestPriority priority, |
| 96 const SSLConfig& server_ssl_config, | 100 const SSLConfig& server_ssl_config, |
| 97 const SSLConfig& proxy_ssl_config, | 101 const SSLConfig& proxy_ssl_config, |
| 98 HostPortPair destination, | 102 HostPortPair destination, |
| 99 GURL origin_url, | 103 GURL origin_url, |
| 100 AlternativeService alternative_service, | 104 AlternativeService alternative_service, |
| 101 NetLog* net_log) { | 105 NetLog* net_log) { |
| 102 DCHECK(!alternative_job_); | 106 DCHECK(!alternative_job_); |
| 103 alternative_job_ = new MockHttpStreamFactoryImplJob( | 107 alternative_job_ = new MockHttpStreamFactoryImplJob( |
| 104 delegate, job_type, session, request_info, priority, SSLConfig(), | 108 delegate, job_type, session, request_info, priority, SSLConfig(), |
| 105 SSLConfig(), destination, origin_url, alternative_service, nullptr); | 109 SSLConfig(), destination, origin_url, alternative_service, nullptr); |
| 106 | 110 |
| 107 EXPECT_CALL(*alternative_job_, Start(_)).Times(1); | |
| 108 | |
| 109 return alternative_job_; | 111 return alternative_job_; |
| 110 } | 112 } |
| 111 | 113 |
| 112 } // namespace net | 114 } // namespace net |
| OLD | NEW |