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

Unified Diff: net/http/http_server_properties_impl_unittest.cc

Issue 2069203003: Make Alt-Svc: clear work with canonical hosts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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_impl.cc ('k') | no next file » | 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 6be50440e9d9b1e0a69affb617140ece8922f389..ea6177b83ad30718deb306aef9e7e1ec0294af69 100644
--- a/net/http/http_server_properties_impl_unittest.cc
+++ b/net/http/http_server_properties_impl_unittest.cc
@@ -597,6 +597,34 @@ TEST_F(AlternateProtocolServerPropertiesTest, EmptyVectorForCanonical) {
ASSERT_TRUE(alternative_service_vector.empty());
}
+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);
+ base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
+ const AlternativeServiceInfo alternative_service_info(alternative_service,
+ expiration);
+
+ impl_.SetAlternativeServices(
+ canonical_server,
+ AlternativeServiceInfoVector(/*size=*/1, alternative_service_info));
+
+ // Make sure the canonical service is returned for the other server.
+ 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(443, alternative_service_vector[0].port);
+
+ // Now clear the alternatives for the other server and make sure it stays
+ // cleared.
+ // GetAlternativeServices() should remove this key from
+ // |alternative_service_map_|, and SetAlternativeServices() should not crash.
+ impl_.SetAlternativeServices(server, AlternativeServiceInfoVector());
+
+ ASSERT_TRUE(impl_.GetAlternativeServices(server).empty());
+}
+
TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternativeServices) {
url::SchemeHostPort test_server1("http", "foo1", 80);
const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo1", 443);
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698