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 39d58ebab9fda98ee89e465b8a235f32c9cca00b..5625d1af9d0fb40fa3f43d98ea818ad9e137a0a3 100644 |
--- a/net/http/http_network_transaction_unittest.cc |
+++ b/net/http/http_network_transaction_unittest.cc |
@@ -7864,7 +7864,7 @@ scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( |
session->http_server_properties(); |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(next_proto), "", 443); |
- http_server_properties->SetAlternativeService( |
+ http_server_properties->AddAlternativeService( |
HostPortPair("host.with.alternate", 80), alternative_service, 1.0); |
return session; |
@@ -8746,9 +8746,9 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) { |
HostPortPair http_host_port_pair("www.example.org", 80); |
HttpServerProperties& http_server_properties = |
*session->http_server_properties(); |
- AlternativeService alternative_service = |
- http_server_properties.GetAlternativeService(http_host_port_pair); |
- EXPECT_EQ(alternative_service.protocol, UNINITIALIZED_ALTERNATE_PROTOCOL); |
+ AlternativeServiceVector alternative_service_vector = |
+ http_server_properties.GetAlternativeServices(http_host_port_pair); |
+ EXPECT_EQ(0u, alternative_service_vector.size()); |
EXPECT_EQ(OK, callback.WaitForResult()); |
@@ -8763,11 +8763,12 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) { |
ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
EXPECT_EQ("hello world", response_data); |
- alternative_service = |
- http_server_properties.GetAlternativeService(http_host_port_pair); |
- EXPECT_EQ(443, alternative_service.port); |
+ alternative_service_vector = |
+ http_server_properties.GetAlternativeServices(http_host_port_pair); |
+ ASSERT_EQ(1u, alternative_service_vector.size()); |
+ EXPECT_EQ(443, alternative_service_vector[0].port); |
EXPECT_EQ(AlternateProtocolFromNextProto(GetParam()), |
- alternative_service.protocol); |
+ alternative_service_vector[0].protocol); |
} |
TEST_P(HttpNetworkTransactionTest, EmptyAlternateProtocolHeader) { |
@@ -8798,12 +8799,13 @@ TEST_P(HttpNetworkTransactionTest, EmptyAlternateProtocolHeader) { |
HttpServerProperties& http_server_properties = |
*session->http_server_properties(); |
AlternativeService alternative_service(QUIC, "", 80); |
- http_server_properties.SetAlternativeService(http_host_port_pair, |
+ http_server_properties.AddAlternativeService(http_host_port_pair, |
alternative_service, 1.0); |
- alternative_service = |
- http_server_properties.GetAlternativeService(http_host_port_pair); |
- EXPECT_EQ(alternative_service.protocol, QUIC); |
+ AlternativeServiceVector alternative_service_vector = |
+ http_server_properties.GetAlternativeServices(http_host_port_pair); |
+ ASSERT_EQ(1u, alternative_service_vector.size()); |
+ EXPECT_EQ(QUIC, alternative_service_vector[0].protocol); |
scoped_ptr<HttpTransaction> trans( |
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
@@ -8824,9 +8826,9 @@ TEST_P(HttpNetworkTransactionTest, EmptyAlternateProtocolHeader) { |
ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
EXPECT_EQ("hello world", response_data); |
- alternative_service = |
- http_server_properties.GetAlternativeService(http_host_port_pair); |
- EXPECT_EQ(alternative_service.protocol, UNINITIALIZED_ALTERNATE_PROTOCOL); |
+ alternative_service_vector = |
+ http_server_properties.GetAlternativeServices(http_host_port_pair); |
+ EXPECT_EQ(0u, alternative_service_vector.size()); |
} |
TEST_P(HttpNetworkTransactionTest, |
@@ -8859,10 +8861,10 @@ TEST_P(HttpNetworkTransactionTest, |
const HostPortPair host_port_pair = HostPortPair::FromURL(request.url); |
// Port must be < 1024, or the header will be ignored (since initial port was |
// port 80 (another restricted port). |
- AlternativeService alternative_service( |
+ const AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
- 666); /* port is ignored by MockConnect anyway */ |
- http_server_properties->SetAlternativeService(host_port_pair, |
+ 666); // Port is ignored by MockConnect anyway. |
+ http_server_properties->AddAlternativeService(host_port_pair, |
alternative_service, 1.0); |
scoped_ptr<HttpTransaction> trans( |
@@ -8882,11 +8884,12 @@ TEST_P(HttpNetworkTransactionTest, |
ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
EXPECT_EQ("hello world", response_data); |
- alternative_service = |
- http_server_properties->GetAlternativeService(host_port_pair); |
- EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternative_service.protocol); |
- EXPECT_TRUE( |
- http_server_properties->IsAlternativeServiceBroken(alternative_service)); |
+ const AlternativeServiceVector alternative_service_vector = |
+ http_server_properties->GetAlternativeServices(host_port_pair); |
+ ASSERT_EQ(1u, alternative_service_vector.size()); |
+ EXPECT_EQ(alternative_service, alternative_service_vector[0]); |
+ EXPECT_TRUE(http_server_properties->IsAlternativeServiceBroken( |
+ alternative_service_vector[0])); |
} |
TEST_P(HttpNetworkTransactionTest, |
@@ -8924,7 +8927,7 @@ TEST_P(HttpNetworkTransactionTest, |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
kUnrestrictedAlternatePort); |
- http_server_properties->SetAlternativeService( |
+ http_server_properties->AddAlternativeService( |
HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
1.0); |
@@ -8977,7 +8980,7 @@ TEST_P(HttpNetworkTransactionTest, |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
kUnrestrictedAlternatePort); |
- http_server_properties->SetAlternativeService( |
+ http_server_properties->AddAlternativeService( |
HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
1.0); |
@@ -9027,7 +9030,7 @@ TEST_P(HttpNetworkTransactionTest, |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
kRestrictedAlternatePort); |
- http_server_properties->SetAlternativeService( |
+ http_server_properties->AddAlternativeService( |
HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
1.0); |
@@ -9078,7 +9081,7 @@ TEST_P(HttpNetworkTransactionTest, |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
kRestrictedAlternatePort); |
- http_server_properties->SetAlternativeService( |
+ http_server_properties->AddAlternativeService( |
HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, |
1.0); |
@@ -9128,7 +9131,7 @@ TEST_P(HttpNetworkTransactionTest, |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
kUnrestrictedAlternatePort); |
- http_server_properties->SetAlternativeService( |
+ http_server_properties->AddAlternativeService( |
HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, |
1.0); |
@@ -9173,7 +9176,7 @@ TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) { |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
kUnsafePort); |
- http_server_properties->SetAlternativeService( |
+ http_server_properties->AddAlternativeService( |
HostPortPair::FromURL(request.url), alternative_service, 1.0); |
scoped_ptr<HttpTransaction> trans( |
@@ -11824,7 +11827,7 @@ class AltSvcCertificateVerificationTest : public HttpNetworkTransactionTest { |
session->http_server_properties(); |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), alternative); |
- http_server_properties->SetAlternativeService(origin, alternative_service, |
+ http_server_properties->AddAlternativeService(origin, alternative_service, |
1.0); |
// First request to alternative. |
@@ -11928,7 +11931,7 @@ TEST_P(HttpNetworkTransactionTest, AlternativeServiceNotOnHttp11) { |
session->http_server_properties(); |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), alternative); |
- http_server_properties->SetAlternativeService(origin, alternative_service, |
+ http_server_properties->AddAlternativeService(origin, alternative_service, |
1.0); |
scoped_ptr<HttpTransaction> trans( |
@@ -12000,7 +12003,7 @@ TEST_P(HttpNetworkTransactionTest, FailedAlternativeServiceIsNotUserVisible) { |
session->http_server_properties(); |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), alternative); |
- http_server_properties->SetAlternativeService(origin, alternative_service, |
+ http_server_properties->AddAlternativeService(origin, alternative_service, |
1.0); |
HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); |
@@ -12108,7 +12111,7 @@ TEST_P(HttpNetworkTransactionTest, AlternativeServiceShouldNotPoolToHttp11) { |
session->http_server_properties(); |
AlternativeService alternative_service( |
AlternateProtocolFromNextProto(GetParam()), alternative); |
- http_server_properties->SetAlternativeService(origin, alternative_service, |
+ http_server_properties->AddAlternativeService(origin, alternative_service, |
1.0); |
// First transaction to alternative to open an HTTP/1.1 socket. |