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

Unified Diff: net/http/http_server_properties_manager_unittest.cc

Issue 2932503005: Change AlternativeServiceInfo to a class (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « net/http/http_server_properties_manager.cc ('k') | net/http/http_stream_factory_impl_job_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_manager_unittest.cc
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc
index b10b3379edbd85b948d92e042e13282fb16e4a70..4460fa76079ed4f23ab394ffc455feae7fe20f77 100644
--- a/net/http/http_server_properties_manager_unittest.cc
+++ b/net/http/http_server_properties_manager_unittest.cc
@@ -414,18 +414,18 @@ TEST_P(HttpServerPropertiesManagerTest,
AlternativeServiceMap::const_iterator map_it = map.begin();
EXPECT_EQ("mail.google.com", map_it->first.host());
ASSERT_EQ(1u, map_it->second.size());
- EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service.protocol);
- EXPECT_TRUE(map_it->second[0].alternative_service.host.empty());
- EXPECT_EQ(444, map_it->second[0].alternative_service.port);
+ EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol);
+ EXPECT_TRUE(map_it->second[0].alternative_service().host.empty());
+ EXPECT_EQ(444, map_it->second[0].alternative_service().port);
++map_it;
EXPECT_EQ("www.google.com", map_it->first.host());
ASSERT_EQ(2u, map_it->second.size());
- EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service.protocol);
- EXPECT_TRUE(map_it->second[0].alternative_service.host.empty());
- EXPECT_EQ(443, map_it->second[0].alternative_service.port);
- EXPECT_EQ(kProtoQUIC, map_it->second[1].alternative_service.protocol);
- EXPECT_TRUE(map_it->second[1].alternative_service.host.empty());
- EXPECT_EQ(1234, map_it->second[1].alternative_service.port);
+ EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol);
+ EXPECT_TRUE(map_it->second[0].alternative_service().host.empty());
+ EXPECT_EQ(443, map_it->second[0].alternative_service().port);
+ EXPECT_EQ(kProtoQUIC, map_it->second[1].alternative_service().protocol);
+ EXPECT_TRUE(map_it->second[1].alternative_service().host.empty());
+ EXPECT_EQ(1234, map_it->second[1].alternative_service().port);
} else {
const AlternativeServiceMap& map =
http_server_props_manager_->alternative_service_map();
@@ -433,18 +433,18 @@ TEST_P(HttpServerPropertiesManagerTest,
AlternativeServiceMap::const_iterator map_it = map.begin();
EXPECT_EQ("www.google.com", map_it->first.host());
ASSERT_EQ(2u, map_it->second.size());
- EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service.protocol);
- EXPECT_TRUE(map_it->second[0].alternative_service.host.empty());
- EXPECT_EQ(443, map_it->second[0].alternative_service.port);
- EXPECT_EQ(kProtoQUIC, map_it->second[1].alternative_service.protocol);
- EXPECT_TRUE(map_it->second[1].alternative_service.host.empty());
- EXPECT_EQ(1234, map_it->second[1].alternative_service.port);
+ EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol);
+ EXPECT_TRUE(map_it->second[0].alternative_service().host.empty());
+ EXPECT_EQ(443, map_it->second[0].alternative_service().port);
+ EXPECT_EQ(kProtoQUIC, map_it->second[1].alternative_service().protocol);
+ EXPECT_TRUE(map_it->second[1].alternative_service().host.empty());
+ EXPECT_EQ(1234, map_it->second[1].alternative_service().port);
++map_it;
EXPECT_EQ("mail.google.com", map_it->first.host());
ASSERT_EQ(1u, map_it->second.size());
- EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service.protocol);
- EXPECT_TRUE(map_it->second[0].alternative_service.host.empty());
- EXPECT_EQ(444, map_it->second[0].alternative_service.port);
+ EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol);
+ EXPECT_TRUE(map_it->second[0].alternative_service().host.empty());
+ EXPECT_EQ(444, map_it->second[0].alternative_service().port);
}
// Verify SupportsQuic.
@@ -749,7 +749,7 @@ TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServiceInfos) {
http_server_props_manager_->GetAlternativeServiceInfos(spdy_server_mail);
ASSERT_EQ(1u, alternative_service_info_vector.size());
EXPECT_EQ(alternative_service,
- alternative_service_info_vector[0].alternative_service);
+ alternative_service_info_vector[0].alternative_service());
}
TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) {
@@ -788,9 +788,9 @@ TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) {
http_server_props_manager_->GetAlternativeServiceInfos(spdy_server_mail);
ASSERT_EQ(2u, alternative_service_info_vector2.size());
EXPECT_EQ(alternative_service1,
- alternative_service_info_vector2[0].alternative_service);
+ alternative_service_info_vector2[0].alternative_service());
EXPECT_EQ(alternative_service2,
- alternative_service_info_vector2[1].alternative_service);
+ alternative_service_info_vector2[1].alternative_service());
}
TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServicesEmpty) {
@@ -1145,9 +1145,10 @@ TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) {
AlternativeServiceInfoVector alternative_service_info_vector =
http_server_props_manager_->GetAlternativeServiceInfos(server);
ASSERT_EQ(1u, alternative_service_info_vector.size());
- EXPECT_EQ(kProtoQUIC,
- alternative_service_info_vector[0].alternative_service.protocol);
- EXPECT_EQ(i, alternative_service_info_vector[0].alternative_service.port);
+ EXPECT_EQ(
+ kProtoQUIC,
+ alternative_service_info_vector[0].alternative_service().protocol);
+ EXPECT_EQ(i, alternative_service_info_vector[0].alternative_service().port);
}
// Verify SupportsQuic.
@@ -1294,31 +1295,33 @@ TEST_P(HttpServerPropertiesManagerTest, AddToAlternativeServiceMap) {
ASSERT_EQ(3u, alternative_service_info_vector.size());
EXPECT_EQ(kProtoHTTP2,
- alternative_service_info_vector[0].alternative_service.protocol);
- EXPECT_EQ("", alternative_service_info_vector[0].alternative_service.host);
- EXPECT_EQ(443, alternative_service_info_vector[0].alternative_service.port);
+ alternative_service_info_vector[0].alternative_service().protocol);
+ EXPECT_EQ("", alternative_service_info_vector[0].alternative_service().host);
+ EXPECT_EQ(443, alternative_service_info_vector[0].alternative_service().port);
// Expiration defaults to one day from now, testing with tolerance.
const base::Time now = base::Time::Now();
- const base::Time expiration = alternative_service_info_vector[0].expiration;
+ const base::Time expiration = alternative_service_info_vector[0].expiration();
EXPECT_LE(now + base::TimeDelta::FromHours(23), expiration);
EXPECT_GE(now + base::TimeDelta::FromDays(1), expiration);
EXPECT_EQ(kProtoQUIC,
- alternative_service_info_vector[1].alternative_service.protocol);
- EXPECT_EQ("", alternative_service_info_vector[1].alternative_service.host);
- EXPECT_EQ(123, alternative_service_info_vector[1].alternative_service.port);
+ alternative_service_info_vector[1].alternative_service().protocol);
+ EXPECT_EQ("", alternative_service_info_vector[1].alternative_service().host);
+ EXPECT_EQ(123, alternative_service_info_vector[1].alternative_service().port);
// numeric_limits<int64_t>::max() represents base::Time::Max().
- EXPECT_EQ(base::Time::Max(), alternative_service_info_vector[1].expiration);
+ EXPECT_EQ(base::Time::Max(), alternative_service_info_vector[1].expiration());
EXPECT_EQ(kProtoHTTP2,
- alternative_service_info_vector[2].alternative_service.protocol);
+ alternative_service_info_vector[2].alternative_service().protocol);
EXPECT_EQ("example.org",
- alternative_service_info_vector[2].alternative_service.host);
- EXPECT_EQ(1234, alternative_service_info_vector[2].alternative_service.port);
+ alternative_service_info_vector[2].alternative_service().host);
+ EXPECT_EQ(1234,
+ alternative_service_info_vector[2].alternative_service().port);
base::Time expected_expiration;
ASSERT_TRUE(
base::Time::FromUTCString("2036-12-31 10:00:00", &expected_expiration));
- EXPECT_EQ(expected_expiration, alternative_service_info_vector[2].expiration);
+ EXPECT_EQ(expected_expiration,
+ alternative_service_info_vector[2].expiration());
}
// Regression test for https://crbug.com/615497.
@@ -1459,11 +1462,11 @@ TEST_P(HttpServerPropertiesManagerTest, DoNotLoadExpiredAlternativeService) {
ASSERT_EQ(1u, alternative_service_info_vector.size());
EXPECT_EQ(kProtoHTTP2,
- alternative_service_info_vector[0].alternative_service.protocol);
+ alternative_service_info_vector[0].alternative_service().protocol);
EXPECT_EQ("valid.example.com",
- alternative_service_info_vector[0].alternative_service.host);
- EXPECT_EQ(443, alternative_service_info_vector[0].alternative_service.port);
- EXPECT_EQ(one_day_from_now_, alternative_service_info_vector[0].expiration);
+ alternative_service_info_vector[0].alternative_service().host);
+ EXPECT_EQ(443, alternative_service_info_vector[0].alternative_service().port);
+ EXPECT_EQ(one_day_from_now_, alternative_service_info_vector[0].expiration());
}
TEST_P(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdateCache0) {
« no previous file with comments | « net/http/http_server_properties_manager.cc ('k') | net/http/http_stream_factory_impl_job_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698