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

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 2373663002: Unify enum NextProto and enum AlternateProtocol. (Closed)
Patch Set: Fix compile errors. Created 4 years, 1 month 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_network_transaction.cc ('k') | net/http/http_server_properties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 84b758a4408d91e9df2c8a8395bb89a929273214..cea4361f0eb22f948e70e037c2c09d2f1876a1ed 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -9214,8 +9214,7 @@ std::unique_ptr<HttpNetworkSession> SetupSessionForGroupNameTests(
HttpServerProperties* http_server_properties =
session->http_server_properties();
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "", 444);
+ AlternativeService alternative_service(kProtoHTTP2, "", 444);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort("https", "host.with.alternate", 443),
@@ -10093,8 +10092,7 @@ TEST_F(HttpNetworkTransactionTest, HonorAlternativeServiceHeader) {
alternative_service_vector =
http_server_properties->GetAlternativeServices(test_server);
ASSERT_EQ(1u, alternative_service_vector.size());
- EXPECT_EQ(AlternateProtocolFromNextProto(kProtoHTTP2),
- alternative_service_vector[0].protocol);
+ EXPECT_EQ(kProtoHTTP2, alternative_service_vector[0].protocol);
EXPECT_EQ("mail.example.org", alternative_service_vector[0].host);
EXPECT_EQ(443, alternative_service_vector[0].port);
}
@@ -10182,9 +10180,8 @@ TEST_F(HttpNetworkTransactionTest,
HttpServerProperties* http_server_properties =
session->http_server_properties();
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "different.example.org",
- 444);
+ AlternativeService alternative_service(kProtoHTTP2, "different.example.org",
+ 444);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort(request.url), alternative_service, expiration);
@@ -10223,8 +10220,7 @@ TEST_F(HttpNetworkTransactionTest,
HttpServerProperties* http_server_properties =
session->http_server_properties();
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "", 444);
+ AlternativeService alternative_service(kProtoHTTP2, "", 444);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort(request.url), alternative_service, expiration);
@@ -10243,7 +10239,7 @@ TEST_F(HttpNetworkTransactionTest, ClearAlternativeServices) {
HttpServerProperties* http_server_properties =
session->http_server_properties();
url::SchemeHostPort test_server("https", "www.example.org", 443);
- AlternativeService alternative_service(QUIC, "", 80);
+ AlternativeService alternative_service(kProtoQUIC, "", 80);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
test_server, alternative_service, expiration);
@@ -10342,12 +10338,10 @@ TEST_F(HttpNetworkTransactionTest, HonorMultipleAlternativeServiceHeaders) {
alternative_service_vector =
http_server_properties->GetAlternativeServices(test_server);
ASSERT_EQ(2u, alternative_service_vector.size());
- EXPECT_EQ(AlternateProtocolFromNextProto(kProtoHTTP2),
- alternative_service_vector[0].protocol);
+ EXPECT_EQ(kProtoHTTP2, alternative_service_vector[0].protocol);
EXPECT_EQ("www.example.com", alternative_service_vector[0].host);
EXPECT_EQ(443, alternative_service_vector[0].port);
- EXPECT_EQ(AlternateProtocolFromNextProto(kProtoHTTP2),
- alternative_service_vector[1].protocol);
+ EXPECT_EQ(kProtoHTTP2, alternative_service_vector[1].protocol);
EXPECT_EQ("www.example.org", alternative_service_vector[1].host);
EXPECT_EQ(1234, alternative_service_vector[1].port);
}
@@ -10388,7 +10382,7 @@ TEST_F(HttpNetworkTransactionTest, IdentifyQuicBroken) {
std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
HttpServerProperties* http_server_properties =
session->http_server_properties();
- AlternativeService alternative_service(QUIC, alternative);
+ AlternativeService alternative_service(kProtoQUIC, alternative);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(server, alternative_service,
expiration);
@@ -10450,11 +10444,11 @@ TEST_F(HttpNetworkTransactionTest, IdentifyQuicNotBroken) {
AlternativeServiceInfoVector alternative_service_info_vector;
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
- AlternativeService alternative_service1(QUIC, alternative1);
+ AlternativeService alternative_service1(kProtoQUIC, alternative1);
AlternativeServiceInfo alternative_service_info1(alternative_service1,
expiration);
alternative_service_info_vector.push_back(alternative_service_info1);
- AlternativeService alternative_service2(QUIC, alternative2);
+ AlternativeService alternative_service2(kProtoQUIC, alternative2);
AlternativeServiceInfo alternative_service_info2(alternative_service2,
expiration);
alternative_service_info_vector.push_back(alternative_service_info2);
@@ -10511,7 +10505,7 @@ TEST_F(HttpNetworkTransactionTest, MarkBrokenAlternateProtocolAndFallback) {
// Port must be < 1024, or the header will be ignored (since initial port was
// port 80 (another restricted port).
const AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "www.example.org",
+ kProtoHTTP2, "www.example.org",
666); // Port is ignored by MockConnect anyway.
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(server, alternative_service,
@@ -10573,9 +10567,8 @@ TEST_F(HttpNetworkTransactionTest, AlternateProtocolPortRestrictedBlocked) {
HttpServerProperties* http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1024;
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "www.example.org",
- kUnrestrictedAlternatePort);
+ AlternativeService alternative_service(kProtoHTTP2, "www.example.org",
+ kUnrestrictedAlternatePort);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort(restricted_port_request.url), alternative_service,
@@ -10624,9 +10617,8 @@ TEST_F(HttpNetworkTransactionTest, AlternateProtocolPortRestrictedPermitted) {
HttpServerProperties* http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1024;
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "www.example.org",
- kUnrestrictedAlternatePort);
+ AlternativeService alternative_service(kProtoHTTP2, "www.example.org",
+ kUnrestrictedAlternatePort);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort(restricted_port_request.url), alternative_service,
@@ -10674,9 +10666,8 @@ TEST_F(HttpNetworkTransactionTest, AlternateProtocolPortRestrictedAllowed) {
HttpServerProperties* http_server_properties =
session->http_server_properties();
const int kRestrictedAlternatePort = 80;
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "www.example.org",
- kRestrictedAlternatePort);
+ AlternativeService alternative_service(kProtoHTTP2, "www.example.org",
+ kRestrictedAlternatePort);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort(restricted_port_request.url), alternative_service,
@@ -10724,9 +10715,8 @@ TEST_F(HttpNetworkTransactionTest, AlternateProtocolPortUnrestrictedAllowed1) {
HttpServerProperties* http_server_properties =
session->http_server_properties();
const int kRestrictedAlternatePort = 80;
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "www.example.org",
- kRestrictedAlternatePort);
+ AlternativeService alternative_service(kProtoHTTP2, "www.example.org",
+ kRestrictedAlternatePort);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort(unrestricted_port_request.url), alternative_service,
@@ -10774,9 +10764,8 @@ TEST_F(HttpNetworkTransactionTest, AlternateProtocolPortUnrestrictedAllowed2) {
HttpServerProperties* http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1025;
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "www.example.org",
- kUnrestrictedAlternatePort);
+ AlternativeService alternative_service(kProtoHTTP2, "www.example.org",
+ kUnrestrictedAlternatePort);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort(unrestricted_port_request.url), alternative_service,
@@ -10816,9 +10805,8 @@ TEST_F(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) {
HttpServerProperties* http_server_properties =
session->http_server_properties();
const int kUnsafePort = 7;
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), "www.example.org",
- kUnsafePort);
+ AlternativeService alternative_service(kProtoHTTP2, "www.example.org",
+ kUnsafePort);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(
url::SchemeHostPort(request.url), alternative_service, expiration);
@@ -11176,8 +11164,7 @@ TEST_F(HttpNetworkTransactionTest, UseOriginNotAlternativeForProxy) {
session->http_server_properties();
url::SchemeHostPort server("https", "www.example.org", 443);
HostPortPair alternative("www.example.com", 443);
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), alternative);
+ AlternativeService alternative_service(kProtoHTTP2, alternative);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(server, alternative_service,
expiration);
@@ -13705,8 +13692,7 @@ TEST_F(HttpNetworkTransactionTest, AlternativeServiceNotOnHttp11) {
std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
HttpServerProperties* http_server_properties =
session->http_server_properties();
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), alternative);
+ AlternativeService alternative_service(kProtoHTTP2, alternative);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(server, alternative_service,
expiration);
@@ -13773,8 +13759,7 @@ TEST_F(HttpNetworkTransactionTest, FailedAlternativeServiceIsNotUserVisible) {
std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
HttpServerProperties* http_server_properties =
session->http_server_properties();
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), alternative);
+ AlternativeService alternative_service(kProtoHTTP2, alternative);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(server, alternative_service,
expiration);
@@ -13881,8 +13866,7 @@ TEST_F(HttpNetworkTransactionTest, AlternativeServiceShouldNotPoolToHttp11) {
std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
HttpServerProperties* http_server_properties =
session->http_server_properties();
- AlternativeService alternative_service(
- AlternateProtocolFromNextProto(kProtoHTTP2), alternative);
+ AlternativeService alternative_service(kProtoHTTP2, alternative);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
http_server_properties->SetAlternativeService(server, alternative_service,
expiration);
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | net/http/http_server_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698