diff options
author | bnc <bnc@chromium.org> | 2015-03-17 14:36:47 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-17 21:37:22 +0000 |
commit | 181b39ad8041a4c7655ddff7c328db3cb4cf3e07 (patch) | |
tree | 84968b74bdaa5f06d6b783161e50b79533eb0c71 /net/http/http_server_properties_manager_unittest.cc | |
parent | 81a1bd56b3d3c59ba1deed9ce072fafc8593dc24 (diff) | |
download | chromium_src-181b39ad8041a4c7655ddff7c328db3cb4cf3e07.zip chromium_src-181b39ad8041a4c7655ddff7c328db3cb4cf3e07.tar.gz chromium_src-181b39ad8041a4c7655ddff7c328db3cb4cf3e07.tar.bz2 |
Make GetAlternateProtocol return AlternativeService.
Make HttpServerProperties::GetAlternateProtocol return AlternativeService, and
rename it to GetAlternativeService. Rename its parameter, as well as parameters
of other alternate protocol or alternative service related functions, from
server to origin. Update all clients of GetAlternateProtocol. Also rename
anonymous namespace HasAlternateProtocol to HasAlternativeService in tests.
BUG=392576
Review URL: https://codereview.chromium.org/1017453008
Cr-Commit-Position: refs/heads/master@{#320980}
Diffstat (limited to 'net/http/http_server_properties_manager_unittest.cc')
-rw-r--r-- | net/http/http_server_properties_manager_unittest.cc | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc index f2e3649..e97d3f1 100644 --- a/net/http/http_server_properties_manager_unittest.cc +++ b/net/http/http_server_properties_manager_unittest.cc @@ -135,10 +135,10 @@ class HttpServerPropertiesManagerTest : public testing::Test { UpdatePrefsFromCacheOnNetworkThreadConcrete)); } - bool HasAlternateProtocol(const HostPortPair& server) { - const AlternateProtocolInfo alternate = - http_server_props_manager_->GetAlternateProtocol(server); - return alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL; + bool HasAlternativeService(const HostPortPair& server) { + const AlternativeService alternative_service = + http_server_props_manager_->GetAlternativeService(server); + return alternative_service.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL; } //base::RunLoop loop_; @@ -230,14 +230,14 @@ TEST_F(HttpServerPropertiesManagerTest, HostPortPair::FromString("foo.google.com:1337"))); // Verify AlternateProtocol. - AlternateProtocolInfo port_alternate_protocol = - http_server_props_manager_->GetAlternateProtocol(google_server); - EXPECT_EQ(443, port_alternate_protocol.port); - EXPECT_EQ(NPN_SPDY_3, port_alternate_protocol.protocol); - port_alternate_protocol = - http_server_props_manager_->GetAlternateProtocol(mail_server); - EXPECT_EQ(444, port_alternate_protocol.port); - EXPECT_EQ(NPN_SPDY_3_1, port_alternate_protocol.protocol); + AlternativeService alternative_service = + http_server_props_manager_->GetAlternativeService(google_server); + EXPECT_EQ(443, alternative_service.port); + EXPECT_EQ(NPN_SPDY_3, alternative_service.protocol); + alternative_service = + http_server_props_manager_->GetAlternativeService(mail_server); + EXPECT_EQ(444, alternative_service.port); + EXPECT_EQ(NPN_SPDY_3_1, alternative_service.protocol); // Verify SupportsQuic. IPAddressNumber last_address; @@ -296,7 +296,7 @@ TEST_F(HttpServerPropertiesManagerTest, BadCachedHostPortPair) { EXPECT_FALSE(http_server_props_manager_->SupportsRequestPriority( HostPortPair::FromString("www.google.com:65536"))); EXPECT_FALSE( - HasAlternateProtocol(HostPortPair::FromString("www.google.com:65536"))); + HasAlternativeService(HostPortPair::FromString("www.google.com:65536"))); const ServerNetworkStats* stats1 = http_server_props_manager_->GetServerNetworkStats( HostPortPair::FromString("www.google.com:65536")); @@ -338,7 +338,7 @@ TEST_F(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) { // Verify AlternateProtocol is not set. EXPECT_FALSE( - HasAlternateProtocol(HostPortPair::FromString("www.google.com:80"))); + HasAlternativeService(HostPortPair::FromString("www.google.com:80"))); } TEST_F(HttpServerPropertiesManagerTest, SupportsSpdy) { @@ -462,11 +462,11 @@ TEST_F(HttpServerPropertiesManagerTest, ClearAllSpdySetting) { Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); } -TEST_F(HttpServerPropertiesManagerTest, GetAlternateProtocol) { +TEST_F(HttpServerPropertiesManagerTest, GetAlternativeService) { ExpectPrefsUpdate(); HostPortPair spdy_server_mail("mail.google.com", 80); - EXPECT_FALSE(HasAlternateProtocol(spdy_server_mail)); + EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); http_server_props_manager_->SetAlternateProtocol(spdy_server_mail, 443, NPN_SPDY_3, 1.0); @@ -474,11 +474,10 @@ TEST_F(HttpServerPropertiesManagerTest, GetAlternateProtocol) { base::RunLoop().RunUntilIdle(); Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); - const AlternateProtocolInfo alternate_protocol = - http_server_props_manager_->GetAlternateProtocol(spdy_server_mail); + const AlternativeService alternate_protocol = + http_server_props_manager_->GetAlternativeService(spdy_server_mail); EXPECT_EQ(443, alternate_protocol.port); EXPECT_EQ(NPN_SPDY_3, alternate_protocol.protocol); - EXPECT_EQ(1.0, alternate_protocol.probability); } TEST_F(HttpServerPropertiesManagerTest, SupportsQuic) { @@ -544,7 +543,7 @@ TEST_F(HttpServerPropertiesManagerTest, Clear) { EXPECT_TRUE( http_server_props_manager_->SupportsRequestPriority(spdy_server_mail)); - EXPECT_TRUE(HasAlternateProtocol(spdy_server_mail)); + EXPECT_TRUE(HasAlternativeService(spdy_server_mail)); IPAddressNumber address; EXPECT_TRUE(http_server_props_manager_->GetSupportsQuic(&address)); EXPECT_EQ(actual_address, address); @@ -572,7 +571,7 @@ TEST_F(HttpServerPropertiesManagerTest, Clear) { EXPECT_FALSE( http_server_props_manager_->SupportsRequestPriority(spdy_server_mail)); - EXPECT_FALSE(HasAlternateProtocol(spdy_server_mail)); + EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); EXPECT_FALSE(http_server_props_manager_->GetSupportsQuic(&address)); const ServerNetworkStats* stats2 = http_server_props_manager_->GetServerNetworkStats(spdy_server_mail); @@ -633,11 +632,11 @@ TEST_F(HttpServerPropertiesManagerTest, BadSupportsQuic) { // Verify AlternateProtocol. for (int i = 0; i < 200; ++i) { std::string server = StringPrintf("www.google.com:%d", i); - AlternateProtocolInfo port_alternate_protocol = - http_server_props_manager_->GetAlternateProtocol( + AlternativeService alternative_service = + http_server_props_manager_->GetAlternativeService( HostPortPair::FromString(server)); - EXPECT_EQ(i, port_alternate_protocol.port); - EXPECT_EQ(NPN_SPDY_3, port_alternate_protocol.protocol); + EXPECT_EQ(i, alternative_service.port); + EXPECT_EQ(NPN_SPDY_3, alternative_service.protocol); } // Verify SupportsQuic. |