Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1690)

Unified Diff: net/http/http_stream_factory_test_util.cc

Issue 2910463004: Revert "Revert CLs landed in HttpStreamFactoryImpl to track down a crasher" (Closed)
Patch Set: rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_stream_factory_test_util.h ('k') | net/spdy/chromium/spdy_test_util_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 55fb736e568db1042749cc56fb1a205976fb62f4..2c8fc625ef7eec1c7992f7f9b5c9135b45012c85 100644
--- a/net/http/http_stream_factory_test_util.cc
+++ b/net/http/http_stream_factory_test_util.cc
@@ -4,6 +4,8 @@
#include "net/http/http_stream_factory_test_util.h"
+#include <utility>
+
#include "net/proxy/proxy_info.h"
using ::testing::_;
@@ -19,6 +21,7 @@ MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
HttpNetworkSession* session,
const HttpRequestInfo& request_info,
RequestPriority priority,
+ ProxyInfo proxy_info,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HostPortPair destination,
@@ -30,6 +33,7 @@ MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
session,
request_info,
priority,
+ proxy_info,
server_ssl_config,
proxy_ssl_config,
destination,
@@ -45,6 +49,7 @@ MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
HttpNetworkSession* session,
const HttpRequestInfo& request_info,
RequestPriority priority,
+ ProxyInfo proxy_info,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HostPortPair destination,
@@ -58,6 +63,7 @@ MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
session,
request_info,
priority,
+ proxy_info,
server_ssl_config,
proxy_ssl_config,
destination,
@@ -76,36 +82,40 @@ TestJobFactory::TestJobFactory()
TestJobFactory::~TestJobFactory() {}
-HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
+std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateMainJob(
HttpStreamFactoryImpl::Job::Delegate* delegate,
HttpStreamFactoryImpl::JobType job_type,
HttpNetworkSession* session,
const HttpRequestInfo& request_info,
RequestPriority priority,
+ const ProxyInfo& proxy_info,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HostPortPair destination,
GURL origin_url,
bool enable_ip_based_pooling,
NetLog* net_log) {
- DCHECK(!main_job_);
-
if (override_main_job_url_)
origin_url = main_job_alternative_url_;
- main_job_ = new MockHttpStreamFactoryImplJob(
- delegate, job_type, session, request_info, priority, SSLConfig(),
- SSLConfig(), destination, origin_url, enable_ip_based_pooling, nullptr);
+ auto main_job = base::MakeUnique<MockHttpStreamFactoryImplJob>(
+ delegate, job_type, session, request_info, priority, proxy_info,
+ SSLConfig(), SSLConfig(), destination, origin_url,
+ enable_ip_based_pooling, nullptr);
+
+ // Keep raw pointer to Job but pass ownership.
+ main_job_ = main_job.get();
- return main_job_;
+ return std::move(main_job);
}
-HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
+std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltSvcJob(
HttpStreamFactoryImpl::Job::Delegate* delegate,
HttpStreamFactoryImpl::JobType job_type,
HttpNetworkSession* session,
const HttpRequestInfo& request_info,
RequestPriority priority,
+ const ProxyInfo& proxy_info,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HostPortPair destination,
@@ -113,21 +123,24 @@ HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
AlternativeService alternative_service,
bool enable_ip_based_pooling,
NetLog* net_log) {
- DCHECK(!alternative_job_);
- alternative_job_ = new MockHttpStreamFactoryImplJob(
- delegate, job_type, session, request_info, priority, SSLConfig(),
- SSLConfig(), destination, origin_url, alternative_service, ProxyServer(),
- enable_ip_based_pooling, nullptr);
+ auto alternative_job = base::MakeUnique<MockHttpStreamFactoryImplJob>(
+ delegate, job_type, session, request_info, priority, proxy_info,
+ SSLConfig(), SSLConfig(), destination, origin_url, alternative_service,
+ ProxyServer(), enable_ip_based_pooling, nullptr);
+
+ // Keep raw pointer to Job but pass ownership.
+ alternative_job_ = alternative_job.get();
- return alternative_job_;
+ return std::move(alternative_job);
}
-HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
+std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltProxyJob(
HttpStreamFactoryImpl::Job::Delegate* delegate,
HttpStreamFactoryImpl::JobType job_type,
HttpNetworkSession* session,
const HttpRequestInfo& request_info,
RequestPriority priority,
+ const ProxyInfo& proxy_info,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HostPortPair destination,
@@ -135,13 +148,15 @@ HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
const ProxyServer& alternative_proxy_server,
bool enable_ip_based_pooling,
NetLog* net_log) {
- DCHECK(!alternative_job_);
- alternative_job_ = new MockHttpStreamFactoryImplJob(
- delegate, job_type, session, request_info, priority, SSLConfig(),
- SSLConfig(), destination, origin_url, AlternativeService(),
+ auto alternative_job = base::MakeUnique<MockHttpStreamFactoryImplJob>(
+ delegate, job_type, session, request_info, priority, proxy_info,
+ SSLConfig(), SSLConfig(), destination, origin_url, AlternativeService(),
alternative_proxy_server, enable_ip_based_pooling, nullptr);
- return alternative_job_;
+ // Keep raw pointer to Job but pass ownership.
+ alternative_job_ = alternative_job.get();
+
+ return std::move(alternative_job);
}
} // namespace net
« no previous file with comments | « net/http/http_stream_factory_test_util.h ('k') | net/spdy/chromium/spdy_test_util_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698