Index: net/http/http_network_transaction_unittest.cc |
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc |
index 6e1ad43b13812b1f304ae82825c28efcc4559bb4..5335b9e10ebb085b1721f431bbe99a269ad6c5a4 100644 |
--- a/net/http/http_network_transaction_unittest.cc |
+++ b/net/http/http_network_transaction_unittest.cc |
@@ -7614,7 +7614,7 @@ scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( |
base::WeakPtr<HttpServerProperties> http_server_properties = |
session->http_server_properties(); |
- http_server_properties->SetAlternateProtocol( |
+ http_server_properties->AddAlternateProtocol( |
HostPortPair("host.with.alternate", 80), 443, |
AlternateProtocolFromNextProto(next_proto), 1.0); |
@@ -8508,9 +8508,9 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) { |
HostPortPair http_host_port_pair("www.google.com", 80); |
HttpServerProperties& http_server_properties = |
*session->http_server_properties(); |
- AlternateProtocolInfo alternate = |
- http_server_properties.GetAlternateProtocol(http_host_port_pair); |
- EXPECT_EQ(alternate.protocol, UNINITIALIZED_ALTERNATE_PROTOCOL); |
+ AlternateProtocols alternates = |
+ http_server_properties.GetAlternateProtocols(http_host_port_pair); |
+ EXPECT_EQ(0u, alternates.size()); |
EXPECT_EQ(OK, callback.WaitForResult()); |
@@ -8525,10 +8525,12 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) { |
ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
EXPECT_EQ("hello world", response_data); |
- alternate = http_server_properties.GetAlternateProtocol(http_host_port_pair); |
- EXPECT_EQ(443, alternate.port); |
- EXPECT_EQ(AlternateProtocolFromNextProto(GetParam()), alternate.protocol); |
- EXPECT_EQ(1.0, alternate.probability); |
+ alternates = |
+ http_server_properties.GetAlternateProtocols(http_host_port_pair); |
+ ASSERT_EQ(1u, alternates.size()); |
+ EXPECT_EQ(443, alternates[0].port); |
+ EXPECT_EQ(AlternateProtocolFromNextProto(GetParam()), alternates[0].protocol); |
+ EXPECT_EQ(1.0, alternates[0].probability); |
} |
TEST_P(HttpNetworkTransactionTest, |
@@ -8560,9 +8562,9 @@ TEST_P(HttpNetworkTransactionTest, |
session->http_server_properties(); |
// Port must be < 1024, or the header will be ignored (since initial port was |
// port 80 (another restricted port). |
- http_server_properties->SetAlternateProtocol( |
- HostPortPair::FromURL(request.url), |
- 666 /* port is ignored by MockConnect anyway */, |
+ const HostPortPair http_host_port_pair = HostPortPair::FromURL(request.url); |
+ http_server_properties->AddAlternateProtocol( |
+ http_host_port_pair, 666 /* port is ignored by MockConnect anyway */, |
AlternateProtocolFromNextProto(GetParam()), 1.0); |
scoped_ptr<HttpTransaction> trans( |
@@ -8582,11 +8584,13 @@ TEST_P(HttpNetworkTransactionTest, |
ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
EXPECT_EQ("hello world", response_data); |
- const AlternateProtocolInfo alternate = |
- http_server_properties->GetAlternateProtocol( |
- HostPortPair::FromURL(request.url)); |
- EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternate.protocol); |
- EXPECT_TRUE(alternate.is_broken); |
+ const AlternateProtocols alternate_protocols = |
+ http_server_properties->GetAlternateProtocols(http_host_port_pair); |
+ ASSERT_EQ(1u, alternate_protocols.size()); |
+ AlternateProtocolInfo expected_alternate( |
+ 666, AlternateProtocolFromNextProto(GetParam()), 1.0); |
+ EXPECT_TRUE(expected_alternate.Equals(alternate_protocols[0])); |
+ EXPECT_TRUE(alternate_protocols[0].is_broken); |
} |
TEST_P(HttpNetworkTransactionTest, |
@@ -8621,7 +8625,7 @@ TEST_P(HttpNetworkTransactionTest, |
base::WeakPtr<HttpServerProperties> http_server_properties = |
session->http_server_properties(); |
const int kUnrestrictedAlternatePort = 1024; |
- http_server_properties->SetAlternateProtocol( |
+ http_server_properties->AddAlternateProtocol( |
HostPortPair::FromURL(restricted_port_request.url), |
kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), |
1.0); |
@@ -8672,7 +8676,7 @@ TEST_P(HttpNetworkTransactionTest, |
base::WeakPtr<HttpServerProperties> http_server_properties = |
session->http_server_properties(); |
const int kUnrestrictedAlternatePort = 1024; |
- http_server_properties->SetAlternateProtocol( |
+ http_server_properties->AddAlternateProtocol( |
HostPortPair::FromURL(restricted_port_request.url), |
kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), |
1.0); |
@@ -8720,7 +8724,7 @@ TEST_P(HttpNetworkTransactionTest, |
base::WeakPtr<HttpServerProperties> http_server_properties = |
session->http_server_properties(); |
const int kRestrictedAlternatePort = 80; |
- http_server_properties->SetAlternateProtocol( |
+ http_server_properties->AddAlternateProtocol( |
HostPortPair::FromURL(restricted_port_request.url), |
kRestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), |
1.0); |
@@ -8769,7 +8773,7 @@ TEST_P(HttpNetworkTransactionTest, |
base::WeakPtr<HttpServerProperties> http_server_properties = |
session->http_server_properties(); |
const int kRestrictedAlternatePort = 80; |
- http_server_properties->SetAlternateProtocol( |
+ http_server_properties->AddAlternateProtocol( |
HostPortPair::FromURL(unrestricted_port_request.url), |
kRestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), |
1.0); |
@@ -8817,7 +8821,7 @@ TEST_P(HttpNetworkTransactionTest, |
base::WeakPtr<HttpServerProperties> http_server_properties = |
session->http_server_properties(); |
const int kUnrestrictedAlternatePort = 1024; |
- http_server_properties->SetAlternateProtocol( |
+ http_server_properties->AddAlternateProtocol( |
HostPortPair::FromURL(unrestricted_port_request.url), |
kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), |
1.0); |
@@ -8860,7 +8864,7 @@ TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) { |
base::WeakPtr<HttpServerProperties> http_server_properties = |
session->http_server_properties(); |
const int kUnsafePort = 7; |
- http_server_properties->SetAlternateProtocol( |
+ http_server_properties->AddAlternateProtocol( |
HostPortPair::FromURL(request.url), kUnsafePort, |
AlternateProtocolFromNextProto(GetParam()), 1.0); |