OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_server_properties_impl.h" | 5 #include "net/http/http_server_properties_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 impl_.SetAlternateProtocol( | 235 impl_.SetAlternateProtocol( |
236 test_host_port_pair, | 236 test_host_port_pair, |
237 1234, | 237 1234, |
238 NPN_SPDY_3); | 238 NPN_SPDY_3); |
239 alternate = impl_.GetAlternateProtocol(test_host_port_pair); | 239 alternate = impl_.GetAlternateProtocol(test_host_port_pair); |
240 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol) | 240 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol) |
241 << "Second attempt should be ignored."; | 241 << "Second attempt should be ignored."; |
242 } | 242 } |
243 | 243 |
| 244 TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) { |
| 245 HostPortPair test_host_port_pair("foo", 80); |
| 246 impl_.SetBrokenAlternateProtocol(test_host_port_pair); |
| 247 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair)); |
| 248 PortAlternateProtocolPair alternate = |
| 249 impl_.GetAlternateProtocol(test_host_port_pair); |
| 250 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol); |
| 251 impl_.ClearAlternateProtocol(test_host_port_pair); |
| 252 EXPECT_FALSE(impl_.HasAlternateProtocol(test_host_port_pair)); |
| 253 } |
| 254 |
244 TEST_F(AlternateProtocolServerPropertiesTest, Forced) { | 255 TEST_F(AlternateProtocolServerPropertiesTest, Forced) { |
245 // Test forced alternate protocols. | 256 // Test forced alternate protocols. |
246 | 257 |
247 PortAlternateProtocolPair default_protocol; | 258 PortAlternateProtocolPair default_protocol; |
248 default_protocol.port = 1234; | 259 default_protocol.port = 1234; |
249 default_protocol.protocol = NPN_SPDY_3; | 260 default_protocol.protocol = NPN_SPDY_3; |
250 HttpServerPropertiesImpl::ForceAlternateProtocol(default_protocol); | 261 HttpServerPropertiesImpl::ForceAlternateProtocol(default_protocol); |
251 | 262 |
252 // Verify the forced protocol. | 263 // Verify the forced protocol. |
253 HostPortPair test_host_port_pair("foo", 80); | 264 HostPortPair test_host_port_pair("foo", 80); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 EXPECT_EQ(value3, flags_and_value3_ret.second); | 440 EXPECT_EQ(value3, flags_and_value3_ret.second); |
430 | 441 |
431 impl_.Clear(); | 442 impl_.Clear(); |
432 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size()); | 443 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size()); |
433 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size()); | 444 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size()); |
434 } | 445 } |
435 | 446 |
436 } // namespace | 447 } // namespace |
437 | 448 |
438 } // namespace net | 449 } // namespace net |
OLD | NEW |