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

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 1268313004: s/use_alternate_protocols/use_alternative_services/g (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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_network_transaction_unittest.cc
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index e4a638280994d3da85fbc5840e552f11e614a2fb..f3ada7dd013e58923b61a500d39505f5401dabc8 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -7939,7 +7939,7 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForDirectConnections) {
},
};
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
for (size_t i = 0; i < arraysize(tests); ++i) {
session_deps_.proxy_service.reset(
@@ -8002,7 +8002,7 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForHTTPProxyConnections) {
},
};
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
for (size_t i = 0; i < arraysize(tests); ++i) {
session_deps_.proxy_service.reset(
@@ -8072,7 +8072,7 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForSOCKSConnections) {
},
};
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
for (size_t i = 0; i < arraysize(tests); ++i) {
session_deps_.proxy_service.reset(
@@ -8727,7 +8727,7 @@ TEST_P(HttpNetworkTransactionTest, ChangeAuthRealms) {
TEST_P(HttpNetworkTransactionTest, HonorAlternativeServiceHeader) {
session_deps_.next_protos = SpdyNextProtos();
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
std::string alternative_service_http_header =
GetAlternativeServiceHttpHeader();
@@ -8789,7 +8789,7 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternativeServiceHeader) {
TEST_P(HttpNetworkTransactionTest, HonorMultipleAlternativeServiceHeader) {
session_deps_.next_protos = SpdyNextProtos();
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
MockRead data_reads[] = {
MockRead("HTTP/1.1 200 OK\r\n"),
@@ -8853,7 +8853,7 @@ TEST_P(HttpNetworkTransactionTest, HonorMultipleAlternativeServiceHeader) {
TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) {
session_deps_.next_protos = SpdyNextProtos();
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
std::string alternate_protocol_http_header =
GetAlternateProtocolHttpHeader();
@@ -8914,7 +8914,7 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) {
TEST_P(HttpNetworkTransactionTest, EmptyAlternateProtocolHeader) {
session_deps_.next_protos = SpdyNextProtos();
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
MockRead data_reads[] = {
MockRead("HTTP/1.1 200 OK\r\n"),
@@ -8975,7 +8975,7 @@ TEST_P(HttpNetworkTransactionTest, EmptyAlternateProtocolHeader) {
TEST_P(HttpNetworkTransactionTest, AltSvcOverwritesAlternateProtocol) {
session_deps_.next_protos = SpdyNextProtos();
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
std::string alternative_service_http_header =
GetAlternativeServiceHttpHeader();
@@ -9039,7 +9039,7 @@ TEST_P(HttpNetworkTransactionTest, AltSvcOverwritesAlternateProtocol) {
TEST_P(HttpNetworkTransactionTest,
MarkBrokenAlternateProtocolAndFallback) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
HttpRequestInfo request;
request.method = "GET";
@@ -9099,13 +9099,13 @@ TEST_P(HttpNetworkTransactionTest,
alternative_service_vector[0]));
}
+// Ensure that we are not allowed to redirect traffic via an alternate protocol
+// to an unrestricted (port >= 1024) when the original traffic was on a
+// restricted port (port < 1024). Ensure that we can redirect in all other
+// cases.
TEST_P(HttpNetworkTransactionTest,
AlternateProtocolPortRestrictedBlocked) {
- // Ensure that we're not allowed to redirect traffic via an alternate
- // protocol to an unrestricted (port >= 1024) when the original traffic was
- // on a restricted port (port < 1024). Ensure that we can redirect in all
- // other cases.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
HttpRequestInfo restricted_port_request;
restricted_port_request.method = "GET";
@@ -9151,14 +9151,12 @@ TEST_P(HttpNetworkTransactionTest,
EXPECT_EQ(ERR_CONNECTION_REFUSED, callback.WaitForResult());
}
+// Ensure that we are allowed to redirect traffic via an alternate protocol to
+// an unrestricted (port >= 1024) when the original traffic was on a restricted
+// port (port < 1024) if we set |enable_user_alternate_protocol_ports|.
TEST_P(HttpNetworkTransactionTest,
AlternateProtocolPortRestrictedPermitted) {
- // Ensure that we're allowed to redirect traffic via an alternate
- // protocol to an unrestricted (port >= 1024) when the original traffic was
- // on a restricted port (port < 1024) if we set
- // enable_user_alternate_protocol_ports.
-
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.enable_user_alternate_protocol_ports = true;
HttpRequestInfo restricted_port_request;
@@ -9204,13 +9202,13 @@ TEST_P(HttpNetworkTransactionTest,
EXPECT_EQ(OK, callback.WaitForResult());
}
+// Ensure that we are not allowed to redirect traffic via an alternate protocol
+// to an unrestricted (port >= 1024) when the original traffic was on a
+// restricted port (port < 1024). Ensure that we can redirect in all other
+// cases.
TEST_P(HttpNetworkTransactionTest,
AlternateProtocolPortRestrictedAllowed) {
- // Ensure that we're not allowed to redirect traffic via an alternate
- // protocol to an unrestricted (port >= 1024) when the original traffic was
- // on a restricted port (port < 1024). Ensure that we can redirect in all
- // other cases.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
HttpRequestInfo restricted_port_request;
restricted_port_request.method = "GET";
@@ -9256,13 +9254,13 @@ TEST_P(HttpNetworkTransactionTest,
EXPECT_EQ(OK, callback.WaitForResult());
}
+// Ensure that we are not allowed to redirect traffic via an alternate protocol
+// to an unrestricted (port >= 1024) when the original traffic was on a
+// restricted port (port < 1024). Ensure that we can redirect in all other
+// cases.
TEST_P(HttpNetworkTransactionTest,
AlternateProtocolPortUnrestrictedAllowed1) {
- // Ensure that we're not allowed to redirect traffic via an alternate
- // protocol to an unrestricted (port >= 1024) when the original traffic was
- // on a restricted port (port < 1024). Ensure that we can redirect in all
- // other cases.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
HttpRequestInfo unrestricted_port_request;
unrestricted_port_request.method = "GET";
@@ -9307,13 +9305,13 @@ TEST_P(HttpNetworkTransactionTest,
EXPECT_EQ(OK, callback.WaitForResult());
}
+// Ensure that we are not allowed to redirect traffic via an alternate protocol
+// to an unrestricted (port >= 1024) when the original traffic was on a
+// restricted port (port < 1024). Ensure that we can redirect in all other
+// cases.
TEST_P(HttpNetworkTransactionTest,
AlternateProtocolPortUnrestrictedAllowed2) {
- // Ensure that we're not allowed to redirect traffic via an alternate
- // protocol to an unrestricted (port >= 1024) when the original traffic was
- // on a restricted port (port < 1024). Ensure that we can redirect in all
- // other cases.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
HttpRequestInfo unrestricted_port_request;
unrestricted_port_request.method = "GET";
@@ -9358,11 +9356,11 @@ TEST_P(HttpNetworkTransactionTest,
EXPECT_EQ(OK, callback.WaitForResult());
}
+// Ensure that we are not allowed to redirect traffic via an alternate protocol
+// to an unsafe port, and that we resume the second HttpStreamFactoryImpl::Job
+// once the alternate protocol request fails.
TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) {
- // Ensure that we're not allowed to redirect traffic via an alternate
- // protocol to an unsafe port, and that we resume the second
- // HttpStreamFactoryImpl::Job once the alternate protocol request fails.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
HttpRequestInfo request;
request.method = "GET";
@@ -9401,9 +9399,6 @@ TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) {
// The HTTP request should succeed.
EXPECT_EQ(OK, callback.WaitForResult());
- // Disable alternate protocol before the asserts.
- // HttpStreamFactory::set_use_alternate_protocols(false);
Ryan Hamilton 2015/08/12 03:31:15 What's the story behind this change?
Bence 2015/08/12 12:02:10 I have no idea. This line got commented out at ht
-
const HttpResponseInfo* response = trans->GetResponseInfo();
ASSERT_TRUE(response != NULL);
ASSERT_TRUE(response->headers.get() != NULL);
@@ -9415,7 +9410,7 @@ TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) {
}
TEST_P(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdy) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
HttpRequestInfo request;
@@ -9503,7 +9498,7 @@ TEST_P(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdy) {
}
TEST_P(HttpNetworkTransactionTest, AlternateProtocolWithSpdyLateBinding) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
HttpRequestInfo request;
@@ -9620,7 +9615,7 @@ TEST_P(HttpNetworkTransactionTest, AlternateProtocolWithSpdyLateBinding) {
}
TEST_P(HttpNetworkTransactionTest, StallAlternateProtocolForNpnSpdy) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
HttpRequestInfo request;
@@ -9747,7 +9742,7 @@ class CapturingProxyResolverFactory : public ProxyResolverFactory {
TEST_P(HttpNetworkTransactionTest,
UseAlternateProtocolForTunneledNpnSpdy) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
ProxyConfig proxy_config;
@@ -9873,7 +9868,7 @@ TEST_P(HttpNetworkTransactionTest,
TEST_P(HttpNetworkTransactionTest,
UseAlternateProtocolForNpnSpdyWithExistingSpdySession) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
HttpRequestInfo request;
@@ -10571,7 +10566,7 @@ TEST_P(HttpNetworkTransactionTest, MultiRoundAuth) {
// This tests the case that a request is issued via http instead of spdy after
// npn is negotiated.
TEST_P(HttpNetworkTransactionTest, NpnWithHttpOverSSL) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
NextProtoVector next_protos;
next_protos.push_back(kProtoHTTP11);
session_deps_.next_protos = next_protos;
@@ -10632,11 +10627,11 @@ TEST_P(HttpNetworkTransactionTest, NpnWithHttpOverSSL) {
EXPECT_TRUE(response->was_npn_negotiated);
}
+// Simulate the SSL handshake completing with an NPN negotiation followed by an
+// immediate server closing of the socket.
+// Regression test for https://crbug.com/46369.
TEST_P(HttpNetworkTransactionTest, SpdyPostNPNServerHangup) {
- // Simulate the SSL handshake completing with an NPN negotiation
- // followed by an immediate server closing of the socket.
- // Fix crash: http://crbug.com/46369
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
HttpRequestInfo request;
@@ -10694,10 +10689,10 @@ class UrlRecordingHttpAuthHandlerMock : public HttpAuthHandlerMock {
GURL* url_;
};
+// This test ensures that the URL passed into the proxy is upgraded to https
+// when doing an Alternate Protocol upgrade.
TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) {
- // This test ensures that the URL passed into the proxy is upgraded
- // to https when doing an Alternate Protocol upgrade.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
session_deps_.proxy_service.reset(
@@ -11554,7 +11549,7 @@ TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) {
}
TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
// Set up a special HttpNetworkSession with a MockCachingHostResolver.
@@ -11653,7 +11648,7 @@ TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) {
}
TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
// Set up a special HttpNetworkSession with a MockCachingHostResolver.
@@ -11780,7 +11775,7 @@ class OneTimeCachingHostResolver : public HostResolver {
TEST_P(HttpNetworkTransactionTest,
UseIPConnectionPoolingWithHostCacheExpiration) {
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
// Set up a special HttpNetworkSession with a OneTimeCachingHostResolver.
@@ -12039,7 +12034,7 @@ class AltSvcCertificateVerificationTest : public HttpNetworkTransactionTest {
data_refused.set_connect_data(mock_connect);
session_deps_.socket_factory->AddSocketDataProvider(&data_refused);
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
@@ -12144,7 +12139,7 @@ TEST_P(HttpNetworkTransactionTest, AlternativeServiceNotOnHttp11) {
session_deps_.socket_factory->AddSocketDataProvider(&data_refused);
// Set up alternative service for origin.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
@@ -12217,7 +12212,7 @@ TEST_P(HttpNetworkTransactionTest, FailedAlternativeServiceIsNotUserVisible) {
session_deps_.socket_factory->AddSocketDataProvider(&http_data);
// Set up alternative service for origin.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
@@ -12326,7 +12321,7 @@ TEST_P(HttpNetworkTransactionTest, AlternativeServiceShouldNotPoolToHttp11) {
session_deps_.socket_factory->AddSocketDataProvider(&data_refused);
// Set up alternative service for origin.
- session_deps_.use_alternate_protocols = true;
+ session_deps_.use_alternative_services = true;
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();

Powered by Google App Engine
This is Rietveld 408576698