Index: net/http/http_server_properties_impl_unittest.cc |
diff --git a/net/http/http_server_properties_impl_unittest.cc b/net/http/http_server_properties_impl_unittest.cc |
index 6031428ba7f8f6a8c5c6fb40c86b5e9cbcdc1889..5a6136777bc95d85fe2fa985e6912dbf6a5550c5 100644 |
--- a/net/http/http_server_properties_impl_unittest.cc |
+++ b/net/http/http_server_properties_impl_unittest.cc |
@@ -247,13 +247,14 @@ TEST_F(SpdyServerPropertiesTest, SupportsRequestPriorityTest) { |
// Add www.youtube.com:443 as supporting QUIC. |
url::SchemeHostPort youtube_server("https", "www.youtube.com", 443); |
- const AlternativeService alternative_service1(QUIC, "www.youtube.com", 443); |
+ const AlternativeService alternative_service1(kProtoQUIC, "www.youtube.com", |
+ 443); |
SetAlternativeService(youtube_server, alternative_service1); |
EXPECT_TRUE(impl_.SupportsRequestPriority(youtube_server)); |
// Add www.example.com:443 with two alternative services, one supporting QUIC. |
url::SchemeHostPort example_server("https", "www.example.com", 443); |
- const AlternativeService alternative_service2(NPN_HTTP_2, "", 443); |
+ const AlternativeService alternative_service2(kProtoHTTP2, "", 443); |
SetAlternativeService(example_server, alternative_service2); |
SetAlternativeService(example_server, alternative_service1); |
EXPECT_TRUE(impl_.SupportsRequestPriority(example_server)); |
@@ -382,7 +383,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, Basic) { |
url::SchemeHostPort test_server("http", "foo", 80); |
EXPECT_FALSE(HasAlternativeService(test_server)); |
- AlternativeService alternative_service(NPN_HTTP_2, "foo", 443); |
+ AlternativeService alternative_service(kProtoHTTP2, "foo", 443); |
SetAlternativeService(test_server, alternative_service); |
const AlternativeServiceVector alternative_service_vector = |
impl_.GetAlternativeServices(test_server); |
@@ -397,19 +398,19 @@ TEST_F(AlternateProtocolServerPropertiesTest, ExcludeOrigin) { |
AlternativeServiceInfoVector alternative_service_info_vector; |
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
// Same hostname, same port, TCP: should be ignored. |
- AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443); |
+ AlternativeService alternative_service1(kProtoHTTP2, "foo", 443); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service1, expiration)); |
// Different hostname: GetAlternativeServices should return this one. |
- AlternativeService alternative_service2(NPN_HTTP_2, "bar", 443); |
+ AlternativeService alternative_service2(kProtoHTTP2, "bar", 443); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service2, expiration)); |
// Different port: GetAlternativeServices should return this one too. |
- AlternativeService alternative_service3(NPN_HTTP_2, "foo", 80); |
+ AlternativeService alternative_service3(kProtoHTTP2, "foo", 80); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service3, expiration)); |
// QUIC: GetAlternativeServices should return this one too. |
- AlternativeService alternative_service4(QUIC, "foo", 443); |
+ AlternativeService alternative_service4(kProtoQUIC, "foo", 443); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service4, expiration)); |
@@ -430,7 +431,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { |
// |alternative_service_map| does not have an entry for |
// |test_server1|. |
url::SchemeHostPort test_server1("http", "foo1", 80); |
- const AlternativeService alternative_service1(NPN_HTTP_2, "bar1", 443); |
+ const AlternativeService alternative_service1(kProtoHTTP2, "bar1", 443); |
const base::Time now = base::Time::Now(); |
base::Time expiration1 = now + base::TimeDelta::FromDays(1); |
// 1st entry in the memory. |
@@ -441,7 +442,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { |
// |alternative_service_map| has an entry for |
// |test_server2|. |
AlternativeServiceInfoVector alternative_service_info_vector; |
- const AlternativeService alternative_service2(NPN_HTTP_2, "bar2", 443); |
+ const AlternativeService alternative_service2(kProtoHTTP2, "bar2", 443); |
base::Time expiration2 = now + base::TimeDelta::FromDays(2); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service2, expiration2)); |
@@ -453,7 +454,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { |
// InitializeAlternativeServiceServers(). |
AlternativeServiceMap alternative_service_map( |
AlternativeServiceMap::NO_AUTO_EVICT); |
- const AlternativeService alternative_service3(NPN_HTTP_2, "bar3", 123); |
+ const AlternativeService alternative_service3(kProtoHTTP2, "bar3", 123); |
base::Time expiration3 = now + base::TimeDelta::FromDays(3); |
const AlternativeServiceInfo alternative_service_info1(alternative_service3, |
expiration3); |
@@ -463,7 +464,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { |
AlternativeServiceInfoVector(/*size=*/1, alternative_service_info1)); |
url::SchemeHostPort test_server3("http", "foo3", 80); |
- const AlternativeService alternative_service4(NPN_HTTP_2, "bar4", 1234); |
+ const AlternativeService alternative_service4(kProtoHTTP2, "bar4", 1234); |
base::Time expiration4 = now + base::TimeDelta::FromDays(4); |
const AlternativeServiceInfo alternative_service_info2(alternative_service4, |
expiration4); |
@@ -502,9 +503,9 @@ TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { |
// hostname is the mapping. |
TEST_F(AlternateProtocolServerPropertiesTest, InitializeWithEmptyHostname) { |
url::SchemeHostPort server("https", "foo", 443); |
- const AlternativeService alternative_service_with_empty_hostname(NPN_HTTP_2, |
+ const AlternativeService alternative_service_with_empty_hostname(kProtoHTTP2, |
"", 1234); |
- const AlternativeService alternative_service_with_foo_hostname(NPN_HTTP_2, |
+ const AlternativeService alternative_service_with_foo_hostname(kProtoHTTP2, |
"foo", 1234); |
SetAlternativeService(server, alternative_service_with_empty_hostname); |
impl_.MarkAlternativeServiceBroken(alternative_service_with_foo_hostname); |
@@ -527,7 +528,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, InitializeWithEmptyHostname) { |
// with empty value. |
TEST_F(AlternateProtocolServerPropertiesTest, EmptyVector) { |
url::SchemeHostPort server("https", "foo", 443); |
- const AlternativeService alternative_service(NPN_HTTP_2, "bar", 443); |
+ const AlternativeService alternative_service(kProtoHTTP2, "bar", 443); |
base::Time expiration = base::Time::Now() - base::TimeDelta::FromDays(1); |
const AlternativeServiceInfo alternative_service_info(alternative_service, |
expiration); |
@@ -563,7 +564,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, EmptyVector) { |
TEST_F(AlternateProtocolServerPropertiesTest, EmptyVectorForCanonical) { |
url::SchemeHostPort server("https", "foo.c.youtube.com", 443); |
url::SchemeHostPort canonical_server("https", "bar.c.youtube.com", 443); |
- const AlternativeService alternative_service(NPN_HTTP_2, "", 443); |
+ const AlternativeService alternative_service(kProtoHTTP2, "", 443); |
base::Time expiration = base::Time::Now() - base::TimeDelta::FromDays(1); |
const AlternativeServiceInfo alternative_service_info(alternative_service, |
expiration); |
@@ -600,7 +601,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, EmptyVectorForCanonical) { |
TEST_F(AlternateProtocolServerPropertiesTest, ClearServerWithCanonical) { |
url::SchemeHostPort server("https", "foo.c.youtube.com", 443); |
url::SchemeHostPort canonical_server("https", "bar.c.youtube.com", 443); |
- const AlternativeService alternative_service(QUIC, "", 443); |
+ const AlternativeService alternative_service(kProtoQUIC, "", 443); |
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
const AlternativeServiceInfo alternative_service_info(alternative_service, |
expiration); |
@@ -613,7 +614,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, ClearServerWithCanonical) { |
const AlternativeServiceVector alternative_service_vector = |
impl_.GetAlternativeServices(server); |
ASSERT_EQ(1u, alternative_service_vector.size()); |
- EXPECT_EQ(QUIC, alternative_service_vector[0].protocol); |
+ EXPECT_EQ(kProtoQUIC, alternative_service_vector[0].protocol); |
EXPECT_EQ(443, alternative_service_vector[0].port); |
// Now clear the alternatives for the other server and make sure it stays |
@@ -627,10 +628,10 @@ TEST_F(AlternateProtocolServerPropertiesTest, ClearServerWithCanonical) { |
TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternativeServices) { |
url::SchemeHostPort test_server1("http", "foo1", 80); |
- const AlternativeService alternative_service1(NPN_HTTP_2, "foo1", 443); |
+ const AlternativeService alternative_service1(kProtoHTTP2, "foo1", 443); |
SetAlternativeService(test_server1, alternative_service1); |
url::SchemeHostPort test_server2("http", "foo2", 80); |
- const AlternativeService alternative_service2(NPN_HTTP_2, "foo2", 1234); |
+ const AlternativeService alternative_service2(kProtoHTTP2, "foo2", 1234); |
SetAlternativeService(test_server2, alternative_service2); |
const AlternativeServiceMap& map = impl_.alternative_service_map(); |
@@ -653,7 +654,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternativeServices) { |
TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) { |
url::SchemeHostPort test_server("http", "foo", 80); |
- const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443); |
+ const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443); |
SetAlternativeService(test_server, alternative_service1); |
AlternativeServiceVector alternative_service_vector = |
impl_.GetAlternativeServices(test_server); |
@@ -673,7 +674,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) { |
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service1, expiration)); |
- const AlternativeService alternative_service2(NPN_HTTP_2, "foo", 1234); |
+ const AlternativeService alternative_service2(kProtoHTTP2, "foo", 1234); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service2, expiration)); |
impl_.SetAlternativeServices(test_server, alternative_service_info_vector); |
@@ -699,13 +700,13 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAge) { |
// First alternative service expired one day ago, should not be returned by |
// GetAlternativeServices(). |
- const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443); |
+ const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service1, now - one_day)); |
// Second alterrnative service will expire one day from now, should be |
// returned by GetAlternativeSerices(). |
- const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234); |
+ const AlternativeService alternative_service2(kProtoHTTP2, "bar", 1234); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service2, now + one_day)); |
@@ -725,13 +726,13 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAgeCanonical) { |
// First alternative service expired one day ago, should not be returned by |
// GetAlternativeServices(). |
- const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443); |
+ const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service1, now - one_day)); |
// Second alterrnative service will expire one day from now, should be |
// returned by GetAlternativeSerices(). |
- const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234); |
+ const AlternativeService alternative_service2(kProtoHTTP2, "bar", 1234); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service2, now + one_day)); |
@@ -748,11 +749,11 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAgeCanonical) { |
TEST_F(AlternateProtocolServerPropertiesTest, AlternativeServiceWithScheme) { |
AlternativeServiceInfoVector alternative_service_info_vector; |
- const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443); |
+ const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443); |
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service1, expiration)); |
- const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234); |
+ const AlternativeService alternative_service2(kProtoHTTP2, "bar", 1234); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service2, expiration)); |
// Set Alt-Svc list for |http_server|. |
@@ -784,11 +785,11 @@ TEST_F(AlternateProtocolServerPropertiesTest, AlternativeServiceWithScheme) { |
TEST_F(AlternateProtocolServerPropertiesTest, ClearAlternativeServices) { |
AlternativeServiceInfoVector alternative_service_info_vector; |
- const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443); |
+ const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443); |
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service1, expiration)); |
- const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234); |
+ const AlternativeService alternative_service2(kProtoHTTP2, "bar", 1234); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(alternative_service2, expiration)); |
url::SchemeHostPort test_server("http", "foo", 80); |
@@ -812,15 +813,15 @@ TEST_F(AlternateProtocolServerPropertiesTest, ClearAlternativeServices) { |
TEST_F(AlternateProtocolServerPropertiesTest, BrokenShadowsCanonical) { |
url::SchemeHostPort test_server("https", "foo.c.youtube.com", 443); |
url::SchemeHostPort canonical_server("https", "bar.c.youtube.com", 443); |
- AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com", |
- 1234); |
+ AlternativeService canonical_alternative_service(kProtoQUIC, |
+ "bar.c.youtube.com", 1234); |
SetAlternativeService(canonical_server, canonical_alternative_service); |
AlternativeServiceVector alternative_service_vector = |
impl_.GetAlternativeServices(test_server); |
ASSERT_EQ(1u, alternative_service_vector.size()); |
EXPECT_EQ(canonical_alternative_service, alternative_service_vector[0]); |
- const AlternativeService broken_alternative_service(NPN_HTTP_2, "foo", 443); |
+ const AlternativeService broken_alternative_service(kProtoHTTP2, "foo", 443); |
impl_.MarkAlternativeServiceBroken(broken_alternative_service); |
EXPECT_TRUE(impl_.IsAlternativeServiceBroken(broken_alternative_service)); |
@@ -833,7 +834,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, BrokenShadowsCanonical) { |
TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) { |
url::SchemeHostPort test_server("http", "foo", 80); |
- const AlternativeService alternative_service(NPN_HTTP_2, "foo", 443); |
+ const AlternativeService alternative_service(kProtoHTTP2, "foo", 443); |
SetAlternativeService(test_server, alternative_service); |
impl_.MarkAlternativeServiceBroken(alternative_service); |
ASSERT_TRUE(HasAlternativeService(test_server)); |
@@ -846,7 +847,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) { |
TEST_F(AlternateProtocolServerPropertiesTest, MarkRecentlyBroken) { |
url::SchemeHostPort server("http", "foo", 80); |
- const AlternativeService alternative_service(NPN_HTTP_2, "foo", 443); |
+ const AlternativeService alternative_service(kProtoHTTP2, "foo", 443); |
SetAlternativeService(server, alternative_service); |
EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); |
@@ -870,11 +871,11 @@ TEST_F(AlternateProtocolServerPropertiesTest, Canonical) { |
AlternativeServiceInfoVector alternative_service_info_vector; |
const AlternativeService canonical_alternative_service1( |
- QUIC, "bar.c.youtube.com", 1234); |
+ kProtoQUIC, "bar.c.youtube.com", 1234); |
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(canonical_alternative_service1, expiration)); |
- const AlternativeService canonical_alternative_service2(NPN_HTTP_2, "", 443); |
+ const AlternativeService canonical_alternative_service2(kProtoHTTP2, "", 443); |
alternative_service_info_vector.push_back( |
AlternativeServiceInfo(canonical_alternative_service2, expiration)); |
impl_.SetAlternativeServices(canonical_server, |
@@ -905,8 +906,8 @@ TEST_F(AlternateProtocolServerPropertiesTest, Canonical) { |
TEST_F(AlternateProtocolServerPropertiesTest, ClearCanonical) { |
url::SchemeHostPort test_server("https", "foo.c.youtube.com", 443); |
url::SchemeHostPort canonical_server("https", "bar.c.youtube.com", 443); |
- AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com", |
- 1234); |
+ AlternativeService canonical_alternative_service(kProtoQUIC, |
+ "bar.c.youtube.com", 1234); |
SetAlternativeService(canonical_server, canonical_alternative_service); |
impl_.SetAlternativeServices(canonical_server, |
@@ -917,8 +918,8 @@ TEST_F(AlternateProtocolServerPropertiesTest, ClearCanonical) { |
TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBroken) { |
url::SchemeHostPort test_server("https", "foo.c.youtube.com", 443); |
url::SchemeHostPort canonical_server("https", "bar.c.youtube.com", 443); |
- AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com", |
- 1234); |
+ AlternativeService canonical_alternative_service(kProtoQUIC, |
+ "bar.c.youtube.com", 1234); |
SetAlternativeService(canonical_server, canonical_alternative_service); |
impl_.MarkAlternativeServiceBroken(canonical_alternative_service); |
@@ -929,7 +930,8 @@ TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBroken) { |
TEST_F(AlternateProtocolServerPropertiesTest, CanonicalOverride) { |
url::SchemeHostPort foo_server("https", "foo.c.youtube.com", 443); |
url::SchemeHostPort bar_server("https", "bar.c.youtube.com", 443); |
- AlternativeService bar_alternative_service(QUIC, "bar.c.youtube.com", 1234); |
+ AlternativeService bar_alternative_service(kProtoQUIC, "bar.c.youtube.com", |
+ 1234); |
SetAlternativeService(bar_server, bar_alternative_service); |
AlternativeServiceVector alternative_service_vector = |
impl_.GetAlternativeServices(foo_server); |
@@ -937,7 +939,8 @@ TEST_F(AlternateProtocolServerPropertiesTest, CanonicalOverride) { |
EXPECT_EQ(bar_alternative_service, alternative_service_vector[0]); |
url::SchemeHostPort qux_server("https", "qux.c.youtube.com", 443); |
- AlternativeService qux_alternative_service(QUIC, "qux.c.youtube.com", 443); |
+ AlternativeService qux_alternative_service(kProtoQUIC, "qux.c.youtube.com", |
+ 443); |
SetAlternativeService(qux_server, qux_alternative_service); |
alternative_service_vector = impl_.GetAlternativeServices(foo_server); |
ASSERT_EQ(1u, alternative_service_vector.size()); |
@@ -947,8 +950,8 @@ TEST_F(AlternateProtocolServerPropertiesTest, CanonicalOverride) { |
TEST_F(AlternateProtocolServerPropertiesTest, ClearWithCanonical) { |
url::SchemeHostPort test_server("https", "foo.c.youtube.com", 443); |
url::SchemeHostPort canonical_server("https", "bar.c.youtube.com", 443); |
- AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com", |
- 1234); |
+ AlternativeService canonical_alternative_service(kProtoQUIC, |
+ "bar.c.youtube.com", 1234); |
SetAlternativeService(canonical_server, canonical_alternative_service); |
impl_.Clear(); |
@@ -958,7 +961,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, ClearWithCanonical) { |
TEST_F(AlternateProtocolServerPropertiesTest, |
ExpireBrokenAlternateProtocolMappings) { |
url::SchemeHostPort server("https", "foo", 443); |
- AlternativeService alternative_service(QUIC, "foo", 443); |
+ AlternativeService alternative_service(kProtoQUIC, "foo", 443); |
SetAlternativeService(server, alternative_service); |
EXPECT_TRUE(HasAlternativeService(server)); |
EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); |
@@ -979,17 +982,17 @@ TEST_F(AlternateProtocolServerPropertiesTest, |
// Regression test for https://crbug.com/505413. |
TEST_F(AlternateProtocolServerPropertiesTest, RemoveExpiredBrokenAltSvc) { |
url::SchemeHostPort foo_server("https", "foo", 443); |
- AlternativeService bar_alternative_service(QUIC, "bar", 443); |
+ AlternativeService bar_alternative_service(kProtoQUIC, "bar", 443); |
SetAlternativeService(foo_server, bar_alternative_service); |
EXPECT_TRUE(HasAlternativeService(foo_server)); |
url::SchemeHostPort bar_server1("http", "bar", 80); |
- AlternativeService nohost_alternative_service(QUIC, "", 443); |
+ AlternativeService nohost_alternative_service(kProtoQUIC, "", 443); |
SetAlternativeService(bar_server1, nohost_alternative_service); |
EXPECT_TRUE(HasAlternativeService(bar_server1)); |
url::SchemeHostPort bar_server2("https", "bar", 443); |
- AlternativeService baz_alternative_service(QUIC, "baz", 1234); |
+ AlternativeService baz_alternative_service(kProtoQUIC, "baz", 1234); |
SetAlternativeService(bar_server2, baz_alternative_service); |
EXPECT_TRUE(HasAlternativeService(bar_server2)); |