summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-30 01:22:57 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-30 01:22:57 +0000
commita1f1cb2cbab36077059266a1e5141104fd2ec995 (patch)
tree6c8f10eedeb5e10ae6af77b68002c268601e9d52 /net/spdy
parentaa3be97db621ecfb620487f2a0f4f0c4529c0668 (diff)
downloadchromium_src-a1f1cb2cbab36077059266a1e5141104fd2ec995.zip
chromium_src-a1f1cb2cbab36077059266a1e5141104fd2ec995.tar.gz
chromium_src-a1f1cb2cbab36077059266a1e5141104fd2ec995.tar.bz2
[SPDY] Add strings and constants for HTTP/2 draft 04
There are still differences between SPDY/4 and HTTP/2 draft 04; those will be ironed out in upcoming CLs. Add kProtoHTTP2Draft04 to SPDY NextProto-parametrized tests. Move NextProto -> SpdyMajorVersion conversion to buffered_spdy_framer.h. Remove unused SpdyMajorVersion -> NextProto conversion. Clean up HttpResponseInfo::ConnectionInfo a bit and add a TODO to remove it. Parametrize SSLClientSocketPoolTest on NextProto. BUG=265615 R=darin@chromium.org, rch@chromium.org Review URL: https://codereview.chromium.org/21131002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214289 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/buffered_spdy_framer.cc22
-rw-r--r--net/spdy/buffered_spdy_framer.h6
-rw-r--r--net/spdy/buffered_spdy_framer_unittest.cc5
-rw-r--r--net/spdy/spdy_http_stream.cc15
-rw-r--r--net/spdy/spdy_http_stream_unittest.cc3
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc35
-rw-r--r--net/spdy/spdy_proxy_client_socket_unittest.cc3
-rw-r--r--net/spdy/spdy_session.cc42
-rw-r--r--net/spdy/spdy_session.h15
-rw-r--r--net/spdy/spdy_session_pool.cc10
-rw-r--r--net/spdy/spdy_session_pool.h8
-rw-r--r--net/spdy/spdy_session_pool_unittest.cc3
-rw-r--r--net/spdy/spdy_session_unittest.cc3
-rw-r--r--net/spdy/spdy_stream.cc4
-rw-r--r--net/spdy/spdy_stream.h7
-rw-r--r--net/spdy/spdy_stream_unittest.cc3
-rw-r--r--net/spdy/spdy_test_util_common.cc32
-rw-r--r--net/spdy/spdy_test_util_common.h7
-rw-r--r--net/spdy/spdy_websocket_stream_unittest.cc3
19 files changed, 110 insertions, 116 deletions
diff --git a/net/spdy/buffered_spdy_framer.cc b/net/spdy/buffered_spdy_framer.cc
index 14afaa3..46d0284 100644
--- a/net/spdy/buffered_spdy_framer.cc
+++ b/net/spdy/buffered_spdy_framer.cc
@@ -8,6 +8,28 @@
namespace net {
+SpdyMajorVersion NextProtoToSpdyMajorVersion(NextProto next_proto) {
+ switch (next_proto) {
+ case kProtoSPDY2:
+ case kProtoSPDY21:
+ return SPDY2;
+ case kProtoSPDY3:
+ case kProtoSPDY31:
+ return SPDY3;
+ // SPDY/4 and HTTP/2 share the same framing for now.
+ case kProtoSPDY4a2:
+ case kProtoHTTP2Draft04:
+ return SPDY4;
+ case kProtoUnknown:
+ case kProtoHTTP11:
+ case kProtoSPDY1:
+ case kProtoQUIC1SPDY3:
+ break;
+ }
+ NOTREACHED();
+ return SPDY2;
+}
+
BufferedSpdyFramer::BufferedSpdyFramer(SpdyMajorVersion version,
bool enable_compression)
: spdy_framer_(version),
diff --git a/net/spdy/buffered_spdy_framer.h b/net/spdy/buffered_spdy_framer.h
index 30466b97..1786067 100644
--- a/net/spdy/buffered_spdy_framer.h
+++ b/net/spdy/buffered_spdy_framer.h
@@ -11,12 +11,18 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
+#include "net/socket/next_proto.h"
#include "net/spdy/spdy_framer.h"
#include "net/spdy/spdy_header_block.h"
#include "net/spdy/spdy_protocol.h"
namespace net {
+// Returns the SPDY major version corresponding to the given NextProto
+// value, which must represent a SPDY-like protocol.
+NET_EXPORT_PRIVATE SpdyMajorVersion NextProtoToSpdyMajorVersion(
+ NextProto next_proto);
+
class NET_EXPORT_PRIVATE BufferedSpdyFramerVisitorInterface {
public:
BufferedSpdyFramerVisitorInterface() {}
diff --git a/net/spdy/buffered_spdy_framer_unittest.cc b/net/spdy/buffered_spdy_framer_unittest.cc
index 0932c64..849138f 100644
--- a/net/spdy/buffered_spdy_framer_unittest.cc
+++ b/net/spdy/buffered_spdy_framer_unittest.cc
@@ -180,14 +180,15 @@ class BufferedSpdyFramerTest
}
SpdyMajorVersion spdy_version() {
- return SpdyVersionFromNextProto(GetParam());
+ return NextProtoToSpdyMajorVersion(GetParam());
}
};
INSTANTIATE_TEST_CASE_P(
NextProto,
BufferedSpdyFramerTest,
- testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
+ testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2,
+ kProtoHTTP2Draft04));
TEST_P(BufferedSpdyFramerTest, OnSetting) {
SpdyFramer framer(spdy_version());
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index 8f0f171..08e8b58 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -323,19 +323,8 @@ SpdyResponseHeadersStatus SpdyHttpStream::OnResponseHeadersUpdated(
response_info_->npn_negotiated_protocol =
SSLClientSocket::NextProtoToString(protocol_negotiated);
response_info_->request_time = stream_->GetRequestTime();
- switch (stream_->GetProtocolVersion()) {
- case SPDY2:
- response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_SPDY2;
- break;
- case SPDY3:
- response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_SPDY3;
- break;
- case SPDY4:
- response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_SPDY4;
- break;
- default:
- NOTREACHED();
- }
+ response_info_->connection_info =
+ HttpResponseInfo::ConnectionInfoFromNextProto(stream_->GetProtocol());
response_info_->vary_data
.Init(*request_info_, *response_info_->headers.get());
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc
index 26d87d8..04a8eca 100644
--- a/net/spdy/spdy_http_stream_unittest.cc
+++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -130,7 +130,8 @@ class SpdyHttpStreamTest : public testing::Test,
INSTANTIATE_TEST_CASE_P(
NextProto,
SpdyHttpStreamTest,
- testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
+ testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2,
+ kProtoHTTP2Draft04));
// 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 aa55dfe..2f65151 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -61,30 +61,6 @@ struct SpdyNetworkTransactionTestParams {
SpdyNetworkTransactionTestSSLType ssl_type;
};
-HttpResponseInfo::ConnectionInfo NextProtoToConnectionInfo(
- NextProto next_proto) {
- switch (next_proto) {
- case kProtoSPDY2:
- return HttpResponseInfo::CONNECTION_INFO_SPDY2;
- case kProtoSPDY3:
- case kProtoSPDY31:
- return HttpResponseInfo::CONNECTION_INFO_SPDY3;
- case kProtoSPDY4a2:
- return HttpResponseInfo::CONNECTION_INFO_SPDY4;
- case kProtoQUIC1SPDY3:
- return HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3;
-
- case kProtoUnknown:
- case kProtoHTTP11:
- case kProtoSPDY1:
- case kProtoSPDY21:
- break;
- }
-
- NOTREACHED();
- return HttpResponseInfo::CONNECTION_INFO_SPDY2;
-}
-
SpdySessionDependencies* CreateSpdySessionDependencies(
SpdyNetworkTransactionTestParams test_params) {
return new SpdySessionDependencies(test_params.protocol);
@@ -243,8 +219,10 @@ class SpdyNetworkTransactionTest
EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
EXPECT_EQ(spdy_enabled_, response->was_fetched_via_spdy);
if (HttpStreamFactory::spdy_enabled()) {
- EXPECT_EQ(NextProtoToConnectionInfo(test_params_.protocol),
- response->connection_info);
+ EXPECT_EQ(
+ HttpResponseInfo::ConnectionInfoFromNextProto(
+ test_params_.protocol),
+ response->connection_info);
} else {
EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1,
response->connection_info);
@@ -680,7 +658,10 @@ INSTANTIATE_TEST_CASE_P(
SpdyNetworkTransactionTestParams(kProtoSPDY31, SPDYNPN),
SpdyNetworkTransactionTestParams(kProtoSPDY4a2, SPDYNOSSL),
SpdyNetworkTransactionTestParams(kProtoSPDY4a2, SPDYSSL),
- SpdyNetworkTransactionTestParams(kProtoSPDY4a2, SPDYNPN)));
+ SpdyNetworkTransactionTestParams(kProtoSPDY4a2, SPDYNPN),
+ SpdyNetworkTransactionTestParams(kProtoHTTP2Draft04, SPDYNOSSL),
+ SpdyNetworkTransactionTestParams(kProtoHTTP2Draft04, SPDYSSL),
+ SpdyNetworkTransactionTestParams(kProtoHTTP2Draft04, SPDYNPN)));
// Verify HttpNetworkTransaction constructor.
TEST_P(SpdyNetworkTransactionTest, Constructor) {
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc
index b2bdb3e..c128d9c 100644
--- a/net/spdy/spdy_proxy_client_socket_unittest.cc
+++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -140,7 +140,8 @@ class SpdyProxyClientSocketTest
INSTANTIATE_TEST_CASE_P(
NextProto,
SpdyProxyClientSocketTest,
- testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
+ testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2,
+ kProtoHTTP2Draft04));
SpdyProxyClientSocketTest::SpdyProxyClientSocketTest()
: spdy_util_(GetParam()),
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 6411313..d085a4d 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -54,22 +54,6 @@ const SpdyStreamId kFirstStreamId = 1;
// Minimum seconds that unclaimed pushed streams will be kept in memory.
const int kMinPushedStreamLifetimeSeconds = 300;
-SpdyMajorVersion NPNToSpdyVersion(NextProto next_proto) {
- switch (next_proto) {
- case kProtoSPDY2:
- case kProtoSPDY21:
- return SPDY2;
- case kProtoSPDY3:
- case kProtoSPDY31:
- return SPDY3;
- case kProtoSPDY4a2:
- return SPDY4;
- default:
- NOTREACHED();
- }
- return SPDY2;
-}
-
base::Value* NetLogSpdySynCallback(const SpdyHeaderBlock* headers,
bool fin,
bool unidirectional,
@@ -395,7 +379,7 @@ SpdySession::SpdySession(
enable_compression_(enable_compression),
enable_ping_based_connection_checking_(
enable_ping_based_connection_checking),
- default_protocol_(default_protocol),
+ protocol_(default_protocol),
credential_state_(SpdyCredentialState::kDefaultNumSlots),
connection_at_risk_of_loss_time_(
base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)),
@@ -403,6 +387,10 @@ SpdySession::SpdySession(
base::TimeDelta::FromSeconds(kHungIntervalSeconds)),
trusted_spdy_proxy_(trusted_spdy_proxy),
time_func_(time_func) {
+ // TODO(akalin): Change this to kProtoSPDYMinimumVersion once we
+ // stop supporting SPDY/1.
+ DCHECK_GE(protocol_, kProtoSPDY2);
+ DCHECK_LE(protocol_, kProtoSPDYMaximumVersion);
DCHECK(HttpStreamFactory::spdy_enabled());
net_log_.BeginEvent(
NetLog::TYPE_SPDY_SESSION,
@@ -452,12 +440,15 @@ Error SpdySession::InitializeWithSocket(
is_secure_ = is_secure;
certificate_error_code_ = certificate_error_code;
- NextProto protocol = default_protocol_;
NextProto protocol_negotiated =
connection_->socket()->GetNegotiatedProtocol();
if (protocol_negotiated != kProtoUnknown) {
- protocol = protocol_negotiated;
+ protocol_ = protocol_negotiated;
}
+ // TODO(akalin): Change this to kProtoSPDYMinimumVersion once we
+ // stop supporting SPDY/1.
+ DCHECK_GE(protocol_, kProtoSPDY2);
+ DCHECK_LE(protocol_, kProtoSPDYMaximumVersion);
SSLClientSocket* ssl_socket = GetSSLClientSocket();
if (ssl_socket && ssl_socket->WasChannelIDSent()) {
@@ -467,25 +458,22 @@ Error SpdySession::InitializeWithSocket(
host_port_pair().ToString()));
}
- // TODO(akalin): Change this to kProtoSPDYMinimumVersion once we
- // stop supporting SPDY/1.
- DCHECK_GE(protocol, kProtoSPDY2);
- DCHECK_LE(protocol, kProtoSPDYMaximumVersion);
- if (protocol >= kProtoSPDY31) {
+ if (protocol_ >= kProtoSPDY31) {
flow_control_state_ = FLOW_CONTROL_STREAM_AND_SESSION;
session_send_window_size_ = kSpdySessionInitialWindowSize;
session_recv_window_size_ = kSpdySessionInitialWindowSize;
- } else if (protocol >= kProtoSPDY3) {
+ } else if (protocol_ >= kProtoSPDY3) {
flow_control_state_ = FLOW_CONTROL_STREAM;
} else {
flow_control_state_ = FLOW_CONTROL_NONE;
}
buffered_spdy_framer_.reset(
- new BufferedSpdyFramer(NPNToSpdyVersion(protocol), enable_compression_));
+ new BufferedSpdyFramer(NextProtoToSpdyMajorVersion(protocol_),
+ enable_compression_));
buffered_spdy_framer_->set_visitor(this);
buffered_spdy_framer_->set_debug_visitor(this);
- UMA_HISTOGRAM_ENUMERATION("Net.SpdyVersion", protocol, kProtoMaximumVersion);
+ UMA_HISTOGRAM_ENUMERATION("Net.SpdyVersion", protocol_, kProtoMaximumVersion);
#if defined(SPDY_PROXY_AUTH_ORIGIN)
UMA_HISTOGRAM_BOOLEAN("Net.SpdySessions_DataReductionProxy",
host_port_pair().Equals(HostPortPair::FromURL(
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index fedd701..c2d5b10 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -257,6 +257,13 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
bool is_secure,
int certificate_error_code);
+ // Returns the protocol used by this session. Always between
+ // kProtoSPDY2 and kProtoSPDYMaximumVersion.
+ //
+ // TODO(akalin): Change the lower bound to kProtoSPDYMinimumVersion
+ // once we stop supporting SPDY/1.
+ NextProto protocol() const { return protocol_; }
+
// Check to see if this SPDY session can support an additional domain.
// If the session is un-authenticated, then this call always returns true.
// For SSL-based sessions, verifies that the server certificate in use by
@@ -1082,7 +1089,13 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
bool enable_credential_frames_;
bool enable_compression_;
bool enable_ping_based_connection_checking_;
- NextProto default_protocol_;
+
+ // The SPDY protocol used. Always between kProtoSPDY2 and
+ // kProtoSPDYMaximumVersion.
+ //
+ // TODO(akalin): Change the lower bound to kProtoSPDYMinimumVersion
+ // once we stop supporting SPDY/1.
+ NextProto protocol_;
SpdyCredentialState credential_state_;
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 9efb20c..4f0aa67 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -60,6 +60,11 @@ SpdySessionPool::SpdySessionPool(
time_func_(time_func),
trusted_spdy_proxy_(
HostPortPair::FromString(trusted_spdy_proxy)) {
+ // TODO(akalin): Change this to kProtoSPDYMinimumVersion once we
+ // stop supporting SPDY/1.
+ DCHECK(default_protocol_ == kProtoUnknown ||
+ (default_protocol_ >= kProtoSPDY2 &&
+ default_protocol_ <= kProtoSPDYMaximumVersion));
NetworkChangeNotifier::AddIPAddressObserver(this);
if (ssl_config_service_.get())
ssl_config_service_->AddObserver(this);
@@ -82,6 +87,11 @@ net::Error SpdySessionPool::CreateAvailableSessionFromSocket(
int certificate_error_code,
base::WeakPtr<SpdySession>* available_session,
bool is_secure) {
+ // TODO(akalin): Change this to kProtoSPDYMinimumVersion once we
+ // stop supporting SPDY/1.
+ DCHECK_GE(default_protocol_, kProtoSPDY2);
+ DCHECK_LE(default_protocol_, kProtoSPDYMaximumVersion);
+
UMA_HISTOGRAM_ENUMERATION(
"Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX);
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 362be55..66a600c 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -43,6 +43,9 @@ class NET_EXPORT SpdySessionPool
public:
typedef base::TimeTicks (*TimeFunc)(void);
+ // |default_protocol| may be kProtoUnknown (e.g., if SPDY is
+ // disabled), but in that case, CreateAvailableSessionFromSocket()
+ // must not be called. Otherwise, it must be a SPDY protocol.
SpdySessionPool(
HostResolver* host_resolver,
SSLConfigService* ssl_config_service,
@@ -69,7 +72,8 @@ class NET_EXPORT SpdySessionPool
// processing existing streams.
// Create a new SPDY session from an existing socket. There must
- // not already be a session for the given key.
+ // not already be a session for the given key. This pool must have
+ // been constructed with a valid |default_protocol| value.
//
// |is_secure| can be false for testing or when SPDY is configured
// to work with non-secure sockets. If |is_secure| is true,
@@ -213,7 +217,7 @@ class NET_EXPORT SpdySessionPool
bool enable_credential_frames_;
bool enable_compression_;
bool enable_ping_based_connection_checking_;
- NextProto default_protocol_;
+ const NextProto default_protocol_;
size_t stream_initial_recv_window_size_;
size_t initial_max_concurrent_streams_;
size_t max_concurrent_streams_limit_;
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc
index 69ba11b..9d0679d 100644
--- a/net/spdy/spdy_session_pool_unittest.cc
+++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -50,7 +50,8 @@ class SpdySessionPoolTest : public ::testing::Test,
INSTANTIATE_TEST_CASE_P(
NextProto,
SpdySessionPoolTest,
- testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
+ testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2,
+ kProtoHTTP2Draft04));
// 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 f0e10eb..ea7a6d1 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -181,7 +181,8 @@ class SpdySessionTest : public PlatformTest,
INSTANTIATE_TEST_CASE_P(
NextProto,
SpdySessionTest,
- testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
+ testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2,
+ kProtoHTTP2Draft04));
// Try to create a SPDY session that will fail during
// initialization. Nothing should blow up.
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 63d6a68..db085cf 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -630,6 +630,10 @@ bool SpdyStream::IsIdle() const {
return io_state_ == STATE_IDLE;
}
+NextProto SpdyStream::GetProtocol() const {
+ return session_->protocol();
+}
+
bool SpdyStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const {
if (stream_id_ == 0)
return false;
diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h
index 06169d1..06209a1 100644
--- a/net/spdy/spdy_stream.h
+++ b/net/spdy/spdy_stream.h
@@ -382,6 +382,13 @@ class NET_EXPORT_PRIVATE SpdyStream {
// request headers and is ready to send/receive more data.
bool IsIdle() const;
+ // Returns the protocol used by this stream. Always between
+ // kProtoSPDY2 and kProtoSPDYMaximumVersion.
+ //
+ // TODO(akalin): Change the lower bound to kProtoSPDYMinimumVersion
+ // once we stop supporting SPDY/1.
+ NextProto GetProtocol() const;
+
int response_status() const { return response_status_; }
bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const;
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc
index 6a14d67..c98ba93 100644
--- a/net/spdy/spdy_stream_unittest.cc
+++ b/net/spdy/spdy_stream_unittest.cc
@@ -112,7 +112,8 @@ class SpdyStreamTest : public ::testing::Test,
INSTANTIATE_TEST_CASE_P(
NextProto,
SpdyStreamTest,
- testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
+ testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2,
+ kProtoHTTP2Draft04));
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 84be098..4c52751 100644
--- a/net/spdy/spdy_test_util_common.cc
+++ b/net/spdy/spdy_test_util_common.cc
@@ -690,39 +690,9 @@ void SpdySessionPoolPeer::EnableSendingInitialSettings(bool enabled) {
pool_->enable_sending_initial_settings_ = enabled;
}
-NextProto NextProtoFromSpdyVersion(SpdyMajorVersion spdy_version) {
- switch (spdy_version) {
- case SPDY2:
- return kProtoSPDY2;
- case SPDY3:
- return kProtoSPDY3;
- case SPDY4:
- return kProtoSPDY4a2;
- default:
- NOTREACHED();
- return kProtoUnknown;
- }
-}
-
-SpdyMajorVersion SpdyVersionFromNextProto(NextProto next_proto) {
- switch (next_proto) {
- case kProtoSPDY2:
- case kProtoSPDY21:
- return SPDY2;
- case kProtoSPDY3:
- case kProtoSPDY31:
- return SPDY3;
- case kProtoSPDY4a2:
- return SPDY4;
- default:
- NOTREACHED();
- return SPDY2;
- }
-}
-
SpdyTestUtil::SpdyTestUtil(NextProto protocol)
: protocol_(protocol),
- spdy_version_(SpdyVersionFromNextProto(protocol)) {
+ spdy_version_(NextProtoToSpdyMajorVersion(protocol)) {
DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol;
}
diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h
index 88fd678..7f5f2ab 100644
--- a/net/spdy/spdy_test_util_common.h
+++ b/net/spdy/spdy_test_util_common.h
@@ -288,13 +288,6 @@ class SpdySessionPoolPeer {
DISALLOW_COPY_AND_ASSIGN(SpdySessionPoolPeer);
};
-// TODO(ttuttle): Move these somewhere more widely-accessible; surely this is
-// not the only place that needs such functions.
-NextProto NextProtoFromSpdyVersion(SpdyMajorVersion spdy_version);
-// TODO(akalin): Merge this with NPNToSpdyVersion() in
-// spdy_session.cc.
-SpdyMajorVersion SpdyVersionFromNextProto(NextProto next_proto);
-
class SpdyTestUtil {
public:
explicit SpdyTestUtil(NextProto protocol);
diff --git a/net/spdy/spdy_websocket_stream_unittest.cc b/net/spdy/spdy_websocket_stream_unittest.cc
index 42dd95c..f05b34e 100644
--- a/net/spdy/spdy_websocket_stream_unittest.cc
+++ b/net/spdy/spdy_websocket_stream_unittest.cc
@@ -299,7 +299,8 @@ class SpdyWebSocketStreamTest
INSTANTIATE_TEST_CASE_P(
NextProto,
SpdyWebSocketStreamTest,
- testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
+ testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2,
+ kProtoHTTP2Draft04));
// TODO(toyoshim): Replace old framing data to new one, then use HEADERS and
// data frames.