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

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 665083009: ABANDONED Handle multiple AlternateProtocols for each HostPortPair. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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 be94493558b4b68e045781d923632249df4c4c27..e17806d65fc34535b50af3cb4ce4b870e866a706 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -7537,7 +7537,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);
@@ -8448,11 +8448,12 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) {
EXPECT_EQ("hello world", response_data);
ASSERT_TRUE(http_server_properties.HasAlternateProtocol(http_host_port_pair));
- const AlternateProtocolInfo alternate =
- http_server_properties.GetAlternateProtocol(http_host_port_pair);
+ const AlternateProtocols alternate_protocols =
+ http_server_properties.GetAlternateProtocols(http_host_port_pair);
+ ASSERT_EQ(1u, alternate_protocols.size());
AlternateProtocolInfo expected_alternate(
443, AlternateProtocolFromNextProto(GetParam()), 1);
- EXPECT_TRUE(expected_alternate.Equals(alternate));
+ EXPECT_TRUE(expected_alternate.Equals(alternate_protocols[0]));
}
TEST_P(HttpNetworkTransactionTest,
@@ -8484,7 +8485,7 @@ 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(
+ http_server_properties->AddAlternateProtocol(
HostPortPair::FromURL(request.url),
666 /* port is ignored by MockConnect anyway */,
AlternateProtocolFromNextProto(GetParam()), 1);
@@ -8508,9 +8509,11 @@ TEST_P(HttpNetworkTransactionTest,
ASSERT_TRUE(http_server_properties->HasAlternateProtocol(
HostPortPair::FromURL(request.url)));
- const AlternateProtocolInfo alternate =
- http_server_properties->GetAlternateProtocol(
+ const AlternateProtocols alternate_protocols =
+ http_server_properties->GetAlternateProtocols(
HostPortPair::FromURL(request.url));
+ ASSERT_EQ(1u, alternate_protocols.size());
+ const AlternateProtocolInfo alternate = alternate_protocols[0];
EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol);
}
@@ -8546,7 +8549,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);
@@ -8597,7 +8600,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);
@@ -8645,7 +8648,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);
@@ -8694,7 +8697,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);
@@ -8742,7 +8745,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);
@@ -8785,7 +8788,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);

Powered by Google App Engine
This is Rietveld 408576698