Chromium Code Reviews| 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); |