Chromium Code Reviews| Index: net/http/http_stream_factory_test_util.cc |
| diff --git a/net/http/http_stream_factory_test_util.cc b/net/http/http_stream_factory_test_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d7dc94ee762a91c5090a900d9b0c1f47661e5b90 |
| --- /dev/null |
| +++ b/net/http/http_stream_factory_test_util.cc |
| @@ -0,0 +1,110 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "net/http/http_stream_factory_test_util.h" |
| + |
| +#include "net/proxy/proxy_info.h" |
| + |
| +using ::testing::_; |
| + |
| +namespace net { |
| +TestHttpStreamRequestDelegate::TestHttpStreamRequestDelegate() {} |
| + |
| +TestHttpStreamRequestDelegate::~TestHttpStreamRequestDelegate() {} |
| + |
| +TestJobFactory::TestJobFactory() |
|
Ryan Hamilton
2016/06/06 17:57:31
I think the .h and .cc files are in a different or
Zhongyi Shi
2016/06/06 22:50:56
Done.
|
| + : main_job_(nullptr), alternative_job_(nullptr) {} |
| + |
| +TestJobFactory::~TestJobFactory() {} |
| + |
| +HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( |
| + HttpStreamFactoryImpl::Job::Delegate* delegate, |
| + HttpStreamFactoryImpl::JobType job_type, |
| + HttpNetworkSession* session, |
| + const HttpRequestInfo& request_info, |
| + RequestPriority priority, |
| + const SSLConfig& server_ssl_config, |
| + const SSLConfig& proxy_ssl_config, |
| + HostPortPair destination, |
| + GURL origin_url, |
| + NetLog* net_log) { |
|
Ryan Hamilton
2016/06/06 17:57:32
DCHECK(!main_job_)?
Zhongyi Shi
2016/06/06 22:50:56
Done.
|
| + main_job_ = new TestHttpStreamFactoryImplJob( |
| + delegate, job_type, session, request_info, priority, SSLConfig(), |
| + SSLConfig(), destination, origin_url, nullptr); |
| + |
| + EXPECT_CALL(*main_job_, Start(_)).Times(1); |
| + |
| + return main_job_; |
| +} |
| + |
| +HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob( |
| + HttpStreamFactoryImpl::Job::Delegate* delegate, |
| + HttpStreamFactoryImpl::JobType job_type, |
| + HttpNetworkSession* session, |
| + const HttpRequestInfo& request_info, |
| + RequestPriority priority, |
| + const SSLConfig& server_ssl_config, |
| + const SSLConfig& proxy_ssl_config, |
| + HostPortPair destination, |
| + GURL origin_url, |
| + AlternativeService alternative_service, |
| + NetLog* net_log) { |
| + alternative_job_ = new TestHttpStreamFactoryImplJob( |
|
Ryan Hamilton
2016/06/06 17:57:32
DCHECK(!alternative_job_)?
Zhongyi Shi
2016/06/06 22:50:56
Done.
|
| + delegate, job_type, session, request_info, priority, SSLConfig(), |
| + SSLConfig(), destination, origin_url, alternative_service, nullptr); |
| + |
| + EXPECT_CALL(*alternative_job_, Start(_)).Times(1); |
| + |
| + return alternative_job_; |
| +} |
| + |
| +TestHttpStreamFactoryImplJob::TestHttpStreamFactoryImplJob( |
| + HttpStreamFactoryImpl::Job::Delegate* delegate, |
| + HttpStreamFactoryImpl::JobType job_type, |
| + HttpNetworkSession* session, |
| + const HttpRequestInfo& request_info, |
| + RequestPriority priority, |
| + const SSLConfig& server_ssl_config, |
| + const SSLConfig& proxy_ssl_config, |
| + HostPortPair destination, |
| + GURL origin_url, |
| + NetLog* net_log) |
| + : HttpStreamFactoryImpl::Job(delegate, |
| + job_type, |
| + session, |
| + request_info, |
| + priority, |
| + server_ssl_config, |
| + proxy_ssl_config, |
| + destination, |
| + origin_url, |
| + net_log) {} |
| + |
| +TestHttpStreamFactoryImplJob::TestHttpStreamFactoryImplJob( |
| + HttpStreamFactoryImpl::Job::Delegate* delegate, |
| + HttpStreamFactoryImpl::JobType job_type, |
| + HttpNetworkSession* session, |
| + const HttpRequestInfo& request_info, |
| + RequestPriority priority, |
| + const SSLConfig& server_ssl_config, |
| + const SSLConfig& proxy_ssl_config, |
| + HostPortPair destination, |
| + GURL origin_url, |
| + AlternativeService alternative_service, |
| + NetLog* net_log) |
| + : HttpStreamFactoryImpl::Job(delegate, |
| + job_type, |
| + session, |
| + request_info, |
| + priority, |
| + server_ssl_config, |
| + proxy_ssl_config, |
| + destination, |
| + origin_url, |
| + alternative_service, |
| + net_log) {} |
| + |
| +TestHttpStreamFactoryImplJob::~TestHttpStreamFactoryImplJob() {} |
| + |
| +} // namespace net |