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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair)); | 247 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair)); |
248 const AlternateProtocolInfo alternate = | 248 const AlternateProtocolInfo alternate = |
249 impl_.GetAlternateProtocol(test_host_port_pair); | 249 impl_.GetAlternateProtocol(test_host_port_pair); |
250 EXPECT_EQ(443, alternate.port); | 250 EXPECT_EQ(443, alternate.port); |
251 EXPECT_EQ(NPN_SPDY_3, alternate.protocol); | 251 EXPECT_EQ(NPN_SPDY_3, alternate.protocol); |
252 | 252 |
253 impl_.Clear(); | 253 impl_.Clear(); |
254 EXPECT_FALSE(impl_.HasAlternateProtocol(test_host_port_pair)); | 254 EXPECT_FALSE(impl_.HasAlternateProtocol(test_host_port_pair)); |
255 } | 255 } |
256 | 256 |
| 257 TEST_F(AlternateProtocolServerPropertiesTest, DefaultProbabilityExcluded) { |
| 258 HostPortPair test_host_port_pair("foo", 80); |
| 259 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, .99); |
| 260 |
| 261 EXPECT_FALSE(impl_.HasAlternateProtocol(test_host_port_pair)); |
| 262 } |
| 263 |
257 TEST_F(AlternateProtocolServerPropertiesTest, Probability) { | 264 TEST_F(AlternateProtocolServerPropertiesTest, Probability) { |
258 impl_.SetAlternateProtocolProbabilityThreshold(.25); | 265 impl_.SetAlternateProtocolProbabilityThreshold(.25); |
259 | 266 |
260 HostPortPair test_host_port_pair("foo", 80); | 267 HostPortPair test_host_port_pair("foo", 80); |
261 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, .5); | 268 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, .5); |
262 | 269 |
263 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair)); | 270 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair)); |
264 const AlternateProtocolInfo alternate = | 271 const AlternateProtocolInfo alternate = |
265 impl_.GetAlternateProtocol(test_host_port_pair); | 272 impl_.GetAlternateProtocol(test_host_port_pair); |
266 EXPECT_EQ(443, alternate.port); | 273 EXPECT_EQ(443, alternate.port); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 it1_ret = settings_map1_it_ret.find(id1); | 675 it1_ret = settings_map1_it_ret.find(id1); |
669 EXPECT_TRUE(it1_ret != settings_map1_it_ret.end()); | 676 EXPECT_TRUE(it1_ret != settings_map1_it_ret.end()); |
670 flags_and_value1_ret = it1_ret->second; | 677 flags_and_value1_ret = it1_ret->second; |
671 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); | 678 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); |
672 EXPECT_EQ(value1, flags_and_value1_ret.second); | 679 EXPECT_EQ(value1, flags_and_value1_ret.second); |
673 } | 680 } |
674 | 681 |
675 } // namespace | 682 } // namespace |
676 | 683 |
677 } // namespace net | 684 } // namespace net |
OLD | NEW |