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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 EXPECT_TRUE(it->first.Equals(spdy_server_google)); | 672 EXPECT_TRUE(it->first.Equals(spdy_server_google)); |
673 const SettingsMap& settings_map1_it_ret = it->second; | 673 const SettingsMap& settings_map1_it_ret = it->second; |
674 ASSERT_EQ(1U, settings_map1_it_ret.size()); | 674 ASSERT_EQ(1U, settings_map1_it_ret.size()); |
675 it1_ret = settings_map1_it_ret.find(id1); | 675 it1_ret = settings_map1_it_ret.find(id1); |
676 EXPECT_TRUE(it1_ret != settings_map1_it_ret.end()); | 676 EXPECT_TRUE(it1_ret != settings_map1_it_ret.end()); |
677 flags_and_value1_ret = it1_ret->second; | 677 flags_and_value1_ret = it1_ret->second; |
678 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); | 678 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); |
679 EXPECT_EQ(value1, flags_and_value1_ret.second); | 679 EXPECT_EQ(value1, flags_and_value1_ret.second); |
680 } | 680 } |
681 | 681 |
| 682 typedef HttpServerPropertiesImplTest SupportsQuicServerPropertiesTest; |
| 683 |
| 684 TEST_F(SupportsQuicServerPropertiesTest, Initialize) { |
| 685 HostPortPair quic_server_google("www.google.com", 443); |
| 686 |
| 687 // Check by initializing empty SupportsQuic. |
| 688 SupportsQuicMap supports_quic_map; |
| 689 impl_.InitializeSupportsQuic(&supports_quic_map); |
| 690 SupportsQuic supports_quic = impl_.GetSupportsQuic(quic_server_google); |
| 691 EXPECT_FALSE(supports_quic.used_quic); |
| 692 EXPECT_EQ("", supports_quic.address); |
| 693 |
| 694 // Check by initializing with www.google.com:443. |
| 695 SupportsQuic supports_quic1(true, "foo"); |
| 696 supports_quic_map.insert(std::make_pair(quic_server_google, supports_quic1)); |
| 697 impl_.InitializeSupportsQuic(&supports_quic_map); |
| 698 |
| 699 SupportsQuic supports_quic2 = impl_.GetSupportsQuic(quic_server_google); |
| 700 EXPECT_TRUE(supports_quic2.used_quic); |
| 701 EXPECT_EQ("foo", supports_quic2.address); |
| 702 } |
| 703 |
| 704 TEST_F(SupportsQuicServerPropertiesTest, SetSupportsQuic) { |
| 705 HostPortPair test_host_port_pair("foo", 80); |
| 706 SupportsQuic supports_quic = impl_.GetSupportsQuic(test_host_port_pair); |
| 707 EXPECT_FALSE(supports_quic.used_quic); |
| 708 EXPECT_EQ("", supports_quic.address); |
| 709 impl_.SetSupportsQuic(test_host_port_pair, true, "foo"); |
| 710 SupportsQuic supports_quic1 = impl_.GetSupportsQuic(test_host_port_pair); |
| 711 EXPECT_TRUE(supports_quic1.used_quic); |
| 712 EXPECT_EQ("foo", supports_quic1.address); |
| 713 |
| 714 impl_.Clear(); |
| 715 SupportsQuic supports_quic2 = impl_.GetSupportsQuic(test_host_port_pair); |
| 716 EXPECT_FALSE(supports_quic2.used_quic); |
| 717 EXPECT_EQ("", supports_quic2.address); |
| 718 } |
682 } // namespace | 719 } // namespace |
683 | 720 |
684 } // namespace net | 721 } // namespace net |
OLD | NEW |