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

Unified Diff: net/http/http_stream_factory_test_util.cc

Issue 2895263003: Revert CLs landed in HttpStreamFactoryImpl to track down a crasher (Closed)
Patch Set: Revert "Fix SpdySessionKey for HTTP/2 alternative Jobs." Created 3 years, 7 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
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 2c8fc625ef7eec1c7992f7f9b5c9135b45012c85..55fb736e568db1042749cc56fb1a205976fb62f4 100644
--- a/net/http/http_stream_factory_test_util.cc
+++ b/net/http/http_stream_factory_test_util.cc
@@ -4,8 +4,6 @@
#include "net/http/http_stream_factory_test_util.h"
-#include <utility>
-
#include "net/proxy/proxy_info.h"
using ::testing::_;
@@ -21,7 +19,6 @@ 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,
@@ -33,7 +30,6 @@ MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
session,
request_info,
priority,
- proxy_info,
server_ssl_config,
proxy_ssl_config,
destination,
@@ -49,7 +45,6 @@ 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,
@@ -63,7 +58,6 @@ MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
session,
request_info,
priority,
- proxy_info,
server_ssl_config,
proxy_ssl_config,
destination,
@@ -82,40 +76,36 @@ TestJobFactory::TestJobFactory()
TestJobFactory::~TestJobFactory() {}
-std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateMainJob(
+HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
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_;
- 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();
+ main_job_ = new MockHttpStreamFactoryImplJob(
+ delegate, job_type, session, request_info, priority, SSLConfig(),
+ SSLConfig(), destination, origin_url, enable_ip_based_pooling, nullptr);
- return std::move(main_job);
+ return main_job_;
}
-std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltSvcJob(
+HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
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,
@@ -123,24 +113,21 @@ std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltSvcJob(
AlternativeService alternative_service,
bool enable_ip_based_pooling,
NetLog* net_log) {
- 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();
+ 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);
- return std::move(alternative_job);
+ return alternative_job_;
}
-std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltProxyJob(
+HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
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,
@@ -148,15 +135,13 @@ std::unique_ptr<HttpStreamFactoryImpl::Job> TestJobFactory::CreateAltProxyJob(
const ProxyServer& alternative_proxy_server,
bool enable_ip_based_pooling,
NetLog* net_log) {
- auto alternative_job = base::MakeUnique<MockHttpStreamFactoryImplJob>(
- delegate, job_type, session, request_info, priority, proxy_info,
- SSLConfig(), SSLConfig(), destination, origin_url, AlternativeService(),
+ DCHECK(!alternative_job_);
+ alternative_job_ = new MockHttpStreamFactoryImplJob(
+ delegate, job_type, session, request_info, priority, SSLConfig(),
+ SSLConfig(), destination, origin_url, AlternativeService(),
alternative_proxy_server, enable_ip_based_pooling, nullptr);
- // Keep raw pointer to Job but pass ownership.
- alternative_job_ = alternative_job.get();
-
- return std::move(alternative_job);
+ return alternative_job_;
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698