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

Unified Diff: net/http/http_stream_factory_impl_unittest.cc

Issue 2907463002: Split HttpNetworkSession::Params into two structs. (Closed)
Patch Set: Response to comments 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
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.cc ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory_impl_unittest.cc
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc
index f7dc841f150bf1b9661ccaf5058de51f20a3a42e..a994f8f5b6860915e9aea071fc3ad8ea5378887d 100644
--- a/net/http/http_stream_factory_impl_unittest.cc
+++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -713,28 +713,31 @@ TEST_F(HttpStreamFactoryTest, QuicProxyMarkedAsBad) {
proxy_service =
ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT");
- HttpNetworkSession::Params params;
- params.enable_quic = true;
+ HttpNetworkSession::Params session_params;
+ session_params.enable_quic = true;
+
+ HttpNetworkSession::Context session_context;
scoped_refptr<SSLConfigServiceDefaults> ssl_config_service(
new SSLConfigServiceDefaults);
HttpServerPropertiesImpl http_server_properties;
MockClientSocketFactory socket_factory;
- params.client_socket_factory = &socket_factory;
+ session_context.client_socket_factory = &socket_factory;
MockHostResolver host_resolver;
- params.host_resolver = &host_resolver;
+ session_context.host_resolver = &host_resolver;
MockCertVerifier cert_verifier;
- params.cert_verifier = &cert_verifier;
+ session_context.cert_verifier = &cert_verifier;
TransportSecurityState transport_security_state;
- params.transport_security_state = &transport_security_state;
+ session_context.transport_security_state = &transport_security_state;
MultiLogCTVerifier ct_verifier;
- params.cert_transparency_verifier = &ct_verifier;
+ session_context.cert_transparency_verifier = &ct_verifier;
CTPolicyEnforcer ct_policy_enforcer;
- params.ct_policy_enforcer = &ct_policy_enforcer;
- params.proxy_service = proxy_service.get();
- params.ssl_config_service = ssl_config_service.get();
- params.http_server_properties = &http_server_properties;
+ session_context.ct_policy_enforcer = &ct_policy_enforcer;
+ session_context.proxy_service = proxy_service.get();
+ session_context.ssl_config_service = ssl_config_service.get();
+ session_context.http_server_properties = &http_server_properties;
- auto session = base::MakeUnique<HttpNetworkSession>(params);
+ auto session =
+ base::MakeUnique<HttpNetworkSession>(session_params, session_context);
session->quic_stream_factory()->set_require_confirmation(false);
StaticSocketDataProvider socket_data1;
@@ -838,7 +841,8 @@ class MockQuicData {
};
void SetupForQuicAlternativeProxyTest(
- HttpNetworkSession::Params* params,
+ HttpNetworkSession::Params* session_params,
+ HttpNetworkSession::Context* session_context,
MockClientSocketFactory* socket_factory,
ProxyService* proxy_service,
TestProxyDelegate* test_proxy_delegate,
@@ -850,22 +854,23 @@ void SetupForQuicAlternativeProxyTest(
MockHostResolver* host_resolver,
TransportSecurityState* transport_security_state,
bool set_alternative_proxy_server) {
- params->enable_quic = true;
- params->client_socket_factory = socket_factory;
- params->host_resolver = host_resolver;
- params->transport_security_state = transport_security_state;
- params->proxy_service = proxy_service;
- params->ssl_config_service = ssl_config_service;
- params->http_server_properties = http_server_properties;
- params->cert_verifier = cert_verifier;
- params->ct_policy_enforcer = ct_policy_enforcer;
- params->cert_transparency_verifier = ct_verifier;
+ session_params->enable_quic = true;
+
+ session_context->client_socket_factory = socket_factory;
+ session_context->host_resolver = host_resolver;
+ session_context->transport_security_state = transport_security_state;
+ session_context->proxy_service = proxy_service;
+ session_context->ssl_config_service = ssl_config_service;
+ session_context->http_server_properties = http_server_properties;
+ session_context->cert_verifier = cert_verifier;
+ session_context->ct_policy_enforcer = ct_policy_enforcer;
+ session_context->cert_transparency_verifier = ct_verifier;
if (set_alternative_proxy_server) {
test_proxy_delegate->set_alternative_proxy_server(
ProxyServer::FromPacString("QUIC badproxy:99"));
}
- params->proxy_delegate = test_proxy_delegate;
+ session_context->proxy_delegate = test_proxy_delegate;
}
} // namespace
@@ -881,7 +886,8 @@ TEST_F(HttpStreamFactoryTest, WithQUICAlternativeProxyMarkedAsBad) {
for (auto mock_error : quic_proxy_test_mock_errors) {
for (auto set_alternative_proxy_server :
set_alternative_proxy_server_values) {
- HttpNetworkSession::Params params;
+ HttpNetworkSession::Params session_params;
+ HttpNetworkSession::Context session_context;
MockClientSocketFactory socket_factory;
std::unique_ptr<ProxyService> proxy_service =
ProxyService::CreateFixedFromPacResult(
@@ -896,12 +902,14 @@ TEST_F(HttpStreamFactoryTest, WithQUICAlternativeProxyMarkedAsBad) {
MockHostResolver host_resolver;
TransportSecurityState transport_security_state;
SetupForQuicAlternativeProxyTest(
- &params, &socket_factory, proxy_service.get(), &test_proxy_delegate,
- &http_server_properties, &cert_verifier, &ct_policy_enforcer,
- &ct_verifier, ssl_config_service.get(), &host_resolver,
- &transport_security_state, set_alternative_proxy_server);
+ &session_params, &session_context, &socket_factory,
+ proxy_service.get(), &test_proxy_delegate, &http_server_properties,
+ &cert_verifier, &ct_policy_enforcer, &ct_verifier,
+ ssl_config_service.get(), &host_resolver, &transport_security_state,
+ set_alternative_proxy_server);
- auto session = base::MakeUnique<HttpNetworkSession>(params);
+ auto session =
+ base::MakeUnique<HttpNetworkSession>(session_params, session_context);
// Before starting the test, verify that there are no proxies marked as
// bad.
@@ -999,7 +1007,8 @@ TEST_F(HttpStreamFactoryTest, WithQUICAlternativeProxyMarkedAsBad) {
// not marked as bad if only the alternative proxy server job fails.
TEST_F(HttpStreamFactoryTest, WithQUICAlternativeProxyNotMarkedAsBad) {
for (auto mock_error : quic_proxy_test_mock_errors) {
- HttpNetworkSession::Params params;
+ HttpNetworkSession::Params session_params;
+ HttpNetworkSession::Context session_context;
MockClientSocketFactory socket_factory;
std::unique_ptr<ProxyService> proxy_service =
ProxyService::CreateFixedFromPacResult("HTTPS badproxy:99; DIRECT");
@@ -1015,13 +1024,14 @@ TEST_F(HttpStreamFactoryTest, WithQUICAlternativeProxyNotMarkedAsBad) {
TransportSecurityState transport_security_state;
SetupForQuicAlternativeProxyTest(
- &params, &socket_factory, proxy_service.get(), &test_proxy_delegate,
- &http_server_properties, &cert_verifier, &ct_policy_enforcer,
- &ct_verifier, ssl_config_service.get(), &host_resolver,
- &transport_security_state, true);
+ &session_params, &session_context, &socket_factory, proxy_service.get(),
+ &test_proxy_delegate, &http_server_properties, &cert_verifier,
+ &ct_policy_enforcer, &ct_verifier, ssl_config_service.get(),
+ &host_resolver, &transport_security_state, true);
HostPortPair host_port_pair("badproxy", 99);
- auto session = base::MakeUnique<HttpNetworkSession>(params);
+ auto session =
+ base::MakeUnique<HttpNetworkSession>(session_params, session_context);
// Before starting the test, verify that there are no proxies marked as
// bad.
@@ -1113,12 +1123,16 @@ TEST_F(HttpStreamFactoryTest, UsePreConnectIfNoZeroRTT) {
ProxyService::CreateFixed("http_proxy"));
// Setup params to disable preconnect, but QUIC doesn't 0RTT.
- HttpNetworkSession::Params params =
+ HttpNetworkSession::Params session_params =
SpdySessionDependencies::CreateSessionParams(&session_deps);
- params.enable_quic = true;
- params.http_server_properties = &http_server_properties;
+ session_params.enable_quic = true;
+
+ HttpNetworkSession::Context session_context =
+ SpdySessionDependencies::CreateSessionContext(&session_deps);
+ session_context.http_server_properties = &http_server_properties;
- auto session = base::MakeUnique<HttpNetworkSession>(params);
+ auto session =
+ base::MakeUnique<HttpNetworkSession>(session_params, session_context);
HttpNetworkSessionPeer peer(session.get());
HostPortPair proxy_host("http_proxy", 80);
CapturePreconnectsHttpProxySocketPool* http_proxy_pool =
@@ -1162,13 +1176,17 @@ TEST_F(HttpStreamFactoryTest, OnlyOnePreconnectToProxyServer) {
}
SpdySessionDependencies session_deps;
- HttpNetworkSession::Params params =
+ HttpNetworkSession::Params session_params =
SpdySessionDependencies::CreateSessionParams(&session_deps);
- params.enable_quic = true;
- params.proxy_service = proxy_service.get();
- params.http_server_properties = &http_server_properties;
+ session_params.enable_quic = true;
- auto session = base::MakeUnique<HttpNetworkSession>(params);
+ HttpNetworkSession::Context session_context =
+ SpdySessionDependencies::CreateSessionContext(&session_deps);
+ session_context.proxy_service = proxy_service.get();
+ session_context.http_server_properties = &http_server_properties;
+
+ auto session =
+ base::MakeUnique<HttpNetworkSession>(session_params, session_context);
HttpNetworkSessionPeer peer(session.get());
HostPortPair proxy_host("myproxy.org", 443);
@@ -1250,13 +1268,17 @@ TEST_F(HttpStreamFactoryTest, ProxyServerPreconnectDifferentPrivacyModes) {
http_server_properties.SetSupportsSpdy(spdy_server, true);
SpdySessionDependencies session_deps;
- HttpNetworkSession::Params params =
+ HttpNetworkSession::Params session_params =
SpdySessionDependencies::CreateSessionParams(&session_deps);
- params.enable_quic = true;
- params.proxy_service = proxy_service.get();
- params.http_server_properties = &http_server_properties;
+ session_params.enable_quic = true;
+
+ HttpNetworkSession::Context session_context =
+ SpdySessionDependencies::CreateSessionContext(&session_deps);
+ session_context.proxy_service = proxy_service.get();
+ session_context.http_server_properties = &http_server_properties;
- auto session = base::MakeUnique<HttpNetworkSession>(params);
+ auto session =
+ base::MakeUnique<HttpNetworkSession>(session_params, session_context);
HttpNetworkSessionPeer peer(session.get());
HostPortPair proxy_host("myproxy.org", 443);
@@ -2152,9 +2174,12 @@ class HttpStreamFactoryBidirectionalQuicTest
void Initialize() {
params_.enable_quic = true;
- params_.http_server_properties = &http_server_properties_;
- params_.quic_random = &random_generator_;
- params_.quic_clock = &clock_;
+ params_.quic_supported_versions = test::SupportedVersions(GetParam());
+
+ HttpNetworkSession::Context session_context;
+ session_context.http_server_properties = &http_server_properties_;
+ session_context.quic_random = &random_generator_;
+ session_context.quic_clock = &clock_;
// Load a certificate that is valid for *.example.org
scoped_refptr<X509Certificate> test_cert(
@@ -2165,17 +2190,17 @@ class HttpStreamFactoryBidirectionalQuicTest
crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details_);
crypto_client_stream_factory_.set_handshake_mode(
MockCryptoClientStream::CONFIRM_HANDSHAKE);
- params_.cert_verifier = &cert_verifier_;
- params_.quic_crypto_client_stream_factory = &crypto_client_stream_factory_;
- params_.quic_supported_versions = test::SupportedVersions(GetParam());
- params_.transport_security_state = &transport_security_state_;
- params_.cert_transparency_verifier = &ct_verifier_;
- params_.ct_policy_enforcer = &ct_policy_enforcer_;
- params_.host_resolver = &host_resolver_;
- params_.proxy_service = proxy_service_.get();
- params_.ssl_config_service = ssl_config_service_.get();
- params_.client_socket_factory = &socket_factory_;
- session_ = base::MakeUnique<HttpNetworkSession>(params_);
+ session_context.cert_verifier = &cert_verifier_;
+ session_context.quic_crypto_client_stream_factory =
+ &crypto_client_stream_factory_;
+ session_context.transport_security_state = &transport_security_state_;
+ session_context.cert_transparency_verifier = &ct_verifier_;
+ session_context.ct_policy_enforcer = &ct_policy_enforcer_;
+ session_context.host_resolver = &host_resolver_;
+ session_context.proxy_service = proxy_service_.get();
+ session_context.ssl_config_service = ssl_config_service_.get();
+ session_context.client_socket_factory = &socket_factory_;
+ session_.reset(new HttpNetworkSession(params_, session_context));
session_->quic_stream_factory()->set_require_confirmation(false);
}
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.cc ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698