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

Unified Diff: net/http/http_server_properties_impl_unittest.cc

Issue 2496953002: Revert of Unify enum NextProto and enum AlternateProtocol. (Closed)
Patch Set: 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_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5a6136777bc95d85fe2fa985e6912dbf6a5550c5..6031428ba7f8f6a8c5c6fb40c86b5e9cbcdc1889 100644
--- a/net/http/http_server_properties_impl_unittest.cc
+++ b/net/http/http_server_properties_impl_unittest.cc
@@ -247,14 +247,13 @@
// Add www.youtube.com:443 as supporting QUIC.
url::SchemeHostPort youtube_server("https", "www.youtube.com", 443);
- const AlternativeService alternative_service1(kProtoQUIC, "www.youtube.com",
- 443);
+ const AlternativeService alternative_service1(QUIC, "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(kProtoHTTP2, "", 443);
+ const AlternativeService alternative_service2(NPN_HTTP_2, "", 443);
SetAlternativeService(example_server, alternative_service2);
SetAlternativeService(example_server, alternative_service1);
EXPECT_TRUE(impl_.SupportsRequestPriority(example_server));
@@ -383,7 +382,7 @@
url::SchemeHostPort test_server("http", "foo", 80);
EXPECT_FALSE(HasAlternativeService(test_server));
- AlternativeService alternative_service(kProtoHTTP2, "foo", 443);
+ AlternativeService alternative_service(NPN_HTTP_2, "foo", 443);
SetAlternativeService(test_server, alternative_service);
const AlternativeServiceVector alternative_service_vector =
impl_.GetAlternativeServices(test_server);
@@ -398,19 +397,19 @@
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(kProtoHTTP2, "foo", 443);
+ AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service1, expiration));
// Different hostname: GetAlternativeServices should return this one.
- AlternativeService alternative_service2(kProtoHTTP2, "bar", 443);
+ AlternativeService alternative_service2(NPN_HTTP_2, "bar", 443);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, expiration));
// Different port: GetAlternativeServices should return this one too.
- AlternativeService alternative_service3(kProtoHTTP2, "foo", 80);
+ AlternativeService alternative_service3(NPN_HTTP_2, "foo", 80);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service3, expiration));
// QUIC: GetAlternativeServices should return this one too.
- AlternativeService alternative_service4(kProtoQUIC, "foo", 443);
+ AlternativeService alternative_service4(QUIC, "foo", 443);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service4, expiration));
@@ -431,7 +430,7 @@
// |alternative_service_map| does not have an entry for
// |test_server1|.
url::SchemeHostPort test_server1("http", "foo1", 80);
- const AlternativeService alternative_service1(kProtoHTTP2, "bar1", 443);
+ const AlternativeService alternative_service1(NPN_HTTP_2, "bar1", 443);
const base::Time now = base::Time::Now();
base::Time expiration1 = now + base::TimeDelta::FromDays(1);
// 1st entry in the memory.
@@ -442,7 +441,7 @@
// |alternative_service_map| has an entry for
// |test_server2|.
AlternativeServiceInfoVector alternative_service_info_vector;
- const AlternativeService alternative_service2(kProtoHTTP2, "bar2", 443);
+ const AlternativeService alternative_service2(NPN_HTTP_2, "bar2", 443);
base::Time expiration2 = now + base::TimeDelta::FromDays(2);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, expiration2));
@@ -454,7 +453,7 @@
// InitializeAlternativeServiceServers().
AlternativeServiceMap alternative_service_map(
AlternativeServiceMap::NO_AUTO_EVICT);
- const AlternativeService alternative_service3(kProtoHTTP2, "bar3", 123);
+ const AlternativeService alternative_service3(NPN_HTTP_2, "bar3", 123);
base::Time expiration3 = now + base::TimeDelta::FromDays(3);
const AlternativeServiceInfo alternative_service_info1(alternative_service3,
expiration3);
@@ -464,7 +463,7 @@
AlternativeServiceInfoVector(/*size=*/1, alternative_service_info1));
url::SchemeHostPort test_server3("http", "foo3", 80);
- const AlternativeService alternative_service4(kProtoHTTP2, "bar4", 1234);
+ const AlternativeService alternative_service4(NPN_HTTP_2, "bar4", 1234);
base::Time expiration4 = now + base::TimeDelta::FromDays(4);
const AlternativeServiceInfo alternative_service_info2(alternative_service4,
expiration4);
@@ -503,9 +502,9 @@
// hostname is the mapping.
TEST_F(AlternateProtocolServerPropertiesTest, InitializeWithEmptyHostname) {
url::SchemeHostPort server("https", "foo", 443);
- const AlternativeService alternative_service_with_empty_hostname(kProtoHTTP2,
+ const AlternativeService alternative_service_with_empty_hostname(NPN_HTTP_2,
"", 1234);
- const AlternativeService alternative_service_with_foo_hostname(kProtoHTTP2,
+ const AlternativeService alternative_service_with_foo_hostname(NPN_HTTP_2,
"foo", 1234);
SetAlternativeService(server, alternative_service_with_empty_hostname);
impl_.MarkAlternativeServiceBroken(alternative_service_with_foo_hostname);
@@ -528,7 +527,7 @@
// with empty value.
TEST_F(AlternateProtocolServerPropertiesTest, EmptyVector) {
url::SchemeHostPort server("https", "foo", 443);
- const AlternativeService alternative_service(kProtoHTTP2, "bar", 443);
+ const AlternativeService alternative_service(NPN_HTTP_2, "bar", 443);
base::Time expiration = base::Time::Now() - base::TimeDelta::FromDays(1);
const AlternativeServiceInfo alternative_service_info(alternative_service,
expiration);
@@ -564,7 +563,7 @@
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(kProtoHTTP2, "", 443);
+ const AlternativeService alternative_service(NPN_HTTP_2, "", 443);
base::Time expiration = base::Time::Now() - base::TimeDelta::FromDays(1);
const AlternativeServiceInfo alternative_service_info(alternative_service,
expiration);
@@ -601,7 +600,7 @@
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(kProtoQUIC, "", 443);
+ const AlternativeService alternative_service(QUIC, "", 443);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
const AlternativeServiceInfo alternative_service_info(alternative_service,
expiration);
@@ -614,7 +613,7 @@
const AlternativeServiceVector alternative_service_vector =
impl_.GetAlternativeServices(server);
ASSERT_EQ(1u, alternative_service_vector.size());
- EXPECT_EQ(kProtoQUIC, alternative_service_vector[0].protocol);
+ EXPECT_EQ(QUIC, 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
@@ -628,10 +627,10 @@
TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternativeServices) {
url::SchemeHostPort test_server1("http", "foo1", 80);
- const AlternativeService alternative_service1(kProtoHTTP2, "foo1", 443);
+ const AlternativeService alternative_service1(NPN_HTTP_2, "foo1", 443);
SetAlternativeService(test_server1, alternative_service1);
url::SchemeHostPort test_server2("http", "foo2", 80);
- const AlternativeService alternative_service2(kProtoHTTP2, "foo2", 1234);
+ const AlternativeService alternative_service2(NPN_HTTP_2, "foo2", 1234);
SetAlternativeService(test_server2, alternative_service2);
const AlternativeServiceMap& map = impl_.alternative_service_map();
@@ -654,7 +653,7 @@
TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) {
url::SchemeHostPort test_server("http", "foo", 80);
- const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443);
+ const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443);
SetAlternativeService(test_server, alternative_service1);
AlternativeServiceVector alternative_service_vector =
impl_.GetAlternativeServices(test_server);
@@ -674,7 +673,7 @@
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service1, expiration));
- const AlternativeService alternative_service2(kProtoHTTP2, "foo", 1234);
+ const AlternativeService alternative_service2(NPN_HTTP_2, "foo", 1234);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, expiration));
impl_.SetAlternativeServices(test_server, alternative_service_info_vector);
@@ -700,13 +699,13 @@
// First alternative service expired one day ago, should not be returned by
// GetAlternativeServices().
- const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443);
+ const AlternativeService alternative_service1(NPN_HTTP_2, "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(kProtoHTTP2, "bar", 1234);
+ const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, now + one_day));
@@ -726,13 +725,13 @@
// First alternative service expired one day ago, should not be returned by
// GetAlternativeServices().
- const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443);
+ const AlternativeService alternative_service1(NPN_HTTP_2, "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(kProtoHTTP2, "bar", 1234);
+ const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, now + one_day));
@@ -749,11 +748,11 @@
TEST_F(AlternateProtocolServerPropertiesTest, AlternativeServiceWithScheme) {
AlternativeServiceInfoVector alternative_service_info_vector;
- const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443);
+ const AlternativeService alternative_service1(NPN_HTTP_2, "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(kProtoHTTP2, "bar", 1234);
+ const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, expiration));
// Set Alt-Svc list for |http_server|.
@@ -785,11 +784,11 @@
TEST_F(AlternateProtocolServerPropertiesTest, ClearAlternativeServices) {
AlternativeServiceInfoVector alternative_service_info_vector;
- const AlternativeService alternative_service1(kProtoHTTP2, "foo", 443);
+ const AlternativeService alternative_service1(NPN_HTTP_2, "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(kProtoHTTP2, "bar", 1234);
+ const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, expiration));
url::SchemeHostPort test_server("http", "foo", 80);
@@ -813,15 +812,15 @@
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(kProtoQUIC,
- "bar.c.youtube.com", 1234);
+ AlternativeService canonical_alternative_service(QUIC, "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(kProtoHTTP2, "foo", 443);
+ const AlternativeService broken_alternative_service(NPN_HTTP_2, "foo", 443);
impl_.MarkAlternativeServiceBroken(broken_alternative_service);
EXPECT_TRUE(impl_.IsAlternativeServiceBroken(broken_alternative_service));
@@ -834,7 +833,7 @@
TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) {
url::SchemeHostPort test_server("http", "foo", 80);
- const AlternativeService alternative_service(kProtoHTTP2, "foo", 443);
+ const AlternativeService alternative_service(NPN_HTTP_2, "foo", 443);
SetAlternativeService(test_server, alternative_service);
impl_.MarkAlternativeServiceBroken(alternative_service);
ASSERT_TRUE(HasAlternativeService(test_server));
@@ -847,7 +846,7 @@
TEST_F(AlternateProtocolServerPropertiesTest, MarkRecentlyBroken) {
url::SchemeHostPort server("http", "foo", 80);
- const AlternativeService alternative_service(kProtoHTTP2, "foo", 443);
+ const AlternativeService alternative_service(NPN_HTTP_2, "foo", 443);
SetAlternativeService(server, alternative_service);
EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
@@ -871,11 +870,11 @@
AlternativeServiceInfoVector alternative_service_info_vector;
const AlternativeService canonical_alternative_service1(
- kProtoQUIC, "bar.c.youtube.com", 1234);
+ QUIC, "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(kProtoHTTP2, "", 443);
+ const AlternativeService canonical_alternative_service2(NPN_HTTP_2, "", 443);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(canonical_alternative_service2, expiration));
impl_.SetAlternativeServices(canonical_server,
@@ -906,8 +905,8 @@
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(kProtoQUIC,
- "bar.c.youtube.com", 1234);
+ AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
+ 1234);
SetAlternativeService(canonical_server, canonical_alternative_service);
impl_.SetAlternativeServices(canonical_server,
@@ -918,8 +917,8 @@
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(kProtoQUIC,
- "bar.c.youtube.com", 1234);
+ AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
+ 1234);
SetAlternativeService(canonical_server, canonical_alternative_service);
impl_.MarkAlternativeServiceBroken(canonical_alternative_service);
@@ -930,8 +929,7 @@
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(kProtoQUIC, "bar.c.youtube.com",
- 1234);
+ AlternativeService bar_alternative_service(QUIC, "bar.c.youtube.com", 1234);
SetAlternativeService(bar_server, bar_alternative_service);
AlternativeServiceVector alternative_service_vector =
impl_.GetAlternativeServices(foo_server);
@@ -939,8 +937,7 @@
EXPECT_EQ(bar_alternative_service, alternative_service_vector[0]);
url::SchemeHostPort qux_server("https", "qux.c.youtube.com", 443);
- AlternativeService qux_alternative_service(kProtoQUIC, "qux.c.youtube.com",
- 443);
+ AlternativeService qux_alternative_service(QUIC, "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());
@@ -950,8 +947,8 @@
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(kProtoQUIC,
- "bar.c.youtube.com", 1234);
+ AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
+ 1234);
SetAlternativeService(canonical_server, canonical_alternative_service);
impl_.Clear();
@@ -961,7 +958,7 @@
TEST_F(AlternateProtocolServerPropertiesTest,
ExpireBrokenAlternateProtocolMappings) {
url::SchemeHostPort server("https", "foo", 443);
- AlternativeService alternative_service(kProtoQUIC, "foo", 443);
+ AlternativeService alternative_service(QUIC, "foo", 443);
SetAlternativeService(server, alternative_service);
EXPECT_TRUE(HasAlternativeService(server));
EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
@@ -982,17 +979,17 @@
// Regression test for https://crbug.com/505413.
TEST_F(AlternateProtocolServerPropertiesTest, RemoveExpiredBrokenAltSvc) {
url::SchemeHostPort foo_server("https", "foo", 443);
- AlternativeService bar_alternative_service(kProtoQUIC, "bar", 443);
+ AlternativeService bar_alternative_service(QUIC, "bar", 443);
SetAlternativeService(foo_server, bar_alternative_service);
EXPECT_TRUE(HasAlternativeService(foo_server));
url::SchemeHostPort bar_server1("http", "bar", 80);
- AlternativeService nohost_alternative_service(kProtoQUIC, "", 443);
+ AlternativeService nohost_alternative_service(QUIC, "", 443);
SetAlternativeService(bar_server1, nohost_alternative_service);
EXPECT_TRUE(HasAlternativeService(bar_server1));
url::SchemeHostPort bar_server2("https", "bar", 443);
- AlternativeService baz_alternative_service(kProtoQUIC, "baz", 1234);
+ AlternativeService baz_alternative_service(QUIC, "baz", 1234);
SetAlternativeService(bar_server2, baz_alternative_service);
EXPECT_TRUE(HasAlternativeService(bar_server2));
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698