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

Unified Diff: net/http/http_server_properties_impl_unittest.cc

Issue 1205633002: Set alternative service even if it is broken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #7. Created 5 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 a0a9ff2984b51e1a452e0bfe0a5633add1778351..671f72280287d9fa7ae95dd0e54d5826fe91c34c 100644
--- a/net/http/http_server_properties_impl_unittest.cc
+++ b/net/http/http_server_properties_impl_unittest.cc
@@ -365,6 +365,29 @@ TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) {
EXPECT_EQ(1234, impl_.GetAlternativeService(test_host_port_pair).port);
}
+// A broken alternative service in the mapping carries meaningful information,
+// therefore it should not be ignored by SetAlternativeService(). In
+// particular, an alternative service mapped to an origin shadows alternative
+// services of canonical hosts.
+TEST_F(AlternateProtocolServerPropertiesTest, BrokenShadowsCanonical) {
+ HostPortPair test_host_port_pair("foo.c.youtube.com", 80);
+ HostPortPair canonical_port_pair("bar.c.youtube.com", 80);
+ AlternativeService canonical_altsvc(QUIC, "bar.c.youtube.com", 1234);
+ impl_.SetAlternativeService(canonical_port_pair, canonical_altsvc, 1.0);
+ EXPECT_TRUE(impl_.GetAlternativeService(test_host_port_pair) ==
+ canonical_altsvc);
+
+ const AlternativeService broken_alternative_service(NPN_SPDY_4, "foo", 443);
+ impl_.MarkAlternativeServiceBroken(broken_alternative_service);
+ EXPECT_TRUE(impl_.IsAlternativeServiceBroken(broken_alternative_service));
+
+ impl_.SetAlternativeService(test_host_port_pair, broken_alternative_service,
+ 1.0);
+ ASSERT_EQ(broken_alternative_service,
+ impl_.GetAlternativeService(test_host_port_pair));
+ EXPECT_TRUE(impl_.IsAlternativeServiceBroken(broken_alternative_service));
+}
+
TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) {
HostPortPair test_host_port_pair("foo", 80);
const AlternativeService alternative_service(NPN_SPDY_4, "foo", 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