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

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: Extend test. 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..5bbdf890fa6a482c585714f7310b481399c6f311 100644
--- a/net/http/http_server_properties_impl_unittest.cc
+++ b/net/http/http_server_properties_impl_unittest.cc
@@ -365,6 +365,28 @@ 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_TRUE(impl_.GetAlternativeService(test_host_port_pair) ==
Ryan Hamilton 2015/06/24 21:08:32 nit: Does ASSERT_EQ() work?
Bence 2015/06/25 11:24:34 Oops, it does work. Sorry, I thought I need to in
+ broken_alternative_service);
+}
Ryan Hamilton 2015/06/24 21:08:32 Can you also verify that: EXPECT_TRUE(impl_.IsAlt
Bence 2015/06/25 11:24:34 Done.
+
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