diff options
author | bnc <bnc@chromium.org> | 2014-11-13 11:57:46 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-13 19:58:10 +0000 |
commit | 5b3dce0d316928cecab45b24a889554dee25dee8 (patch) | |
tree | 8bf4b88fa217887d989b2b8f50bef791d776be40 | |
parent | 321756731a1d4c230be6071220eccfc423af5bfa (diff) | |
download | chromium_src-5b3dce0d316928cecab45b24a889554dee25dee8.zip chromium_src-5b3dce0d316928cecab45b24a889554dee25dee8.tar.gz chromium_src-5b3dce0d316928cecab45b24a889554dee25dee8.tar.bz2 |
Support HTTP/2 drafts 14 and 15 simultaneously.
BUG=432673
Review URL: https://codereview.chromium.org/724523002
Cr-Commit-Position: refs/heads/master@{#304063}
25 files changed, 92 insertions, 53 deletions
diff --git a/chrome/browser/io_thread_unittest.cc b/chrome/browser/io_thread_unittest.cc index a78108d..18c4844 100644 --- a/chrome/browser/io_thread_unittest.cc +++ b/chrome/browser/io_thread_unittest.cc @@ -93,7 +93,8 @@ TEST_F(IOThreadTest, SpdyFieldTrialSpdy4Enabled) { ElementsAre(net::kProtoHTTP11, net::kProtoQUIC1SPDY3, net::kProtoSPDY31, - net::kProtoSPDY4)); + net::kProtoSPDY4_14, + net::kProtoSPDY4_15)); globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); EXPECT_TRUE(use_alternate_protocols); } diff --git a/components/domain_reliability/util.cc b/components/domain_reliability/util.cc index 6fc50c5..062d4be 100644 --- a/components/domain_reliability/util.cc +++ b/components/domain_reliability/util.cc @@ -108,7 +108,8 @@ std::string GetDomainReliabilityProtocol( return ssl_info_populated ? "HTTPS" : "HTTP"; case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY2: case net::HttpResponseInfo::CONNECTION_INFO_SPDY3: - case net::HttpResponseInfo::CONNECTION_INFO_SPDY4: + case net::HttpResponseInfo::CONNECTION_INFO_HTTP2_14: + case net::HttpResponseInfo::CONNECTION_INFO_HTTP2_15: return "SPDY"; case net::HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3: return "QUIC"; diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 938f1b0..d08d162 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -408,7 +408,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, HttpNetworkTransactionTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); namespace { diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc index 19df6a0..694d394 100644 --- a/net/http/http_proxy_client_socket_pool_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_unittest.cc @@ -351,9 +351,12 @@ INSTANTIATE_TEST_CASE_P( HttpProxyClientSocketPoolTestParams(HTTP, kProtoSPDY31), HttpProxyClientSocketPoolTestParams(HTTPS, kProtoSPDY31), HttpProxyClientSocketPoolTestParams(SPDY, kProtoSPDY31), - HttpProxyClientSocketPoolTestParams(HTTP, kProtoSPDY4), - HttpProxyClientSocketPoolTestParams(HTTPS, kProtoSPDY4), - HttpProxyClientSocketPoolTestParams(SPDY, kProtoSPDY4))); + HttpProxyClientSocketPoolTestParams(HTTP, kProtoSPDY4_14), + HttpProxyClientSocketPoolTestParams(HTTPS, kProtoSPDY4_14), + HttpProxyClientSocketPoolTestParams(SPDY, kProtoSPDY4_14), + HttpProxyClientSocketPoolTestParams(HTTP, kProtoSPDY4_15), + HttpProxyClientSocketPoolTestParams(HTTPS, kProtoSPDY4_15), + HttpProxyClientSocketPoolTestParams(SPDY, kProtoSPDY4_15))); TEST_P(HttpProxyClientSocketPoolTest, NoTunnel) { Initialize(NULL, 0, NULL, 0, NULL, 0, NULL, 0); diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc index 2ec0fb5..6967d79 100644 --- a/net/http/http_response_info.cc +++ b/net/http/http_response_info.cc @@ -369,8 +369,10 @@ HttpResponseInfo::ConnectionInfo HttpResponseInfo::ConnectionInfoFromNextProto( case kProtoSPDY3: case kProtoSPDY31: return CONNECTION_INFO_SPDY3; - case kProtoSPDY4: - return CONNECTION_INFO_SPDY4; + case kProtoSPDY4_14: + return CONNECTION_INFO_HTTP2_14; + case kProtoSPDY4_15: + return CONNECTION_INFO_HTTP2_15; case kProtoQUIC1SPDY3: return CONNECTION_INFO_QUIC1_SPDY3; @@ -395,9 +397,12 @@ std::string HttpResponseInfo::ConnectionInfoToString( return "spdy/2"; case CONNECTION_INFO_SPDY3: return "spdy/3"; - case CONNECTION_INFO_SPDY4: - // This is the HTTP/2 draft-15 identifier. For internal - // consistency, HTTP/2 is named SPDY4 within Chromium. + case CONNECTION_INFO_HTTP2_14: + // For internal consistency, HTTP/2 is named SPDY4 within Chromium. + // This is the HTTP/2 draft-14 identifier. + return "h2-14"; + case CONNECTION_INFO_HTTP2_15: + // This is the HTTP/2 draft-15 identifier. return "h2-15"; case CONNECTION_INFO_QUIC1_SPDY3: return "quic/1+spdy/3"; diff --git a/net/http/http_response_info.h b/net/http/http_response_info.h index efd76fe..df3e300 100644 --- a/net/http/http_response_info.h +++ b/net/http/http_response_info.h @@ -37,8 +37,10 @@ class NET_EXPORT HttpResponseInfo { CONNECTION_INFO_HTTP1 = 1, CONNECTION_INFO_DEPRECATED_SPDY2 = 2, CONNECTION_INFO_SPDY3 = 3, - CONNECTION_INFO_SPDY4 = 4, + // CONNECTION_INFO_HTTP2 = 4, // TODO(bnc): This will be HTTP/2. CONNECTION_INFO_QUIC1_SPDY3 = 5, + CONNECTION_INFO_HTTP2_14 = 6, // HTTP/2 draft-14. + CONNECTION_INFO_HTTP2_15 = 7, // HTTP/2 draft-15. NUM_OF_CONNECTION_INFOS, }; diff --git a/net/http/http_server_properties.cc b/net/http/http_server_properties.cc index cc41ea8..25725a8 100644 --- a/net/http/http_server_properties.cc +++ b/net/http/http_server_properties.cc @@ -20,6 +20,7 @@ const char* const kAlternateProtocolStrings[] = { "npn-spdy/2", "npn-spdy/3", "npn-spdy/3.1", + "npn-h2-14", // HTTP/2 draft-14. Called SPDY4 internally. "npn-h2-15", // HTTP/2 draft-15. Called SPDY4 internally. "quic" }; @@ -51,7 +52,8 @@ const char* AlternateProtocolToString(AlternateProtocol protocol) { case DEPRECATED_NPN_SPDY_2: case NPN_SPDY_3: case NPN_SPDY_3_1: - case NPN_SPDY_4: + case NPN_SPDY_4_14: + case NPN_SPDY_4_15: case QUIC: DCHECK(IsAlternateProtocolValid(protocol)); return kAlternateProtocolStrings[ @@ -81,8 +83,10 @@ AlternateProtocol AlternateProtocolFromNextProto(NextProto next_proto) { return NPN_SPDY_3; case kProtoSPDY31: return NPN_SPDY_3_1; - case kProtoSPDY4: - return NPN_SPDY_4; + case kProtoSPDY4_14: + return NPN_SPDY_4_14; + case kProtoSPDY4_15: + return NPN_SPDY_4_15; case kProtoQUIC1SPDY3: return QUIC; diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h index 337f22d..a63dc6a 100644 --- a/net/http/http_server_properties.h +++ b/net/http/http_server_properties.h @@ -57,8 +57,9 @@ enum AlternateProtocol { NPN_SPDY_MINIMUM_VERSION = DEPRECATED_NPN_SPDY_2, NPN_SPDY_3, NPN_SPDY_3_1, - NPN_SPDY_4, // SPDY4 is HTTP/2. - NPN_SPDY_MAXIMUM_VERSION = NPN_SPDY_4, + NPN_SPDY_4_14, // HTTP/2 draft-14 + NPN_SPDY_4_15, // HTTP/2 draft-15 + NPN_SPDY_MAXIMUM_VERSION = NPN_SPDY_4_15, QUIC, ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION = QUIC, UNINITIALIZED_ALTERNATE_PROTOCOL, diff --git a/net/http/http_stream_factory_impl_request_unittest.cc b/net/http/http_stream_factory_impl_request_unittest.cc index 4695067..587358d 100644 --- a/net/http/http_stream_factory_impl_request_unittest.cc +++ b/net/http/http_stream_factory_impl_request_unittest.cc @@ -20,7 +20,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, HttpStreamFactoryImplRequestTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); namespace { diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 4bf1659..68e9114 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc @@ -425,7 +425,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, HttpStreamFactoryTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); TEST_P(HttpStreamFactoryTest, PreconnectDirect) { for (size_t i = 0; i < arraysize(kTests); ++i) { diff --git a/net/socket/next_proto.cc b/net/socket/next_proto.cc index 1dcfb5d..0e59ce7 100644 --- a/net/socket/next_proto.cc +++ b/net/socket/next_proto.cc @@ -44,7 +44,8 @@ NextProtoVector NextProtosSpdy4Http2() { next_protos.push_back(kProtoHTTP11); next_protos.push_back(kProtoQUIC1SPDY3); next_protos.push_back(kProtoSPDY31); - next_protos.push_back(kProtoSPDY4); + next_protos.push_back(kProtoSPDY4_14); + next_protos.push_back(kProtoSPDY4_15); return next_protos; } diff --git a/net/socket/next_proto.h b/net/socket/next_proto.h index e35d5bd..c12a45b 100644 --- a/net/socket/next_proto.h +++ b/net/socket/next_proto.h @@ -28,9 +28,11 @@ enum NextProto { kProtoSPDYHistogramOffset = kProtoDeprecatedSPDY2, kProtoSPDY3 = 101, kProtoSPDY31 = 102, - // HTTP/2 draft-14 was 103, - kProtoSPDY4 = 104, // SPDY4 is HTTP/2 draft-15. - kProtoSPDYMaximumVersion = kProtoSPDY4, + kProtoSPDY4_14 = 103, // HTTP/2 draft-14 + kProtoSPDY4MinimumVersion = kProtoSPDY4_14, + kProtoSPDY4_15 = 104, // HTTP/2 draft-15 + kProtoSPDY4MaximumVersion = kProtoSPDY4_15, + kProtoSPDYMaximumVersion = kProtoSPDY4MaximumVersion, kProtoQUIC1SPDY3 = 200, diff --git a/net/socket/ssl_client_socket.cc b/net/socket/ssl_client_socket.cc index 269ca7e..a52e6a3 100644 --- a/net/socket/ssl_client_socket.cc +++ b/net/socket/ssl_client_socket.cc @@ -37,10 +37,13 @@ NextProto SSLClientSocket::NextProtoFromString( return kProtoSPDY3; } else if (proto_string == "spdy/3.1") { return kProtoSPDY31; + } else if (proto_string == "h2-14") { + // For internal consistency, HTTP/2 is named SPDY4 within Chromium. + // This is the HTTP/2 draft-14 identifier. + return kProtoSPDY4_14; } else if (proto_string == "h2-15") { - // This is the HTTP/2 draft-15 identifier. For internal - // consistency, HTTP/2 is named SPDY4 within Chromium. - return kProtoSPDY4; + // This is the HTTP/2 draft-15 identifier. + return kProtoSPDY4_15; } else if (proto_string == "quic/1+spdy/3") { return kProtoQUIC1SPDY3; } else { @@ -59,9 +62,12 @@ const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { return "spdy/3"; case kProtoSPDY31: return "spdy/3.1"; - case kProtoSPDY4: - // This is the HTTP/2 draft-15 identifier. For internal - // consistency, HTTP/2 is named SPDY4 within Chromium. + case kProtoSPDY4_14: + // For internal consistency, HTTP/2 is named SPDY4 within Chromium. + // This is the HTTP/2 draft-14 identifier. + return "h2-14"; + case kProtoSPDY4_15: + // This is the HTTP/2 draft-15 identifier. return "h2-15"; case kProtoQUIC1SPDY3: return "quic/1+spdy/3"; diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index 202cd88..8ac29ef 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -240,7 +240,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, SSLClientSocketPoolTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); // Tests that the final socket will connect even if all sockets // prior to it fail. diff --git a/net/spdy/buffered_spdy_framer.cc b/net/spdy/buffered_spdy_framer.cc index 61f2ce2..f3fc575 100644 --- a/net/spdy/buffered_spdy_framer.cc +++ b/net/spdy/buffered_spdy_framer.cc @@ -15,7 +15,8 @@ SpdyMajorVersion NextProtoToSpdyMajorVersion(NextProto next_proto) { case kProtoSPDY3: case kProtoSPDY31: return SPDY3; - case kProtoSPDY4: + case kProtoSPDY4_14: + case kProtoSPDY4_15: return SPDY4; case kProtoUnknown: case kProtoHTTP11: diff --git a/net/spdy/buffered_spdy_framer_unittest.cc b/net/spdy/buffered_spdy_framer_unittest.cc index ae2a13d..11f8d08 100644 --- a/net/spdy/buffered_spdy_framer_unittest.cc +++ b/net/spdy/buffered_spdy_framer_unittest.cc @@ -209,7 +209,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, BufferedSpdyFramerTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); TEST_P(BufferedSpdyFramerTest, OnSetting) { SpdyFramer framer(spdy_version()); diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc index 0e8fdb0..574b76a 100644 --- a/net/spdy/spdy_http_stream_unittest.cc +++ b/net/spdy/spdy_http_stream_unittest.cc @@ -131,7 +131,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, SpdyHttpStreamTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); // SpdyHttpStream::GetUploadProgress() should still work even before the // stream is initialized. diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index a68615f..edb39e9 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -726,9 +726,12 @@ INSTANTIATE_TEST_CASE_P( SpdyNetworkTransactionTestParams(kProtoSPDY31, SPDYNOSSL), SpdyNetworkTransactionTestParams(kProtoSPDY31, SPDYSSL), SpdyNetworkTransactionTestParams(kProtoSPDY31, SPDYNPN), - SpdyNetworkTransactionTestParams(kProtoSPDY4, SPDYNOSSL), - SpdyNetworkTransactionTestParams(kProtoSPDY4, SPDYSSL), - SpdyNetworkTransactionTestParams(kProtoSPDY4, SPDYNPN))); + SpdyNetworkTransactionTestParams(kProtoSPDY4_14, SPDYNOSSL), + SpdyNetworkTransactionTestParams(kProtoSPDY4_14, SPDYSSL), + SpdyNetworkTransactionTestParams(kProtoSPDY4_14, SPDYNPN), + SpdyNetworkTransactionTestParams(kProtoSPDY4_15, SPDYNOSSL), + SpdyNetworkTransactionTestParams(kProtoSPDY4_15, SPDYSSL), + SpdyNetworkTransactionTestParams(kProtoSPDY4_15, SPDYNPN))); // Verify HttpNetworkTransaction constructor. TEST_P(SpdyNetworkTransactionTest, Constructor) { @@ -3576,7 +3579,7 @@ TEST_P(SpdyNetworkTransactionTest, CorruptFrameSessionErrorSpdy4) { } TEST_P(SpdyNetworkTransactionTest, GoAwayOnDecompressionFailure) { - if (GetParam().protocol < kProtoSPDY4) { + if (GetParam().protocol < kProtoSPDY4MinimumVersion) { // Decompression failures are a stream error in SPDY3 and above. return; } @@ -4433,7 +4436,8 @@ TEST_P(SpdyNetworkTransactionTest, SettingsPlayback) { spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); std::vector<MockWrite> writes; - if (GetParam().protocol == kProtoSPDY4) { + if ((GetParam().protocol >= kProtoSPDY4MinimumVersion) && + (GetParam().protocol <= kProtoSPDY4MaximumVersion)) { writes.push_back( MockWrite(ASYNC, kHttp2ConnectionHeaderPrefix, @@ -6599,7 +6603,9 @@ class SpdyNetworkTransactionTLSUsageCheckTest INSTANTIATE_TEST_CASE_P( Spdy, SpdyNetworkTransactionTLSUsageCheckTest, - ::testing::Values(SpdyNetworkTransactionTestParams(kProtoSPDY4, SPDYNPN))); + ::testing::Values( + SpdyNetworkTransactionTestParams(kProtoSPDY4_14, SPDYNPN), + SpdyNetworkTransactionTestParams(kProtoSPDY4_15, SPDYNPN))); TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSVersionTooOld) { scoped_ptr<SSLSocketDataProvider> ssl_provider( diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc index 92e446e..ba5d867 100644 --- a/net/spdy/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_unittest.cc @@ -143,7 +143,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, SpdyProxyClientSocketTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); SpdyProxyClientSocketTest::SpdyProxyClientSocketTest() : spdy_util_(GetParam()), diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index c324a09..08d838a 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -725,7 +725,8 @@ void SpdySession::InitializeWithSocket( DCHECK_GE(protocol_, kProtoSPDYMinimumVersion); DCHECK_LE(protocol_, kProtoSPDYMaximumVersion); - if (protocol_ == kProtoSPDY4) + if ((protocol_ >= kProtoSPDY4MinimumVersion) && + (protocol_ <= kProtoSPDY4MaximumVersion)) send_connection_header_prefix_ = true; if (protocol_ >= kProtoSPDY31) { @@ -2461,8 +2462,8 @@ void SpdySession::OnPing(SpdyPingId unique_id, bool is_ack) { base::Bind(&NetLogSpdyPingCallback, unique_id, is_ack, "received")); // Send response to a PING from server. - if ((protocol_ >= kProtoSPDY4 && !is_ack) || - (protocol_ < kProtoSPDY4 && unique_id % 2 == 0)) { + if ((protocol_ >= kProtoSPDY4MinimumVersion && !is_ack) || + (protocol_ < kProtoSPDY4MinimumVersion && unique_id % 2 == 0)) { WritePingFrame(unique_id, true); return; } @@ -2748,7 +2749,8 @@ void SpdySession::SendInitialData() { DCHECK(enable_sending_initial_data_); if (send_connection_header_prefix_) { - DCHECK_EQ(protocol_, kProtoSPDY4); + DCHECK_GE(protocol_, kProtoSPDY4MinimumVersion); + DCHECK_LE(protocol_, kProtoSPDY4MaximumVersion); scoped_ptr<SpdyFrame> connection_header_prefix_frame( new SpdyFrame(const_cast<char*>(kHttp2ConnectionHeaderPrefix), kHttp2ConnectionHeaderPrefixSize, diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc index fef27bf..fc38cc2 100644 --- a/net/spdy/spdy_session_pool_unittest.cc +++ b/net/spdy/spdy_session_pool_unittest.cc @@ -52,7 +52,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, SpdySessionPoolTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); // A delegate that opens a new session when it is closed. class SessionOpeningDelegate : public SpdyStream::Delegate { diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index 256e1a7..02e0c74 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc @@ -182,7 +182,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, SpdySessionTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); // Try to create a SPDY session that will fail during // initialization. Nothing should blow up. @@ -1556,7 +1556,8 @@ TEST_P(SpdySessionTest, SendInitialDataOnNewSession) { kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); std::vector<MockWrite> writes; - if (GetParam() == kProtoSPDY4) { + if ((GetParam() >= kProtoSPDY4MinimumVersion) && + (GetParam() <= kProtoSPDY4MaximumVersion)) { writes.push_back( MockWrite(ASYNC, kHttp2ConnectionHeaderPrefix, diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc index a6926ab..96153bf 100644 --- a/net/spdy/spdy_stream_unittest.cc +++ b/net/spdy/spdy_stream_unittest.cc @@ -111,7 +111,7 @@ INSTANTIATE_TEST_CASE_P( NextProto, SpdyStreamTest, testing::Values(kProtoDeprecatedSPDY2, - kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); + kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); TEST_P(SpdyStreamTest, SendDataAfterOpen) { GURL url(kStreamUrl); diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc index 7a5060b..801d67d 100644 --- a/net/spdy/spdy_test_util_common.cc +++ b/net/spdy/spdy_test_util_common.cc @@ -57,7 +57,8 @@ NextProtoVector SpdyNextProtos() { next_protos.push_back(kProtoDeprecatedSPDY2); next_protos.push_back(kProtoSPDY3); next_protos.push_back(kProtoSPDY31); - next_protos.push_back(kProtoSPDY4); + next_protos.push_back(kProtoSPDY4_14); + next_protos.push_back(kProtoSPDY4_15); next_protos.push_back(kProtoQUIC1SPDY3); return next_protos; } @@ -1107,7 +1108,7 @@ SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, RequestPriority priority, bool compressed, bool fin) const { - if (protocol_ < kProtoSPDY4) { + if (protocol_ < kProtoSPDY4MinimumVersion) { SpdySynStreamIR syn_stream(stream_id); syn_stream.set_name_value_block(block); syn_stream.set_priority( @@ -1127,7 +1128,7 @@ SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, SpdyFrame* SpdyTestUtil::ConstructSpdyReply(int stream_id, const SpdyHeaderBlock& headers) { - if (protocol_ < kProtoSPDY4) { + if (protocol_ < kProtoSPDY4MinimumVersion) { SpdySynReplyIR syn_reply(stream_id); syn_reply.set_name_value_block(headers); return CreateFramer(false)->SerializeFrame(syn_reply); @@ -1268,7 +1269,7 @@ const char* SpdyTestUtil::GetStatusKey() const { const char* SpdyTestUtil::GetHostKey() const { if (protocol_ < kProtoSPDY3) return "host"; - if (protocol_ < kProtoSPDY4) + if (protocol_ < kProtoSPDY4MinimumVersion) return ":host"; else return ":authority"; diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h index 178d2e1..b08657cc 100644 --- a/net/spdy/spdy_test_util_common.h +++ b/net/spdy/spdy_test_util_common.h @@ -552,7 +552,9 @@ class SpdyTestUtil { NextProto protocol() const { return protocol_; } SpdyMajorVersion spdy_version() const { return spdy_version_; } bool is_spdy2() const { return protocol_ < kProtoSPDY3; } - bool include_version_header() const { return protocol_ < kProtoSPDY4; } + bool include_version_header() const { + return protocol_ < kProtoSPDY4MinimumVersion; + } scoped_ptr<SpdyFramer> CreateFramer(bool compressed) const; const char* GetMethodKey() const; |