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

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 1018943002: Update HttpServerProperties::*AlternateProtocol* interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 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 8f89e416d9e47f870f8f6bdda49c4a505a9efa13..a481c533012bd0e88b2a30c9f14176baf814b225 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -7840,9 +7840,10 @@ scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests(
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
- http_server_properties->SetAlternateProtocol(
- HostPortPair("host.with.alternate", 80), 443,
- AlternateProtocolFromNextProto(next_proto), 1.0);
+ AlternativeService alternative_service(
+ AlternateProtocolFromNextProto(next_proto), "alternative.host", 443);
+ http_server_properties->SetAlternativeService(
+ HostPortPair("host.with.alternate", 80), alternative_service, 1.0);
return session;
}
@@ -8788,9 +8789,11 @@ 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).
- http_server_properties->SetAlternateProtocol(
- host_port_pair, 666 /* port is ignored by MockConnect anyway */,
- AlternateProtocolFromNextProto(GetParam()), 1.0);
+ AlternativeService alternative_service(
+ AlternateProtocolFromNextProto(GetParam()), "www.google.com",
+ 666); /* port is ignored by MockConnect anyway */
+ http_server_properties->SetAlternativeService(host_port_pair,
+ alternative_service, 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
@@ -8809,7 +8812,7 @@ TEST_P(HttpNetworkTransactionTest,
ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data));
EXPECT_EQ("hello world", response_data);
- const AlternativeService alternative_service =
+ alternative_service =
http_server_properties->GetAlternativeService(host_port_pair);
EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternative_service.protocol);
EXPECT_TRUE(
@@ -8848,9 +8851,11 @@ TEST_P(HttpNetworkTransactionTest,
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1024;
- http_server_properties->SetAlternateProtocol(
- HostPortPair::FromURL(restricted_port_request.url),
- kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ AlternativeService alternative_service(
+ AlternateProtocolFromNextProto(GetParam()), "www.google.com",
+ kUnrestrictedAlternatePort);
+ http_server_properties->SetAlternativeService(
+ HostPortPair::FromURL(restricted_port_request.url), alternative_service,
1.0);
scoped_ptr<HttpTransaction> trans(
@@ -8899,9 +8904,11 @@ TEST_P(HttpNetworkTransactionTest,
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1024;
- http_server_properties->SetAlternateProtocol(
- HostPortPair::FromURL(restricted_port_request.url),
- kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ AlternativeService alternative_service(
+ AlternateProtocolFromNextProto(GetParam()), "www.google.com",
+ kUnrestrictedAlternatePort);
+ http_server_properties->SetAlternativeService(
+ HostPortPair::FromURL(restricted_port_request.url), alternative_service,
1.0);
scoped_ptr<HttpTransaction> trans(
@@ -8947,9 +8954,11 @@ TEST_P(HttpNetworkTransactionTest,
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kRestrictedAlternatePort = 80;
- http_server_properties->SetAlternateProtocol(
- HostPortPair::FromURL(restricted_port_request.url),
- kRestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ AlternativeService alternative_service(
+ AlternateProtocolFromNextProto(GetParam()), "www.google.com",
+ kRestrictedAlternatePort);
+ http_server_properties->SetAlternativeService(
+ HostPortPair::FromURL(restricted_port_request.url), alternative_service,
1.0);
scoped_ptr<HttpTransaction> trans(
@@ -8996,9 +9005,11 @@ TEST_P(HttpNetworkTransactionTest,
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kRestrictedAlternatePort = 80;
- http_server_properties->SetAlternateProtocol(
- HostPortPair::FromURL(unrestricted_port_request.url),
- kRestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ AlternativeService alternative_service(
+ AlternateProtocolFromNextProto(GetParam()), "www.google.com",
+ kRestrictedAlternatePort);
+ http_server_properties->SetAlternativeService(
+ HostPortPair::FromURL(unrestricted_port_request.url), alternative_service,
1.0);
scoped_ptr<HttpTransaction> trans(
@@ -9044,9 +9055,11 @@ TEST_P(HttpNetworkTransactionTest,
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1024;
- http_server_properties->SetAlternateProtocol(
- HostPortPair::FromURL(unrestricted_port_request.url),
- kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ AlternativeService alternative_service(
+ AlternateProtocolFromNextProto(GetParam()), "www.google.com",
+ kUnrestrictedAlternatePort);
+ http_server_properties->SetAlternativeService(
+ HostPortPair::FromURL(unrestricted_port_request.url), alternative_service,
1.0);
scoped_ptr<HttpTransaction> trans(
@@ -9087,9 +9100,11 @@ TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) {
base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kUnsafePort = 7;
- http_server_properties->SetAlternateProtocol(
- HostPortPair::FromURL(request.url), kUnsafePort,
- AlternateProtocolFromNextProto(GetParam()), 1.0);
+ AlternativeService alternative_service(
+ AlternateProtocolFromNextProto(GetParam()), "www.google.com",
+ kUnsafePort);
+ http_server_properties->SetAlternativeService(
+ HostPortPair::FromURL(request.url), alternative_service, 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));

Powered by Google App Engine
This is Rietveld 408576698