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

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: Custom entries for broken_alternate_protocol_list_ and map_. Created 5 years, 11 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
« no previous file with comments | « net/base/net_log_util.cc ('k') | net/http/http_server_properties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3812c60c058e4441b0a38e3dec2dc527545948a1..2126ce6350c0b90ca5030bd0f14b21aa050d4e8c 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -7614,9 +7614,9 @@ 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);
+ AlternateProtocolFromNextProto(next_proto), 1.0);
return session;
}
@@ -8524,11 +8524,10 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) {
ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data));
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);
AlternateProtocolInfo expected_alternate(
- 443, AlternateProtocolFromNextProto(GetParam()), 1);
+ 443, AlternateProtocolFromNextProto(GetParam()), 1.0);
EXPECT_TRUE(expected_alternate.Equals(alternate));
}
@@ -8561,10 +8560,10 @@ 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);
+ AlternateProtocolFromNextProto(GetParam()), 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
@@ -8583,12 +8582,8 @@ TEST_P(HttpNetworkTransactionTest,
ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data));
EXPECT_EQ("hello world", response_data);
- ASSERT_TRUE(http_server_properties->HasAlternateProtocol(
+ ASSERT_FALSE(http_server_properties->HasAlternateProtocol(
HostPortPair::FromURL(request.url)));
- const AlternateProtocolInfo alternate =
- http_server_properties->GetAlternateProtocol(
- HostPortPair::FromURL(request.url));
- EXPECT_TRUE(alternate.is_broken);
}
TEST_P(HttpNetworkTransactionTest,
@@ -8623,10 +8618,10 @@ 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);
+ kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
@@ -8674,10 +8669,10 @@ 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);
+ kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
@@ -8722,10 +8717,10 @@ 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);
+ kRestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
@@ -8771,10 +8766,10 @@ 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);
+ kRestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
@@ -8819,10 +8814,10 @@ 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);
+ kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()),
+ 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
@@ -8862,10 +8857,9 @@ 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);
+ http_server_properties->AddAlternateProtocol(
+ HostPortPair::FromURL(request.url), kUnsafePort,
+ AlternateProtocolFromNextProto(GetParam()), 1.0);
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
« no previous file with comments | « net/base/net_log_util.cc ('k') | net/http/http_server_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698