Index: net/http/http_network_transaction_unittest.cc |
=================================================================== |
--- net/http/http_network_transaction_unittest.cc (revision 124201) |
+++ net/http/http_network_transaction_unittest.cc (working copy) |
@@ -273,6 +273,17 @@ |
str->append(row, sizeof_row); |
} |
+void SetAlternateProtocol( |
+ HttpServerProperties* http_server_properties, |
+ const HostPortPair& server, |
+ uint16 alternate_port, |
+ AlternateProtocol alternate_protocol) { |
+ http_server_properties->SetAlternateProtocol( |
+ server, alternate_port, alternate_protocol); |
+ HttpStreamFactory::set_highest_supported_alternate_protocol( |
willchan no longer on Chromium
2012/02/29 20:15:27
Using a global like this messes up the test depend
ramant (doing other things)
2012/03/01 03:51:59
Done.
|
+ alternate_protocol); |
+} |
+ |
// Alternative functions that eliminate randomness and dependency on the local |
// host name so that the generated NTLM messages are reproducible. |
void MockGenerateRandom1(uint8* output, size_t n) { |
@@ -5604,10 +5615,10 @@ |
HttpServerProperties* http_server_properties = |
session->http_server_properties(); |
- http_server_properties->SetAlternateProtocol( |
- HostPortPair("host.with.alternate", 80), 443, |
- NPN_SPDY_21); |
- |
+ SetAlternateProtocol(http_server_properties, |
+ HostPortPair("host.with.alternate", 80), |
+ 443, |
+ NPN_SPDY_21); |
return session; |
} |
@@ -6552,6 +6563,7 @@ |
HttpStreamFactory::set_use_alternate_protocols(false); |
HttpStreamFactory::set_next_protos(std::vector<std::string>()); |
+ HttpStreamFactory::set_highest_supported_alternate_protocol(NPN_SPDY_21); |
} |
TEST_F(HttpNetworkTransactionTest, MarkBrokenAlternateProtocolAndFallback) { |
@@ -6583,10 +6595,10 @@ |
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 */, |
- NPN_SPDY_21); |
+ SetAlternateProtocol(http_server_properties, |
+ HostPortPair::FromURL(request.url), |
+ 666 /* port is ignored by MockConnect anyway */, |
+ NPN_SPDY_21); |
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
TestCompletionCallback callback; |
@@ -6645,10 +6657,10 @@ |
HttpServerProperties* http_server_properties = |
session->http_server_properties(); |
const int kUnrestrictedAlternatePort = 1024; |
- http_server_properties->SetAlternateProtocol( |
- HostPortPair::FromURL(restricted_port_request.url), |
- kUnrestrictedAlternatePort, |
- NPN_SPDY_21); |
+ SetAlternateProtocol(http_server_properties, |
+ HostPortPair::FromURL(restricted_port_request.url), |
+ kUnrestrictedAlternatePort, |
+ NPN_SPDY_21); |
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
TestCompletionCallback callback; |
@@ -6694,10 +6706,10 @@ |
HttpServerProperties* http_server_properties = |
session->http_server_properties(); |
const int kRestrictedAlternatePort = 80; |
- http_server_properties->SetAlternateProtocol( |
- HostPortPair::FromURL(restricted_port_request.url), |
- kRestrictedAlternatePort, |
- NPN_SPDY_21); |
+ SetAlternateProtocol(http_server_properties, |
+ HostPortPair::FromURL(restricted_port_request.url), |
+ kRestrictedAlternatePort, |
+ NPN_SPDY_21); |
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
TestCompletionCallback callback; |
@@ -6743,10 +6755,10 @@ |
HttpServerProperties* http_server_properties = |
session->http_server_properties(); |
const int kRestrictedAlternatePort = 80; |
- http_server_properties->SetAlternateProtocol( |
- HostPortPair::FromURL(unrestricted_port_request.url), |
- kRestrictedAlternatePort, |
- NPN_SPDY_21); |
+ SetAlternateProtocol(http_server_properties, |
+ HostPortPair::FromURL(unrestricted_port_request.url), |
+ kRestrictedAlternatePort, |
+ NPN_SPDY_21); |
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
TestCompletionCallback callback; |
@@ -6792,10 +6804,10 @@ |
HttpServerProperties* http_server_properties = |
session->http_server_properties(); |
const int kUnrestrictedAlternatePort = 1024; |
- http_server_properties->SetAlternateProtocol( |
- HostPortPair::FromURL(unrestricted_port_request.url), |
- kUnrestrictedAlternatePort, |
- NPN_SPDY_21); |
+ SetAlternateProtocol(http_server_properties, |
+ HostPortPair::FromURL(unrestricted_port_request.url), |
+ kUnrestrictedAlternatePort, |
+ NPN_SPDY_21); |
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
TestCompletionCallback callback; |
@@ -6837,10 +6849,10 @@ |
HttpServerProperties* http_server_properties = |
session->http_server_properties(); |
const int kUnsafePort = 7; |
- http_server_properties->SetAlternateProtocol( |
- HostPortPair::FromURL(request.url), |
- kUnsafePort, |
- NPN_SPDY_2); |
+ SetAlternateProtocol(http_server_properties, |
+ HostPortPair::FromURL(request.url), |
+ kUnsafePort, |
+ NPN_SPDY_21); |
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
TestCompletionCallback callback; |