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

Side by Side Diff: net/http/http_stream_factory_impl_unittest.cc

Issue 2318053004: Remove obsolete QUIC disabling code. (Closed)
Patch Set: fix Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_stream_factory_impl.h" 5 #include "net/http/http_stream_factory_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 // not used for subsequent requests. 1084 // not used for subsequent requests.
1085 EXPECT_FALSE(test_proxy_delegate.alternative_proxy_server().is_quic()); 1085 EXPECT_FALSE(test_proxy_delegate.alternative_proxy_server().is_quic());
1086 1086
1087 // GetAlternativeProxy should be called only once per request. 1087 // GetAlternativeProxy should be called only once per request.
1088 EXPECT_EQ(static_cast<int>(i + 1), 1088 EXPECT_EQ(static_cast<int>(i + 1),
1089 test_proxy_delegate.get_alternative_proxy_invocations()); 1089 test_proxy_delegate.get_alternative_proxy_invocations());
1090 } 1090 }
1091 } 1091 }
1092 } 1092 }
1093 1093
1094 TEST_F(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad) {
1095 // Checks if a
1096 std::unique_ptr<ProxyService> proxy_service;
1097 proxy_service = ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT");
1098
1099 HttpNetworkSession::Params params;
1100 params.enable_quic = true;
1101 params.quic_disable_preconnect_if_0rtt = false;
1102 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service(
1103 new SSLConfigServiceDefaults);
1104 HttpServerPropertiesImpl http_server_properties;
1105 MockClientSocketFactory socket_factory;
1106 params.client_socket_factory = &socket_factory;
1107 MockHostResolver host_resolver;
1108 params.host_resolver = &host_resolver;
1109 MockCertVerifier cert_verifier;
1110 params.cert_verifier = &cert_verifier;
1111 TransportSecurityState transport_security_state;
1112 params.transport_security_state = &transport_security_state;
1113 MultiLogCTVerifier ct_verifier;
1114 params.cert_transparency_verifier = &ct_verifier;
1115 CTPolicyEnforcer ct_policy_enforcer;
1116 params.ct_policy_enforcer = &ct_policy_enforcer;
1117 params.proxy_service = proxy_service.get();
1118 params.ssl_config_service = ssl_config_service.get();
1119 params.http_server_properties = &http_server_properties;
1120 params.quic_max_number_of_lossy_connections = 2;
1121
1122 std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession(params));
1123 session->quic_stream_factory()->set_require_confirmation(false);
1124
1125 session->quic_stream_factory()->number_of_lossy_connections_[99] =
1126 params.quic_max_number_of_lossy_connections;
1127 session->quic_stream_factory()->MaybeDisableQuic(99);
1128 ASSERT_TRUE(session->quic_stream_factory()->IsQuicDisabled(99));
1129
1130 StaticSocketDataProvider socket_data2;
1131 socket_data2.set_connect_data(MockConnect(ASYNC, OK));
1132 socket_factory.AddSocketDataProvider(&socket_data2);
1133
1134 // Now request a stream. It should succeed using the second proxy in the
1135 // list.
1136 HttpRequestInfo request_info;
1137 request_info.method = "GET";
1138 request_info.url = GURL("http://www.google.com");
1139
1140 SSLConfig ssl_config;
1141 StreamRequestWaiter waiter;
1142 std::unique_ptr<HttpStreamRequest> request(
1143 session->http_stream_factory()->RequestStream(
1144 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1145 BoundNetLog()));
1146 waiter.WaitForStream();
1147
1148 // The proxy that failed should now be known to the proxy_service as bad.
1149 const ProxyRetryInfoMap& retry_info =
1150 session->proxy_service()->proxy_retry_info();
1151 EXPECT_EQ(1u, retry_info.size());
1152 EXPECT_TRUE(waiter.used_proxy_info().is_direct());
1153
1154 ProxyRetryInfoMap::const_iterator iter = retry_info.find("quic://bad:99");
1155 EXPECT_TRUE(iter != retry_info.end());
1156 }
1157
1158 TEST_F(HttpStreamFactoryTest, UsePreConnectIfNoZeroRTT) { 1094 TEST_F(HttpStreamFactoryTest, UsePreConnectIfNoZeroRTT) {
1159 for (int num_streams = 1; num_streams < 3; ++num_streams) { 1095 for (int num_streams = 1; num_streams < 3; ++num_streams) {
1160 GURL url = GURL("https://www.google.com"); 1096 GURL url = GURL("https://www.google.com");
1161 1097
1162 // Set up QUIC as alternative_service. 1098 // Set up QUIC as alternative_service.
1163 HttpServerPropertiesImpl http_server_properties; 1099 HttpServerPropertiesImpl http_server_properties;
1164 const AlternativeService alternative_service(QUIC, url.host().c_str(), 1100 const AlternativeService alternative_service(QUIC, url.host().c_str(),
1165 url.IntPort()); 1101 url.IntPort());
1166 AlternativeServiceInfoVector alternative_service_info_vector; 1102 AlternativeServiceInfoVector alternative_service_info_vector;
1167 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 1103 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 session->GetTransportSocketPool( 2251 session->GetTransportSocketPool(
2316 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); 2252 HttpNetworkSession::WEBSOCKET_SOCKET_POOL)));
2317 EXPECT_EQ(1, GetSocketPoolGroupCount( 2253 EXPECT_EQ(1, GetSocketPoolGroupCount(
2318 session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); 2254 session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL)));
2319 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); 2255 EXPECT_TRUE(waiter.used_proxy_info().is_direct());
2320 } 2256 }
2321 2257
2322 } // namespace 2258 } // namespace
2323 2259
2324 } // namespace net 2260 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698