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

Unified Diff: net/quic/chromium/quic_network_transaction_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/quic/chromium/quic_end_to_end_unittest.cc ('k') | net/socket/client_socket_pool_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/chromium/quic_network_transaction_unittest.cc
diff --git a/net/quic/chromium/quic_network_transaction_unittest.cc b/net/quic/chromium/quic_network_transaction_unittest.cc
index 570bfaadf04f5737aebaffc83b26b177ce18c660..1762682fa086d5013c3b15d4c7c7ac23c9d8146a 100644
--- a/net/quic/chromium/quic_network_transaction_unittest.cc
+++ b/net/quic/chromium/quic_network_transaction_unittest.cc
@@ -500,26 +500,29 @@ class QuicNetworkTransactionTest
}
void CreateSession() {
- params_.enable_quic = true;
- params_.quic_clock = &clock_;
- params_.quic_random = &random_generator_;
- params_.client_socket_factory = &socket_factory_;
- params_.quic_crypto_client_stream_factory = &crypto_client_stream_factory_;
- params_.host_resolver = &host_resolver_;
- params_.cert_verifier = &cert_verifier_;
- params_.transport_security_state = &transport_security_state_;
- params_.cert_transparency_verifier = cert_transparency_verifier_.get();
- params_.ct_policy_enforcer = &ct_policy_enforcer_;
- params_.socket_performance_watcher_factory =
+ session_params_.enable_quic = true;
+ session_params_.quic_supported_versions = SupportedVersions(version_);
+
+ session_context_.quic_clock = &clock_;
+ session_context_.quic_random = &random_generator_;
+ session_context_.client_socket_factory = &socket_factory_;
+ session_context_.quic_crypto_client_stream_factory =
+ &crypto_client_stream_factory_;
+ session_context_.host_resolver = &host_resolver_;
+ session_context_.cert_verifier = &cert_verifier_;
+ session_context_.transport_security_state = &transport_security_state_;
+ session_context_.cert_transparency_verifier =
+ cert_transparency_verifier_.get();
+ session_context_.ct_policy_enforcer = &ct_policy_enforcer_;
+ session_context_.socket_performance_watcher_factory =
&test_socket_performance_watcher_factory_;
- params_.proxy_service = proxy_service_.get();
- params_.ssl_config_service = ssl_config_service_.get();
- params_.http_auth_handler_factory = auth_handler_factory_.get();
- params_.http_server_properties = &http_server_properties_;
- params_.quic_supported_versions = SupportedVersions(version_);
- params_.net_log = net_log_.bound().net_log();
-
- session_.reset(new HttpNetworkSession(params_));
+ session_context_.proxy_service = proxy_service_.get();
+ session_context_.ssl_config_service = ssl_config_service_.get();
+ session_context_.http_auth_handler_factory = auth_handler_factory_.get();
+ session_context_.http_server_properties = &http_server_properties_;
+ session_context_.net_log = net_log_.bound().net_log();
+
+ session_.reset(new HttpNetworkSession(session_params_, session_context_));
session_->quic_stream_factory()->set_require_confirmation(false);
}
@@ -697,7 +700,7 @@ class QuicNetworkTransactionTest
test_proxy_delegate.set_alternative_proxy_server(
ProxyServer::FromPacString("QUIC myproxy.org:443"));
- params_.proxy_delegate = &test_proxy_delegate;
+ session_context_.proxy_delegate = &test_proxy_delegate;
proxy_service_ =
ProxyService::CreateFixedFromPacResult("HTTPS myproxy.org:443");
@@ -747,7 +750,8 @@ class QuicNetworkTransactionTest
std::unique_ptr<HttpAuthHandlerFactory> auth_handler_factory_;
MockRandom random_generator_;
HttpServerPropertiesImpl http_server_properties_;
- HttpNetworkSession::Params params_;
+ HttpNetworkSession::Params session_params_;
+ HttpNetworkSession::Context session_context_;
HttpRequestInfo request_;
BoundTestNetLog net_log_;
std::vector<std::unique_ptr<StaticSocketDataProvider>> hanging_data_;
@@ -781,7 +785,7 @@ INSTANTIATE_TEST_CASE_P(Version,
::testing::ValuesIn(AllSupportedVersions()));
TEST_P(QuicNetworkTransactionTest, SocketWatcherEnabled) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -812,7 +816,7 @@ TEST_P(QuicNetworkTransactionTest, SocketWatcherEnabled) {
}
TEST_P(QuicNetworkTransactionTest, SocketWatcherDisabled) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -843,7 +847,7 @@ TEST_P(QuicNetworkTransactionTest, SocketWatcherDisabled) {
}
TEST_P(QuicNetworkTransactionTest, ForceQuic) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -907,7 +911,7 @@ TEST_P(QuicNetworkTransactionTest, ForceQuic) {
}
TEST_P(QuicNetworkTransactionTest, LargeResponseHeaders) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -957,7 +961,7 @@ TEST_P(QuicNetworkTransactionTest, LargeResponseHeaders) {
}
TEST_P(QuicNetworkTransactionTest, TooLargeResponseHeaders) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -1013,7 +1017,7 @@ TEST_P(QuicNetworkTransactionTest, TooLargeResponseHeaders) {
}
TEST_P(QuicNetworkTransactionTest, ForceQuicForAll) {
- params_.origins_to_force_quic_on.insert(HostPortPair());
+ session_params_.origins_to_force_quic_on.insert(HostPortPair());
AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE);
@@ -1042,7 +1046,7 @@ TEST_P(QuicNetworkTransactionTest, ForceQuicForAll) {
}
TEST_P(QuicNetworkTransactionTest, QuicProxy) {
- params_.enable_quic = true;
+ session_params_.enable_quic = true;
proxy_service_ =
ProxyService::CreateFixedFromPacResult("QUIC mail.example.org:70");
@@ -1084,7 +1088,7 @@ TEST_P(QuicNetworkTransactionTest, QuicProxyWithCert) {
const std::string origin_host = "mail.example.com";
const std::string proxy_host = "www.example.org";
- params_.enable_quic = true;
+ session_params_.enable_quic = true;
proxy_service_ =
ProxyService::CreateFixedFromPacResult("QUIC " + proxy_host + ":70");
@@ -1249,7 +1253,7 @@ TEST_P(QuicNetworkTransactionTest, RetryMisdirectedRequest) {
}
TEST_P(QuicNetworkTransactionTest, ForceQuicWithErrorConnecting) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data1;
@@ -1283,7 +1287,7 @@ TEST_P(QuicNetworkTransactionTest, ForceQuicWithErrorConnecting) {
TEST_P(QuicNetworkTransactionTest, DoNotForceQuicForHttps) {
// Attempt to "force" quic on 443, which will not be honored.
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("www.google.com:443"));
MockRead http_reads[] = {
@@ -1552,7 +1556,7 @@ TEST_P(QuicNetworkTransactionTest, GoAwayWithConnectionMigrationOnPortsOnly) {
// Verify that if a QUIC connection times out, the QuicHttpStream will
// return QUIC_PROTOCOL_ERROR.
TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmed) {
- params_.quic_idle_connection_timeout_seconds = 5;
+ session_params_.quic_idle_connection_timeout_seconds = 5;
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -1642,7 +1646,7 @@ TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmed) {
// Verify that if a QUIC connection RTOs, the QuicHttpStream will
// return QUIC_PROTOCOL_ERROR.
TEST_P(QuicNetworkTransactionTest, TooManyRtosAfterHandshakeConfirmed) {
- params_.quic_connection_options.push_back(k5RTO);
+ session_params_.quic_connection_options.push_back(k5RTO);
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -1741,7 +1745,7 @@ TEST_P(QuicNetworkTransactionTest, TooManyRtosAfterHandshakeConfirmed) {
// QUIC will not be marked as broken.
TEST_P(QuicNetworkTransactionTest,
TooManyRtosAfterHandshakeConfirmedAndStreamReset) {
- params_.quic_connection_options.push_back(k5RTO);
+ session_params_.quic_connection_options.push_back(k5RTO);
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -1908,8 +1912,8 @@ TEST_P(QuicNetworkTransactionTest, ProtocolErrorAfterHandshakeConfirmed) {
// connection times out, then QUIC will be marked as broken and the request
// retried over TCP.
TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmedThenBroken) {
- params_.mark_quic_broken_when_network_blackholes = true;
- params_.quic_idle_connection_timeout_seconds = 5;
+ session_params_.mark_quic_broken_when_network_blackholes = true;
+ session_params_.quic_idle_connection_timeout_seconds = 5;
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -2025,8 +2029,8 @@ TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmedThenBroken) {
// connection times out, then QUIC will be marked as broken and the request
// retried over TCP.
TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmedThenBroken2) {
- params_.retry_without_alt_svc_on_quic_errors = true;
- params_.quic_idle_connection_timeout_seconds = 5;
+ session_params_.retry_without_alt_svc_on_quic_errors = true;
+ session_params_.quic_idle_connection_timeout_seconds = 5;
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -2145,8 +2149,8 @@ TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmedThenBroken2) {
// will not be retried over TCP.
TEST_P(QuicNetworkTransactionTest,
TimeoutAfterHandshakeConfirmedAndHeadersThenBrokenNotRetried) {
- params_.mark_quic_broken_when_network_blackholes = true;
- params_.quic_idle_connection_timeout_seconds = 5;
+ session_params_.mark_quic_broken_when_network_blackholes = true;
+ session_params_.quic_idle_connection_timeout_seconds = 5;
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -2257,8 +2261,8 @@ TEST_P(QuicNetworkTransactionTest,
// over TCP.
TEST_P(QuicNetworkTransactionTest,
TooManyRtosAfterHandshakeConfirmedThenBroken) {
- params_.mark_quic_broken_when_network_blackholes = true;
- params_.quic_connection_options.push_back(k5RTO);
+ session_params_.mark_quic_broken_when_network_blackholes = true;
+ session_params_.quic_connection_options.push_back(k5RTO);
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -2382,8 +2386,8 @@ TEST_P(QuicNetworkTransactionTest,
// QUIC will be marked as broken.
TEST_P(QuicNetworkTransactionTest,
TooManyRtosAfterHandshakeConfirmedAndStreamResetThenBroken) {
- params_.mark_quic_broken_when_network_blackholes = true;
- params_.quic_connection_options.push_back(k5RTO);
+ session_params_.mark_quic_broken_when_network_blackholes = true;
+ session_params_.quic_connection_options.push_back(k5RTO);
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -2490,8 +2494,8 @@ TEST_P(QuicNetworkTransactionTest,
// retried over TCP and the QUIC will be marked as broken.
TEST_P(QuicNetworkTransactionTest,
ProtocolErrorAfterHandshakeConfirmedThenBroken) {
- params_.retry_without_alt_svc_on_quic_errors = true;
- params_.quic_idle_connection_timeout_seconds = 5;
+ session_params_.retry_without_alt_svc_on_quic_errors = true;
+ session_params_.quic_idle_connection_timeout_seconds = 5;
// The request will initially go out over QUIC.
MockQuicData quic_data;
@@ -2715,7 +2719,7 @@ TEST_P(QuicNetworkTransactionTest, UseExistingQUICAlternativeProxy) {
test_proxy_delegate.set_alternative_proxy_server(
ProxyServer::FromPacString("QUIC mail.example.org:443"));
- params_.proxy_delegate = &test_proxy_delegate;
+ session_context_.proxy_delegate = &test_proxy_delegate;
request_.url = GURL("http://mail.example.org/");
@@ -3122,7 +3126,7 @@ TEST_P(QuicNetworkTransactionTest, QuicProxyWithRacing) {
test_proxy_delegate.set_alternative_proxy_server(
ProxyServer::FromPacString("QUIC mail.example.org:443"));
- params_.proxy_delegate = &test_proxy_delegate;
+ session_context_.proxy_delegate = &test_proxy_delegate;
CreateSession();
EXPECT_TRUE(test_proxy_delegate.alternative_proxy_server().is_quic());
@@ -3834,7 +3838,7 @@ TEST_P(QuicNetworkTransactionTest, ConnectionCloseDuringConnectProxy) {
ProxyServer::FromPacString("QUIC myproxy.org:443"));
EXPECT_TRUE(test_proxy_delegate.alternative_proxy_server().is_quic());
- params_.proxy_delegate = &test_proxy_delegate;
+ session_context_.proxy_delegate = &test_proxy_delegate;
proxy_service_ =
ProxyService::CreateFixedFromPacResult("HTTPS myproxy.org:443");
request_.url = GURL("http://mail.example.org/");
@@ -3897,7 +3901,7 @@ TEST_P(QuicNetworkTransactionTest,
test_proxy_delegate.set_alternative_proxy_server(
ProxyServer::FromPacString("QUIC mail.example.org:443"));
- params_.proxy_delegate = &test_proxy_delegate;
+ session_context_.proxy_delegate = &test_proxy_delegate;
request_.url = GURL("http://mail.example.org/");
@@ -3936,7 +3940,7 @@ TEST_P(QuicNetworkTransactionTest,
}
TEST_P(QuicNetworkTransactionTest, QuicUpload) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)};
@@ -3971,9 +3975,9 @@ TEST_P(QuicNetworkTransactionTest, QuicUploadWriteError) {
mock_ncn->SetConnectedNetworksList(
{kDefaultNetworkForTests, kNewNetworkForTests});
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
- params_.quic_migrate_sessions_on_network_change = true;
+ session_params_.quic_migrate_sessions_on_network_change = true;
MockQuicData socket_data;
socket_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);
@@ -4016,7 +4020,7 @@ TEST_P(QuicNetworkTransactionTest, QuicUploadWriteError) {
// Adds coverage to catch regression such as https://crbug.com/622043
TEST_P(QuicNetworkTransactionTest, QuicServerPush) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -4074,8 +4078,8 @@ TEST_P(QuicNetworkTransactionTest, QuicServerPush) {
}
TEST_P(QuicNetworkTransactionTest, QuicForceHolBlocking) {
- params_.quic_force_hol_blocking = true;
- params_.origins_to_force_quic_on.insert(
+ session_params_.quic_force_hol_blocking = true;
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -4157,7 +4161,7 @@ class QuicURLRequestContext : public URLRequestContext {
};
TEST_P(QuicNetworkTransactionTest, RawHeaderSizeSuccessfullRequest) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -4216,7 +4220,7 @@ TEST_P(QuicNetworkTransactionTest, RawHeaderSizeSuccessfullRequest) {
}
TEST_P(QuicNetworkTransactionTest, RawHeaderSizeSuccessfullPushHeadersFirst) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
@@ -4312,32 +4316,36 @@ class QuicNetworkTransactionWithDestinationTest
NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
base::RunLoop().RunUntilIdle();
- HttpNetworkSession::Params params;
+ HttpNetworkSession::Params session_params;
+ session_params.enable_quic = true;
+ session_params.quic_supported_versions = SupportedVersions(version_);
+
+ HttpNetworkSession::Context session_context;
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(20));
- params.quic_clock = &clock_;
+ session_context.quic_clock = &clock_;
crypto_client_stream_factory_.set_handshake_mode(
MockCryptoClientStream::CONFIRM_HANDSHAKE);
- params.quic_crypto_client_stream_factory = &crypto_client_stream_factory_;
-
- params.enable_quic = true;
- params.quic_random = &random_generator_;
- params.client_socket_factory = &socket_factory_;
- params.host_resolver = &host_resolver_;
- params.cert_verifier = &cert_verifier_;
- params.transport_security_state = &transport_security_state_;
- params.cert_transparency_verifier = cert_transparency_verifier_.get();
- params.ct_policy_enforcer = &ct_policy_enforcer_;
- params.socket_performance_watcher_factory =
+ session_context.quic_crypto_client_stream_factory =
+ &crypto_client_stream_factory_;
+
+ session_context.quic_random = &random_generator_;
+ session_context.client_socket_factory = &socket_factory_;
+ session_context.host_resolver = &host_resolver_;
+ session_context.cert_verifier = &cert_verifier_;
+ session_context.transport_security_state = &transport_security_state_;
+ session_context.cert_transparency_verifier =
+ cert_transparency_verifier_.get();
+ session_context.ct_policy_enforcer = &ct_policy_enforcer_;
+ session_context.socket_performance_watcher_factory =
&test_socket_performance_watcher_factory_;
- params.ssl_config_service = ssl_config_service_.get();
- params.proxy_service = proxy_service_.get();
- params.http_auth_handler_factory = auth_handler_factory_.get();
- params.http_server_properties = &http_server_properties_;
- params.quic_supported_versions = SupportedVersions(version_);
+ session_context.ssl_config_service = ssl_config_service_.get();
+ session_context.proxy_service = proxy_service_.get();
+ session_context.http_auth_handler_factory = auth_handler_factory_.get();
+ session_context.http_server_properties = &http_server_properties_;
- session_.reset(new HttpNetworkSession(params));
+ session_.reset(new HttpNetworkSession(session_params, session_context));
session_->quic_stream_factory()->set_require_confirmation(true);
}
@@ -4732,7 +4740,7 @@ TEST_P(QuicNetworkTransactionWithDestinationTest,
// crbug.com/705109 - this confirms that matching request with a body
// triggers a crash (pre-fix).
TEST_P(QuicNetworkTransactionTest, QuicServerPushMatchesRequestWithBody) {
- params_.origins_to_force_quic_on.insert(
+ session_params_.origins_to_force_quic_on.insert(
HostPortPair::FromString("mail.example.org:443"));
MockQuicData mock_quic_data;
« no previous file with comments | « net/quic/chromium/quic_end_to_end_unittest.cc ('k') | net/socket/client_socket_pool_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698