Commit 4ff65377 authored by rch@chromium.org's avatar rch@chromium.org

Actually enable Alternate-Protocol support for QUIC.

Also, since we expect QUIC for HTTP URLs to run on port 80, changed the tests to use that port.

Review URL: https://chromiumcodereview.appspot.com/17410014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207722 0039d316-1c4b-4281-b951-d872f2087c98
parent d27369d4
......@@ -143,6 +143,7 @@ void HttpStreamFactory::EnableNpnSpdy() {
set_use_alternate_protocols(true);
std::vector<std::string> next_protos;
next_protos.push_back("http/1.1");
next_protos.push_back("quic");
next_protos.push_back("spdy/2");
SetNextProtos(next_protos);
}
......@@ -163,6 +164,7 @@ void HttpStreamFactory::EnableNpnSpdy3() {
set_use_alternate_protocols(true);
std::vector<std::string> next_protos;
next_protos.push_back("http/1.1");
next_protos.push_back("quic");
next_protos.push_back("spdy/2");
next_protos.push_back("spdy/3");
SetNextProtos(next_protos);
......@@ -173,6 +175,7 @@ void HttpStreamFactory::EnableNpnSpdy31() {
set_use_alternate_protocols(true);
std::vector<std::string> next_protos;
next_protos.push_back("http/1.1");
next_protos.push_back("quic");
next_protos.push_back("spdy/2");
next_protos.push_back("spdy/3");
next_protos.push_back("spdy/3.1");
......
......@@ -232,18 +232,19 @@ class NET_EXPORT HttpStreamFactory {
// Check if a HostPortPair is excluded from using spdy.
static bool HasSpdyExclusion(const HostPortPair& endpoint);
// Sets http/1.1 as the only protocol supported via NPN.
// Sets http/1.1 as the only protocol supported via NPN or Alternate-Protocol.
static void EnableNpnHttpOnly();
// Sets http/1.1 and spdy/2 (the default spdy protocol) as the protocols
// supported via NPN.
// Sets http/1.1, quic and spdy/2 (the default spdy protocol) as the protocols
// supported via NPN or Alternate-Protocol.
static void EnableNpnSpdy();
// Sets http/1.1, spdy/2, and spdy/3 as the protocols supported via NPN.
// Sets http/1.1, quic, spdy/2, and spdy/3 as the protocols supported via NPN
// or Alternate-Protocol.
static void EnableNpnSpdy3();
// Sets http/1.1, spdy/2, spdy/3, and spdy/3.1 as the protocols
// supported via NPN.
// Sets http/1.1, quic, spdy/2, spdy/3, and spdy/3.1 as the protocols
// supported via NPN or Alternate-Protocol.
static void EnableNpnSpdy31();
// Sets the protocols supported by NPN (next protocol negotiation) during the
......
......@@ -46,15 +46,7 @@ namespace {
// This is the expected return from a current server advertising QUIC.
static const char kQuicAlternateProtocolHttpHeader[] =
"Alternate-Protocol: 443:quic\r\n\r\n";
// Returns a vector of NPN protocol strings for negotiating QUIC.
std::vector<std::string> QuicNextProtos() {
std::vector<std::string> protos;
protos.push_back("http/1.1");
protos.push_back("quic");
return protos;
}
"Alternate-Protocol: 80:quic\r\n\r\n";
} // namespace
......@@ -447,8 +439,7 @@ TEST_F(QuicNetworkTransactionTest, DoNotForceQuicForHttps) {
}
TEST_F(QuicNetworkTransactionTest, UseAlternateProtocolForQuic) {
HttpStreamFactory::set_use_alternate_protocols(true);
HttpStreamFactory::SetNextProtos(QuicNextProtos());
HttpStreamFactory::EnableNpnSpdy(); // Enables QUIC too.
MockRead http_reads[] = {
MockRead("HTTP/1.1 200 OK\r\n"),
......@@ -497,8 +488,7 @@ TEST_F(QuicNetworkTransactionTest, UseAlternateProtocolForQuic) {
}
TEST_F(QuicNetworkTransactionTest, DontUseAlternateProtocolForQuicHttps) {
HttpStreamFactory::set_use_alternate_protocols(true);
HttpStreamFactory::SetNextProtos(QuicNextProtos());
HttpStreamFactory::EnableNpnSpdy(); // Enables QUIC too.
MockRead http_reads[] = {
MockRead("HTTP/1.1 200 OK\r\n"),
......@@ -526,8 +516,7 @@ TEST_F(QuicNetworkTransactionTest, DontUseAlternateProtocolForQuicHttps) {
}
TEST_F(QuicNetworkTransactionTest, ZeroRTT) {
HttpStreamFactory::set_use_alternate_protocols(true);
HttpStreamFactory::SetNextProtos(QuicNextProtos());
HttpStreamFactory::EnableNpnSpdy(); // Enables QUIC too.
scoped_ptr<QuicEncryptedPacket> req(
ConstructDataPacket(1, 3, true, true, 0, GetRequestString("GET", "/")));
......@@ -559,8 +548,7 @@ TEST_F(QuicNetworkTransactionTest, ZeroRTT) {
}
TEST_F(QuicNetworkTransactionTest, BrokenAlternateProtocol) {
HttpStreamFactory::set_use_alternate_protocols(true);
HttpStreamFactory::SetNextProtos(QuicNextProtos());
HttpStreamFactory::EnableNpnSpdy(); // Enables QUIC too.
// Alternate-protocol job
scoped_ptr<QuicEncryptedPacket> close(ConstructConnectionClosePacket(1));
......@@ -591,8 +579,7 @@ TEST_F(QuicNetworkTransactionTest, BrokenAlternateProtocol) {
}
TEST_F(QuicNetworkTransactionTest, BrokenAlternateProtocolReadError) {
HttpStreamFactory::set_use_alternate_protocols(true);
HttpStreamFactory::SetNextProtos(QuicNextProtos());
HttpStreamFactory::EnableNpnSpdy(); // Enables QUIC too.
// Alternate-protocol job
MockRead quic_reads[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment