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

Side by Side Diff: net/http/http_server_properties_impl_unittest.cc

Issue 892203004: Make HttpServerProperties::GetSupportsQuic not host-specific. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 flags_and_value1_ret = it1_ret->second; 673 flags_and_value1_ret = it1_ret->second;
674 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); 674 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first);
675 EXPECT_EQ(value1, flags_and_value1_ret.second); 675 EXPECT_EQ(value1, flags_and_value1_ret.second);
676 } 676 }
677 677
678 typedef HttpServerPropertiesImplTest SupportsQuicServerPropertiesTest; 678 typedef HttpServerPropertiesImplTest SupportsQuicServerPropertiesTest;
679 679
680 TEST_F(SupportsQuicServerPropertiesTest, Initialize) { 680 TEST_F(SupportsQuicServerPropertiesTest, Initialize) {
681 HostPortPair quic_server_google("www.google.com", 443); 681 HostPortPair quic_server_google("www.google.com", 443);
682 682
683 // Check by initializing empty SupportsQuic. 683 // Check by initializing empty address.
684 SupportsQuicMap supports_quic_map; 684 IPAddressNumber initial_address;
685 impl_.InitializeSupportsQuic(&supports_quic_map); 685 impl_.InitializeSupportsQuic(&initial_address);
686 SupportsQuic supports_quic = impl_.GetSupportsQuic(quic_server_google);
687 EXPECT_FALSE(supports_quic.used_quic);
688 EXPECT_EQ("", supports_quic.address);
689 686
690 // Check by initializing with www.google.com:443. 687 IPAddressNumber address;
691 SupportsQuic supports_quic1(true, "foo"); 688 EXPECT_FALSE(impl_.GetSupportsQuic(&address));
692 supports_quic_map.insert(std::make_pair(quic_server_google, supports_quic1)); 689 EXPECT_TRUE(address.empty());
693 impl_.InitializeSupportsQuic(&supports_quic_map);
694 690
695 SupportsQuic supports_quic2 = impl_.GetSupportsQuic(quic_server_google); 691 // Check by initializing with a valid address.
696 EXPECT_TRUE(supports_quic2.used_quic); 692 CHECK(ParseIPLiteralToNumber("127.0.0.1", &initial_address));
697 EXPECT_EQ("foo", supports_quic2.address); 693 impl_.InitializeSupportsQuic(&initial_address);
694
695 EXPECT_TRUE(impl_.GetSupportsQuic(&address));
696 EXPECT_EQ(initial_address, address);
698 } 697 }
699 698
700 TEST_F(SupportsQuicServerPropertiesTest, SetSupportsQuic) { 699 TEST_F(SupportsQuicServerPropertiesTest, SetSupportsQuic) {
701 HostPortPair test_host_port_pair("foo", 80); 700 IPAddressNumber address;
702 SupportsQuic supports_quic = impl_.GetSupportsQuic(test_host_port_pair); 701 EXPECT_FALSE(impl_.GetSupportsQuic(&address));
703 EXPECT_FALSE(supports_quic.used_quic); 702 EXPECT_TRUE(address.empty());
704 EXPECT_EQ("", supports_quic.address); 703
705 impl_.SetSupportsQuic(test_host_port_pair, true, "foo"); 704 IPAddressNumber actual_address;
706 SupportsQuic supports_quic1 = impl_.GetSupportsQuic(test_host_port_pair); 705 CHECK(ParseIPLiteralToNumber("127.0.0.1", &actual_address));
707 EXPECT_TRUE(supports_quic1.used_quic); 706 impl_.SetSupportsQuic(true, actual_address);
708 EXPECT_EQ("foo", supports_quic1.address); 707
708 EXPECT_TRUE(impl_.GetSupportsQuic(&address));
709 EXPECT_EQ(actual_address, address);
709 710
710 impl_.Clear(); 711 impl_.Clear();
711 SupportsQuic supports_quic2 = impl_.GetSupportsQuic(test_host_port_pair); 712
712 EXPECT_FALSE(supports_quic2.used_quic); 713 EXPECT_FALSE(impl_.GetSupportsQuic(&address));
713 EXPECT_EQ("", supports_quic2.address);
714 } 714 }
715 715
716 typedef HttpServerPropertiesImplTest ServerNetworkStatsServerPropertiesTest; 716 typedef HttpServerPropertiesImplTest ServerNetworkStatsServerPropertiesTest;
717 717
718 TEST_F(ServerNetworkStatsServerPropertiesTest, Initialize) { 718 TEST_F(ServerNetworkStatsServerPropertiesTest, Initialize) {
719 HostPortPair google_server("www.google.com", 443); 719 HostPortPair google_server("www.google.com", 443);
720 720
721 // Check by initializing empty ServerNetworkStats. 721 // Check by initializing empty ServerNetworkStats.
722 ServerNetworkStatsMap server_network_stats_map( 722 ServerNetworkStatsMap server_network_stats_map(
723 ServerNetworkStatsMap::NO_AUTO_EVICT); 723 ServerNetworkStatsMap::NO_AUTO_EVICT);
(...skipping 28 matching lines...) Expand all
752 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); 752 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond());
753 753
754 impl_.Clear(); 754 impl_.Clear();
755 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server); 755 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server);
756 EXPECT_EQ(NULL, stats3); 756 EXPECT_EQ(NULL, stats3);
757 } 757 }
758 758
759 } // namespace 759 } // namespace
760 760
761 } // namespace net 761 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698