diff options
author | ttuttle@chromium.org <ttuttle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-15 21:29:20 +0000 |
---|---|---|
committer | ttuttle@chromium.org <ttuttle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-15 21:29:20 +0000 |
commit | c10b208557384ab926cfcef64cf02065e412d2ce (patch) | |
tree | 54defd8fad0b47da67016f4dfa97253626b5e2d9 /net | |
parent | eb5ba476096c25a8f27d87042e193ba84fa57def (diff) | |
download | chromium_src-c10b208557384ab926cfcef64cf02065e412d2ce.zip chromium_src-c10b208557384ab926cfcef64cf02065e412d2ce.tar.gz chromium_src-c10b208557384ab926cfcef64cf02065e412d2ce.tar.bz2 |
Merge framer-based Construct* functions to SpdyTestUtil
Merge several of the Construct* functions that just call through into the
framer into SpdyTestUtil.
BUG=226192
Review URL: https://chromiumcodereview.appspot.com/15112006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200353 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
20 files changed, 290 insertions, 293 deletions
diff --git a/net/http/http_network_transaction_spdy2_unittest.cc b/net/http/http_network_transaction_spdy2_unittest.cc index 445e812..1b8b8bf 100644 --- a/net/http/http_network_transaction_spdy2_unittest.cc +++ b/net/http/http_network_transaction_spdy2_unittest.cc @@ -2812,7 +2812,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, HttpsProxySpdyConnectHttps) { scoped_ptr<SpdyFrame> wrapped_body( ConstructSpdyBodyFrame(1, "1234567890", 10, false)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, wrapped_get_resp->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_get_resp->size())); MockWrite spdy_writes[] = { CreateMockWrite(*connect, 1), @@ -2893,9 +2893,9 @@ TEST_F(HttpNetworkTransactionSpdy2Test, HttpsProxySpdyConnectSpdy) { scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); scoped_ptr<SpdyFrame> wrapped_body(ConstructWrappedSpdyFrame(body, 1)); scoped_ptr<SpdyFrame> window_update_get_resp( - ConstructSpdyWindowUpdate(1, wrapped_get_resp->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_get_resp->size())); scoped_ptr<SpdyFrame> window_update_body( - ConstructSpdyWindowUpdate(1, wrapped_body->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_body->size())); MockWrite spdy_writes[] = { CreateMockWrite(*connect, 1), @@ -2965,7 +2965,8 @@ TEST_F(HttpNetworkTransactionSpdy2Test, HttpsProxySpdyConnectFailure) { // CONNECT to www.google.com:443 via SPDY scoped_ptr<SpdyFrame> connect(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> get(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> get( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite spdy_writes[] = { CreateMockWrite(*connect, 1), @@ -3040,7 +3041,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, ConstructSpdyBodyFrame(1, resp1, strlen(resp1), false)); scoped_ptr<SpdyFrame> wrapped_body1(ConstructSpdyBodyFrame(1, "1", 1, false)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, wrapped_get_resp1->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_get_resp1->size())); // CONNECT to news.google.com:443 via SPDY. const char* const kConnectHeaders2[] = { @@ -3195,7 +3196,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, ConstructSpdyBodyFrame(1, resp1, strlen(resp1), false)); scoped_ptr<SpdyFrame> wrapped_body1(ConstructSpdyBodyFrame(1, "1", 1, false)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, wrapped_get_resp1->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_get_resp1->size())); // Fetch https://www.google.com/2 via HTTP. const char get2[] = "GET /2 HTTP/1.1\r\n" @@ -5668,7 +5669,8 @@ TEST_F(HttpNetworkTransactionSpdy2Test, RedirectOfHttpsConnectViaSpdyProxy) { request.load_flags = 0; scoped_ptr<SpdyFrame> conn(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> goaway(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> goaway( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite data_writes[] = { CreateMockWrite(*conn.get(), 0, SYNCHRONOUS), }; @@ -5774,7 +5776,8 @@ TEST_F(HttpNetworkTransactionSpdy2Test, request.load_flags = 0; scoped_ptr<SpdyFrame> conn(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite data_writes[] = { CreateMockWrite(*conn.get(), 0, SYNCHRONOUS), CreateMockWrite(*rst.get(), 3, SYNCHRONOUS), @@ -5838,7 +5841,8 @@ TEST_F(HttpNetworkTransactionSpdy2Test, BasicAuthSpdyProxy) { // Since we have proxy, should try to establish tunnel. scoped_ptr<SpdyFrame> req(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); // After calling trans->RestartWithAuth(), this is the request we should // be issuing -- the final header line contains the credentials. @@ -6111,7 +6115,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, CrossOriginProxyPushCorrectness) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); scoped_ptr<SpdyFrame> push_rst( - ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); MockWrite spdy_writes[] = { CreateMockWrite(*stream1_syn, 1, ASYNC), diff --git a/net/http/http_network_transaction_spdy3_unittest.cc b/net/http/http_network_transaction_spdy3_unittest.cc index 45f79e5..173b16f 100644 --- a/net/http/http_network_transaction_spdy3_unittest.cc +++ b/net/http/http_network_transaction_spdy3_unittest.cc @@ -2813,7 +2813,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, HttpsProxySpdyConnectHttps) { scoped_ptr<SpdyFrame> wrapped_body( ConstructSpdyBodyFrame(1, "1234567890", 10, false)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, wrapped_get_resp->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_get_resp->size())); MockWrite spdy_writes[] = { CreateMockWrite(*connect, 1), @@ -2894,9 +2894,9 @@ TEST_F(HttpNetworkTransactionSpdy3Test, HttpsProxySpdyConnectSpdy) { scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); scoped_ptr<SpdyFrame> wrapped_body(ConstructWrappedSpdyFrame(body, 1)); scoped_ptr<SpdyFrame> window_update_get_resp( - ConstructSpdyWindowUpdate(1, wrapped_get_resp->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_get_resp->size())); scoped_ptr<SpdyFrame> window_update_body( - ConstructSpdyWindowUpdate(1, wrapped_body->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_body->size())); MockWrite spdy_writes[] = { CreateMockWrite(*connect, 1), @@ -2966,7 +2966,8 @@ TEST_F(HttpNetworkTransactionSpdy3Test, HttpsProxySpdyConnectFailure) { // CONNECT to www.google.com:443 via SPDY scoped_ptr<SpdyFrame> connect(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> get(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> get( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite spdy_writes[] = { CreateMockWrite(*connect, 1), @@ -3041,7 +3042,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, ConstructSpdyBodyFrame(1, resp1, strlen(resp1), false)); scoped_ptr<SpdyFrame> wrapped_body1(ConstructSpdyBodyFrame(1, "1", 1, false)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, wrapped_get_resp1->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_get_resp1->size())); // CONNECT to news.google.com:443 via SPDY. const char* const kConnectHeaders2[] = { @@ -3196,7 +3197,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, ConstructSpdyBodyFrame(1, resp1, strlen(resp1), false)); scoped_ptr<SpdyFrame> wrapped_body1(ConstructSpdyBodyFrame(1, "1", 1, false)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, wrapped_get_resp1->size())); + spdy_util_.ConstructSpdyWindowUpdate(1, wrapped_get_resp1->size())); // Fetch https://www.google.com/2 via HTTP. const char get2[] = "GET /2 HTTP/1.1\r\n" @@ -5654,7 +5655,8 @@ TEST_F(HttpNetworkTransactionSpdy3Test, RedirectOfHttpsConnectViaSpdyProxy) { request.load_flags = 0; scoped_ptr<SpdyFrame> conn(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> goaway(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> goaway( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite data_writes[] = { CreateMockWrite(*conn.get(), 0, SYNCHRONOUS), }; @@ -5760,7 +5762,8 @@ TEST_F(HttpNetworkTransactionSpdy3Test, request.load_flags = 0; scoped_ptr<SpdyFrame> conn(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite data_writes[] = { CreateMockWrite(*conn.get(), 0, SYNCHRONOUS), CreateMockWrite(*rst.get(), 3, SYNCHRONOUS), @@ -5824,7 +5827,8 @@ TEST_F(HttpNetworkTransactionSpdy3Test, BasicAuthSpdyProxy) { // Since we have proxy, should try to establish tunnel. scoped_ptr<SpdyFrame> req(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); // After calling trans->RestartWithAuth(), this is the request we should // be issuing -- the final header line contains the credentials. @@ -6096,7 +6100,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, CrossOriginProxyPushCorrectness) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); scoped_ptr<SpdyFrame> push_rst( - ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); MockWrite spdy_writes[] = { CreateMockWrite(*stream1_syn, 1, ASYNC), diff --git a/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc b/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc index ae40ab0..75393d1 100644 --- a/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc @@ -248,7 +248,8 @@ TEST_P(HttpProxyClientSocketPoolSpdy2Test, NeedAuth) { MockRead(ASYNC, 4, "0123456789"), }; scoped_ptr<SpdyFrame> req(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite spdy_writes[] = { CreateMockWrite(*req, 0, ASYNC), CreateMockWrite(*rst, 2, ASYNC), @@ -494,7 +495,8 @@ TEST_P(HttpProxyClientSocketPoolSpdy2Test, TunnelSetupError) { }; scoped_ptr<SpdyFrame> req(ConstructSpdyConnect(kAuthHeaders, kAuthHeadersSize, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite spdy_writes[] = { CreateMockWrite(*req, 0, ASYNC), CreateMockWrite(*rst, 2, ASYNC), @@ -544,7 +546,8 @@ TEST_P(HttpProxyClientSocketPoolSpdy2Test, TunnelSetupRedirect) { }; scoped_ptr<SpdyFrame> req( ConstructSpdyConnect(kAuthHeaders, kAuthHeadersSize, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite spdy_writes[] = { CreateMockWrite(*req, 0, ASYNC), diff --git a/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc b/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc index 9b87544..e90dbb9 100644 --- a/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc @@ -248,7 +248,8 @@ TEST_P(HttpProxyClientSocketPoolSpdy3Test, NeedAuth) { MockRead(ASYNC, 4, "0123456789"), }; scoped_ptr<SpdyFrame> req(ConstructSpdyConnect(NULL, 0, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite spdy_writes[] = { CreateMockWrite(*req, 0, ASYNC), CreateMockWrite(*rst, 2, ASYNC), @@ -495,7 +496,8 @@ TEST_P(HttpProxyClientSocketPoolSpdy3Test, TunnelSetupError) { }; scoped_ptr<SpdyFrame> req(ConstructSpdyConnect(kAuthHeaders, kAuthHeadersSize, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite spdy_writes[] = { CreateMockWrite(*req, 0, ASYNC), CreateMockWrite(*rst, 2, ASYNC), @@ -545,7 +547,8 @@ TEST_P(HttpProxyClientSocketPoolSpdy3Test, TunnelSetupRedirect) { }; scoped_ptr<SpdyFrame> req( ConstructSpdyConnect(kAuthHeaders, kAuthHeadersSize, 1)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite spdy_writes[] = { CreateMockWrite(*req, 0, ASYNC), diff --git a/net/spdy/spdy_http_stream_spdy3_unittest.cc b/net/spdy/spdy_http_stream_spdy3_unittest.cc index 76f7a99..76924fa 100644 --- a/net/spdy/spdy_http_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_http_stream_spdy3_unittest.cc @@ -66,7 +66,9 @@ void TestLoadTimingNotReused(const HttpStream& stream) { class SpdyHttpStreamSpdy3Test : public testing::Test { public: - SpdyHttpStreamSpdy3Test() : session_deps_(kProtoSPDY3) { + SpdyHttpStreamSpdy3Test() + : spdy_util_(kProtoSPDY3), + session_deps_(kProtoSPDY3) { session_deps_.net_log = &net_log_; } @@ -144,6 +146,7 @@ class SpdyHttpStreamSpdy3Test : public testing::Test { const std::string& cert, const std::string& proof); + SpdyTestUtil spdy_util_; CapturingNetLog net_log_; SpdySessionDependencies session_deps_; scoped_ptr<OrderedSocketData> data_; @@ -517,7 +520,7 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPostWithWindowUpdate) { }; scoped_ptr<SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, kUploadDataSize)); + spdy_util_.ConstructSpdyWindowUpdate(1, kUploadDataSize)); MockRead reads[] = { CreateMockRead(*window_update, 2), CreateMockRead(*resp, 3), @@ -780,7 +783,8 @@ void SpdyHttpStreamSpdy3Test::TestSendCredentials( scoped_ptr<SpdyFrame> req(ConstructCredentialRequestFrame( 1, GURL(kUrl1), 1)); - scoped_ptr<SpdyFrame> credential(ConstructSpdyCredential(cred)); + scoped_ptr<SpdyFrame> credential( + spdy_util_.ConstructSpdyCredential(cred)); scoped_ptr<SpdyFrame> req2(ConstructCredentialRequestFrame( 2, GURL(kUrl2), 3)); MockWrite writes[] = { diff --git a/net/spdy/spdy_network_transaction_spdy2_unittest.cc b/net/spdy/spdy_network_transaction_spdy2_unittest.cc index 144b63e..3b5a03d 100644 --- a/net/spdy/spdy_network_transaction_spdy2_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy2_unittest.cc @@ -1021,7 +1021,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrent) { const uint32 max_concurrent_streams = 1; settings[SETTINGS_MAX_CONCURRENT_STREAMS] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*req), @@ -1155,7 +1156,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, FourGetsWithMaxConcurrentPriority) { const uint32 max_concurrent_streams = 1; settings[SETTINGS_MAX_CONCURRENT_STREAMS] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*req2), @@ -1294,7 +1296,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrentDelete) { const uint32 max_concurrent_streams = 1; settings[SETTINGS_MAX_CONCURRENT_STREAMS] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*req2), @@ -1425,7 +1428,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrentSocketClose) { const uint32 max_concurrent_streams = 1; settings[SETTINGS_MAX_CONCURRENT_STREAMS] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*req2), @@ -1962,7 +1966,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, PostWithEarlySynReply) { TEST_P(SpdyNetworkTransactionSpdy2Test, SocketWriteReturnsZero) { scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite writes[] = { CreateMockWrite(*req.get(), 0, SYNCHRONOUS), MockWrite(SYNCHRONOUS, 0, 0, 2), @@ -2060,7 +2064,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResetReplyWithTransferEncoding) { // Construct the request. scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*rst), @@ -2093,7 +2097,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResetPushWithTransferEncoding) { // Construct the request. scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*rst), @@ -2168,7 +2172,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CancelledTransaction) { TEST_P(SpdyNetworkTransactionSpdy2Test, CancelledTransactionSendRst) { scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite writes[] = { CreateMockWrite(*req, 0, SYNCHRONOUS), CreateMockWrite(*rst, 2, SYNCHRONOUS), @@ -2422,7 +2426,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeaders) { scoped_ptr<SpdyFrame> syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> - rst(ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); + rst(spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*syn, 0), CreateMockWrite(*rst, 2), @@ -2453,7 +2457,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeadersInHeadersFrame) { scoped_ptr<SpdyFrame> syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> - rst(ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); + rst(spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*syn, 0), CreateMockWrite(*rst, 2), @@ -2510,7 +2514,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeadersOnPush) { scoped_ptr<SpdyFrame> syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> - rst(ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); + rst(spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*syn, 0), CreateMockWrite(*rst, 2), @@ -2581,7 +2585,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectServerPush) { "301 Moved Permanently", "http://www.foo.com/index.php")); scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(2, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_CANCEL)); MockWrite writes[] = { CreateMockWrite(*req, 1), CreateMockWrite(*rst, 6), @@ -2842,8 +2847,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushServerAborted) { 2, 1, "http://www.google.com/foo.dat")); - scoped_ptr<SpdyFrame> - stream2_rst(ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); + scoped_ptr<SpdyFrame> stream2_rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); MockRead reads[] = { CreateMockRead(*stream1_reply, 2), CreateMockRead(*stream2_syn, 3), @@ -2899,8 +2904,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushDuplicate) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> - stream3_rst(ConstructSpdyRstStream(4, RST_STREAM_PROTOCOL_ERROR)); + scoped_ptr<SpdyFrame> stream3_rst( + spdy_util_.ConstructSpdyRstStream(4, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*stream3_rst, 5), @@ -3076,8 +3081,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushInvalidAssociatedStreamID0) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> - stream2_rst(ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); + scoped_ptr<SpdyFrame> stream2_rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*stream2_rst, 4), @@ -3137,8 +3142,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushInvalidAssociatedStreamID9) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> - stream2_rst(ConstructSpdyRstStream(2, RST_STREAM_INVALID_STREAM)); + scoped_ptr<SpdyFrame> stream2_rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_INVALID_STREAM)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*stream2_rst, 4), @@ -3198,8 +3203,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushNoURL) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> - stream2_rst(ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); + scoped_ptr<SpdyFrame> stream2_rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*stream2_rst, 4), @@ -3661,7 +3666,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DecompressFailureOnSynReply) { scoped_ptr<SpdyFrame> compressed( ConstructSpdyGet(NULL, 0, true, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*compressed), }; @@ -4274,7 +4279,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsSaved) { // Next add another persisted setting. settings[kSampleId3] = SettingsFlagsAndValue(SETTINGS_FLAG_PLEASE_PERSIST, kSampleValue3); - settings_frame.reset(ConstructSpdySettings(settings)); + settings_frame.reset(spdy_util_.ConstructSpdySettings(settings)); } scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); @@ -4376,7 +4381,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsPlayback) { const SettingsMap& settings = spdy_session_pool->http_server_properties()->GetSpdySettings( host_port_pair); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); // Construct the request. scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); @@ -4438,7 +4444,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, GoAwayWithActiveStream) { scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; - scoped_ptr<SpdyFrame> go_away(ConstructSpdyGoAway()); + scoped_ptr<SpdyFrame> go_away(spdy_util_.ConstructSpdyGoAway()); MockRead reads[] = { CreateMockRead(*go_away), MockRead(ASYNC, 0, 0), // EOF @@ -5690,7 +5696,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushCrossOriginCorrectness) { scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); scoped_ptr<SpdyFrame> push_rst( - ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*push_rst, 4), @@ -5705,7 +5711,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushCrossOriginCorrectness) { 1, url_to_push)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(2, RST_STREAM_CANCEL)); + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_CANCEL)); MockRead reads[] = { CreateMockRead(*stream1_reply, 2), @@ -5775,7 +5781,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RetryAfterRefused) { }; scoped_ptr<SpdyFrame> refused( - ConstructSpdyRstStream(1, RST_STREAM_REFUSED_STREAM)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_REFUSED_STREAM)); scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 3)); scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(3, true)); MockRead reads[] = { diff --git a/net/spdy/spdy_network_transaction_spdy3_unittest.cc b/net/spdy/spdy_network_transaction_spdy3_unittest.cc index 121ccc9..f17fe54 100644 --- a/net/spdy/spdy_network_transaction_spdy3_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy3_unittest.cc @@ -1025,7 +1025,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrent) { const uint32 max_concurrent_streams = 1; settings[SETTINGS_MAX_CONCURRENT_STREAMS] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*req), @@ -1159,7 +1160,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FourGetsWithMaxConcurrentPriority) { const uint32 max_concurrent_streams = 1; settings[SETTINGS_MAX_CONCURRENT_STREAMS] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*req2), @@ -1298,7 +1300,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentDelete) { const uint32 max_concurrent_streams = 1; settings[SETTINGS_MAX_CONCURRENT_STREAMS] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*req2), @@ -1429,7 +1432,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentSocketClose) { const uint32 max_concurrent_streams = 1; settings[SETTINGS_MAX_CONCURRENT_STREAMS] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*req2), @@ -1969,7 +1973,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, PostWithEarlySynReply) { TEST_P(SpdyNetworkTransactionSpdy3Test, SocketWriteReturnsZero) { scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite writes[] = { CreateMockWrite(*req.get(), 0, SYNCHRONOUS), MockWrite(SYNCHRONOUS, 0, 0, 2), @@ -2104,9 +2108,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateReceived) { static const int32 kDeltaWindowSize = 0xff; static const int kDeltaCount = 4; scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, kDeltaWindowSize)); + spdy_util_.ConstructSpdyWindowUpdate(1, kDeltaWindowSize)); scoped_ptr<SpdyFrame> window_update_dummy( - ConstructSpdyWindowUpdate(2, kDeltaWindowSize)); + spdy_util_.ConstructSpdyWindowUpdate(2, kDeltaWindowSize)); scoped_ptr<SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0)); MockRead reads[] = { CreateMockRead(*window_update_dummy, 3), @@ -2177,7 +2181,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateSent) { scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, body_data.size())); + spdy_util_.ConstructSpdyWindowUpdate(1, body_data.size())); MockWrite writes[] = { CreateMockWrite(*req), @@ -2264,7 +2268,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateOverflow) { scoped_ptr<SpdyFrame> body( ConstructSpdyBodyFrame(1, content->c_str(), content->size(), false)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_FLOW_CONTROL_ERROR)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_FLOW_CONTROL_ERROR)); // We're not going to write a data frame with FIN, we'll receive a bad // WINDOW_UPDATE while sending a request and will send a RST_STREAM frame. @@ -2276,7 +2280,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateOverflow) { static const int32 kDeltaWindowSize = 0x7fffffff; // cause an overflow scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, kDeltaWindowSize)); + spdy_util_.ConstructSpdyWindowUpdate(1, kDeltaWindowSize)); MockRead reads[] = { CreateMockRead(*window_update, 1), MockRead(ASYNC, 0, 4) // EOF @@ -2371,7 +2375,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResume) { // Construct read frame, give enough space to upload the rest of the // data. scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate(1, kUploadDataSize)); + spdy_util_.ConstructSpdyWindowUpdate(1, kUploadDataSize)); scoped_ptr<SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); MockRead reads[] = { CreateMockRead(*window_update), @@ -2472,7 +2476,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResumeAfterSettings) { settings[SETTINGS_INITIAL_WINDOW_SIZE] = SettingsFlagsAndValue( SETTINGS_FLAG_NONE, kSpdyStreamInitialWindowSize * 2); - scoped_ptr<SpdyFrame> settings_frame_large(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame_large( + spdy_util_.ConstructSpdySettings(settings)); scoped_ptr<SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); MockRead reads[] = { CreateMockRead(*settings_frame_large), @@ -2577,11 +2582,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlNegativeSendWindowSize) { SettingsFlagsAndValue( SETTINGS_FLAG_NONE, kSpdyStreamInitialWindowSize / 2); scoped_ptr<SpdyFrame> settings_frame_small( - ConstructSpdySettings(new_settings)); + spdy_util_.ConstructSpdySettings(new_settings)); // Construct read frame for WINDOW_UPDATE that makes the send_window_size // postive. scoped_ptr<SpdyFrame> window_update_init_size( - ConstructSpdyWindowUpdate(1, kSpdyStreamInitialWindowSize)); + spdy_util_.ConstructSpdyWindowUpdate(1, kSpdyStreamInitialWindowSize)); scoped_ptr<SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); MockRead reads[] = { CreateMockRead(*settings_frame_small), @@ -2642,7 +2647,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResetReplyWithTransferEncoding) { // Construct the request. scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*rst), @@ -2675,7 +2680,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResetPushWithTransferEncoding) { // Construct the request. scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*req), CreateMockWrite(*rst), @@ -2752,7 +2757,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CancelledTransaction) { TEST_P(SpdyNetworkTransactionSpdy3Test, CancelledTransactionSendRst) { scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite writes[] = { CreateMockWrite(*req, 0, SYNCHRONOUS), CreateMockWrite(*rst, 2, SYNCHRONOUS), @@ -3005,7 +3010,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeaders) { scoped_ptr<SpdyFrame> syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> - rst(ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); + rst(spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*syn, 0), CreateMockWrite(*rst, 2), @@ -3036,7 +3041,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeadersInHeadersFrame) { scoped_ptr<SpdyFrame> syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> - rst(ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); + rst(spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*syn, 0), CreateMockWrite(*rst, 2), @@ -3093,7 +3098,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeadersOnPush) { scoped_ptr<SpdyFrame> syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> - rst(ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); + rst(spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*syn, 0), CreateMockWrite(*rst, 2), @@ -3167,7 +3172,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectServerPush) { "301 Moved Permanently", "http://www.foo.com/index.php")); scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(2, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_CANCEL)); MockWrite writes[] = { CreateMockWrite(*req, 1), CreateMockWrite(*rst, 6), @@ -3428,8 +3434,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushServerAborted) { 2, 1, "http://www.google.com/foo.dat")); - scoped_ptr<SpdyFrame> - stream2_rst(ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); + scoped_ptr<SpdyFrame> stream2_rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); MockRead reads[] = { CreateMockRead(*stream1_reply, 2), CreateMockRead(*stream2_syn, 3), @@ -3485,8 +3491,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushDuplicate) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> - stream3_rst(ConstructSpdyRstStream(4, RST_STREAM_PROTOCOL_ERROR)); + scoped_ptr<SpdyFrame> stream3_rst( + spdy_util_.ConstructSpdyRstStream(4, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*stream3_rst, 5), @@ -3662,8 +3668,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushInvalidAssociatedStreamID0) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> - stream2_rst(ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); + scoped_ptr<SpdyFrame> stream2_rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*stream2_rst, 4), @@ -3723,8 +3729,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushInvalidAssociatedStreamID9) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> - stream2_rst(ConstructSpdyRstStream(2, RST_STREAM_INVALID_STREAM)); + scoped_ptr<SpdyFrame> stream2_rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_INVALID_STREAM)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*stream2_rst, 4), @@ -3784,8 +3790,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushNoURL) { stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> - stream2_rst(ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); + scoped_ptr<SpdyFrame> stream2_rst( + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*stream2_rst, 4), @@ -4247,7 +4253,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DecompressFailureOnSynReply) { scoped_ptr<SpdyFrame> compressed( ConstructSpdyGet(NULL, 0, true, 1, LOWEST)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*compressed), }; @@ -4860,7 +4866,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) { // Next add another persisted setting. settings[kSampleId3] = SettingsFlagsAndValue(SETTINGS_FLAG_PLEASE_PERSIST, kSampleValue3); - settings_frame.reset(ConstructSpdySettings(settings)); + settings_frame.reset(spdy_util_.ConstructSpdySettings(settings)); } scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); @@ -4962,7 +4968,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsPlayback) { const SettingsMap& settings = spdy_session_pool->http_server_properties()->GetSpdySettings( host_port_pair); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); // Construct the request. scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); @@ -5024,7 +5031,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, GoAwayWithActiveStream) { scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); MockWrite writes[] = { CreateMockWrite(*req) }; - scoped_ptr<SpdyFrame> go_away(ConstructSpdyGoAway()); + scoped_ptr<SpdyFrame> go_away(spdy_util_.ConstructSpdyGoAway()); MockRead reads[] = { CreateMockRead(*go_away), MockRead(ASYNC, 0, 0), // EOF @@ -6283,7 +6290,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushCrossOriginCorrectness) { scoped_ptr<SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); scoped_ptr<SpdyFrame> push_rst( - ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); MockWrite writes[] = { CreateMockWrite(*stream1_syn, 1), CreateMockWrite(*push_rst, 4), @@ -6298,7 +6305,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushCrossOriginCorrectness) { 1, url_to_push)); scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(2, RST_STREAM_CANCEL)); + spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_CANCEL)); MockRead reads[] = { CreateMockRead(*stream1_reply, 2), @@ -6368,7 +6375,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RetryAfterRefused) { }; scoped_ptr<SpdyFrame> refused( - ConstructSpdyRstStream(1, RST_STREAM_REFUSED_STREAM)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_REFUSED_STREAM)); scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 3)); scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(3, true)); MockRead reads[] = { diff --git a/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc b/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc index 58055d7..163f9a1 100644 --- a/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc @@ -109,6 +109,7 @@ class SpdyProxyClientSocketSpdy2Test : public PlatformTest { data_->Run(); } + SpdyTestUtil spdy_util_; scoped_ptr<SpdyProxyClientSocket> sock_; TestCompletionCallback read_callback_; TestCompletionCallback write_callback_; @@ -116,7 +117,6 @@ class SpdyProxyClientSocketSpdy2Test : public PlatformTest { CapturingBoundNetLog net_log_; private: - SpdyTestUtil spdy_util_; scoped_refptr<HttpNetworkSession> session_; scoped_refptr<IOBuffer> read_buf_; SpdySessionDependencies session_deps_; @@ -136,9 +136,9 @@ class SpdyProxyClientSocketSpdy2Test : public PlatformTest { }; SpdyProxyClientSocketSpdy2Test::SpdyProxyClientSocketSpdy2Test() - : sock_(NULL), + : spdy_util_(kProtoSPDY2), + sock_(NULL), data_(NULL), - spdy_util_(kProtoSPDY2), session_(NULL), read_buf_(NULL), session_deps_(kProtoSPDY2), @@ -1270,7 +1270,8 @@ TEST_F(SpdyProxyClientSocketSpdy2Test, RstWithReadAndWritePending) { }; scoped_ptr<SpdyFrame> resp(ConstructConnectReplyFrame()); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockRead reads[] = { CreateMockRead(*resp, 1, ASYNC), CreateMockRead(*rst, 3, ASYNC), @@ -1391,7 +1392,8 @@ TEST_F(SpdyProxyClientSocketSpdy2Test, RstWithReadAndWritePendingDelete) { }; scoped_ptr<SpdyFrame> resp(ConstructConnectReplyFrame()); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockRead reads[] = { CreateMockRead(*resp, 1, ASYNC), CreateMockRead(*rst, 3, ASYNC), diff --git a/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc b/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc index 749cb90..d301731 100644 --- a/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc @@ -109,6 +109,7 @@ class SpdyProxyClientSocketSpdy3Test : public PlatformTest { data_->Run(); } + SpdyTestUtil spdy_util_; scoped_ptr<SpdyProxyClientSocket> sock_; TestCompletionCallback read_callback_; TestCompletionCallback write_callback_; @@ -116,7 +117,6 @@ class SpdyProxyClientSocketSpdy3Test : public PlatformTest { CapturingBoundNetLog net_log_; private: - SpdyTestUtil spdy_util_; scoped_refptr<HttpNetworkSession> session_; scoped_refptr<IOBuffer> read_buf_; SpdySessionDependencies session_deps_; @@ -136,9 +136,9 @@ class SpdyProxyClientSocketSpdy3Test : public PlatformTest { }; SpdyProxyClientSocketSpdy3Test::SpdyProxyClientSocketSpdy3Test() - : sock_(NULL), + : spdy_util_(kProtoSPDY3), + sock_(NULL), data_(NULL), - spdy_util_(kProtoSPDY3), session_(NULL), read_buf_(NULL), session_deps_(kProtoSPDY3), @@ -1271,7 +1271,8 @@ TEST_F(SpdyProxyClientSocketSpdy3Test, RstWithReadAndWritePending) { }; scoped_ptr<SpdyFrame> resp(ConstructConnectReplyFrame()); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockRead reads[] = { CreateMockRead(*resp, 1, ASYNC), CreateMockRead(*rst, 3, ASYNC), @@ -1392,7 +1393,8 @@ TEST_F(SpdyProxyClientSocketSpdy3Test, RstWithReadAndWritePendingDelete) { }; scoped_ptr<SpdyFrame> resp(ConstructConnectReplyFrame()); - scoped_ptr<SpdyFrame> rst(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> rst( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockRead reads[] = { CreateMockRead(*resp, 1, ASYNC), CreateMockRead(*rst, 3, ASYNC), diff --git a/net/spdy/spdy_session_spdy2_unittest.cc b/net/spdy/spdy_session_spdy2_unittest.cc index cd5f562..d579a3f 100644 --- a/net/spdy/spdy_session_spdy2_unittest.cc +++ b/net/spdy/spdy_session_spdy2_unittest.cc @@ -135,7 +135,7 @@ TEST_F(SpdySessionSpdy2Test, GoAway) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> goaway(ConstructSpdyGoAway(1)); + scoped_ptr<SpdyFrame> goaway(spdy_util_.ConstructSpdyGoAway(1)); MockRead reads[] = { CreateMockRead(*goaway, 2), MockRead(ASYNC, 0, 3) // EOF @@ -218,12 +218,12 @@ TEST_F(SpdySessionSpdy2Test, ClientPing) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> read_ping(ConstructSpdyPing(1)); + scoped_ptr<SpdyFrame> read_ping(spdy_util_.ConstructSpdyPing(1)); MockRead reads[] = { CreateMockRead(*read_ping), MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<SpdyFrame> write_ping(ConstructSpdyPing(1)); + scoped_ptr<SpdyFrame> write_ping(spdy_util_.ConstructSpdyPing(1)); MockWrite writes[] = { CreateMockWrite(*write_ping), }; @@ -273,12 +273,12 @@ TEST_F(SpdySessionSpdy2Test, ServerPing) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> read_ping(ConstructSpdyPing(2)); + scoped_ptr<SpdyFrame> read_ping(spdy_util_.ConstructSpdyPing(2)); MockRead reads[] = { CreateMockRead(*read_ping), MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<SpdyFrame> write_ping(ConstructSpdyPing(2)); + scoped_ptr<SpdyFrame> write_ping(spdy_util_.ConstructSpdyPing(2)); MockWrite writes[] = { CreateMockWrite(*write_ping), }; @@ -371,12 +371,12 @@ TEST_F(SpdySessionSpdy2Test, FailedPing) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> read_ping(ConstructSpdyPing(1)); + scoped_ptr<SpdyFrame> read_ping(spdy_util_.ConstructSpdyPing(1)); MockRead reads[] = { CreateMockRead(*read_ping), MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<SpdyFrame> write_ping(ConstructSpdyPing(1)); + scoped_ptr<SpdyFrame> write_ping(spdy_util_.ConstructSpdyPing(1)); MockWrite writes[] = { CreateMockWrite(*write_ping), }; @@ -558,7 +558,8 @@ TEST_F(SpdySessionSpdy2Test, OnSettings) { // Set up the socket so we read a SETTINGS frame that raises max concurrent // streams to 2. MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(new_settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(new_settings)); MockRead reads[] = { CreateMockRead(*settings_frame), MockRead(SYNCHRONOUS, 0, 0) // EOF @@ -612,7 +613,8 @@ TEST_F(SpdySessionSpdy2Test, ClearSettings) { // Set up the socket so we read a SETTINGS frame that raises max concurrent // streams to 2 and clears previously persisted data. MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(new_settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(new_settings)); uint8 flags = SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS; test::SetFrameFlags(settings_frame.get(), flags, kSpdyVersion3); MockRead reads[] = { @@ -734,7 +736,8 @@ TEST_F(SpdySessionSpdy2Test, SendInitialSettingsOnNewSession) { settings[kSpdySettingsIds1] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*settings_frame), }; @@ -775,7 +778,8 @@ TEST_F(SpdySessionSpdy2Test, SendSettingsOnNewSession) { settings[kSpdySettingsIds1] = SettingsFlagsAndValue(SETTINGS_FLAG_PERSISTED, kBogusSettingValue); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*settings_frame), }; @@ -1062,7 +1066,7 @@ TEST_F(SpdySessionSpdy2Test, CloseSessionOnError) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> goaway(ConstructSpdyGoAway()); + scoped_ptr<SpdyFrame> goaway(spdy_util_.ConstructSpdyGoAway()); MockRead reads[] = { CreateMockRead(*goaway), MockRead(SYNCHRONOUS, 0, 0) // EOF @@ -1498,7 +1502,8 @@ TEST_F(SpdySessionSpdy2Test, CloseTwoStalledCreateStream) { // Set up the socket so we read a SETTINGS frame that sets max concurrent // streams to 1. - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(new_settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(new_settings)); scoped_ptr<SpdyFrame> resp1(ConstructSpdyGetSynReply(NULL, 0, 1)); scoped_ptr<SpdyFrame> body1(ConstructSpdyBodyFrame(1, true)); @@ -2070,7 +2075,7 @@ TEST_F(SpdySessionSpdy2Test, GoAwayWhileInDoLoop) { scoped_ptr<SpdyFrame> resp1(ConstructSpdyGetSynReply(NULL, 0, 1)); scoped_ptr<SpdyFrame> body1(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> goaway(ConstructSpdyGoAway()); + scoped_ptr<SpdyFrame> goaway(spdy_util_.ConstructSpdyGoAway()); MockRead reads[] = { CreateMockRead(*resp1, 1), @@ -2281,7 +2286,8 @@ TEST_F(SpdySessionSpdy2Test, CloseOneIdleConnectionFailsWhenSessionInUse) { MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. }; scoped_ptr<SpdyFrame> req1(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); - scoped_ptr<SpdyFrame> cancel1(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> cancel1( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite writes[] = { CreateMockWrite(*req1, 1), CreateMockWrite(*cancel1, 1), diff --git a/net/spdy/spdy_session_spdy3_unittest.cc b/net/spdy/spdy_session_spdy3_unittest.cc index 7bb1b0a..4284ff6 100644 --- a/net/spdy/spdy_session_spdy3_unittest.cc +++ b/net/spdy/spdy_session_spdy3_unittest.cc @@ -217,7 +217,7 @@ TEST_F(SpdySessionSpdy3Test, GoAway) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> goaway(ConstructSpdyGoAway(1)); + scoped_ptr<SpdyFrame> goaway(spdy_util_.ConstructSpdyGoAway(1)); MockRead reads[] = { CreateMockRead(*goaway, 2), MockRead(ASYNC, 0, 3) // EOF @@ -300,12 +300,12 @@ TEST_F(SpdySessionSpdy3Test, ClientPing) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> read_ping(ConstructSpdyPing(1)); + scoped_ptr<SpdyFrame> read_ping(spdy_util_.ConstructSpdyPing(1)); MockRead reads[] = { CreateMockRead(*read_ping), MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<SpdyFrame> write_ping(ConstructSpdyPing(1)); + scoped_ptr<SpdyFrame> write_ping(spdy_util_.ConstructSpdyPing(1)); MockWrite writes[] = { CreateMockWrite(*write_ping), }; @@ -355,12 +355,12 @@ TEST_F(SpdySessionSpdy3Test, ServerPing) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> read_ping(ConstructSpdyPing(2)); + scoped_ptr<SpdyFrame> read_ping(spdy_util_.ConstructSpdyPing(2)); MockRead reads[] = { CreateMockRead(*read_ping), MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<SpdyFrame> write_ping(ConstructSpdyPing(2)); + scoped_ptr<SpdyFrame> write_ping(spdy_util_.ConstructSpdyPing(2)); MockWrite writes[] = { CreateMockWrite(*write_ping), }; @@ -457,12 +457,12 @@ TEST_F(SpdySessionSpdy3Test, FailedPing) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> read_ping(ConstructSpdyPing(1)); + scoped_ptr<SpdyFrame> read_ping(spdy_util_.ConstructSpdyPing(1)); MockRead reads[] = { CreateMockRead(*read_ping), MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<SpdyFrame> write_ping(ConstructSpdyPing(1)); + scoped_ptr<SpdyFrame> write_ping(spdy_util_.ConstructSpdyPing(1)); MockWrite writes[] = { CreateMockWrite(*write_ping), }; @@ -644,7 +644,8 @@ TEST_F(SpdySessionSpdy3Test, OnSettings) { // Set up the socket so we read a SETTINGS frame that raises max concurrent // streams to 2. MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(new_settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(new_settings)); MockRead reads[] = { CreateMockRead(*settings_frame), MockRead(SYNCHRONOUS, 0, 0) // EOF @@ -699,7 +700,8 @@ TEST_F(SpdySessionSpdy3Test, ClearSettings) { // Set up the socket so we read a SETTINGS frame that raises max concurrent // streams to 2 and clears previously persisted data. MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(new_settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(new_settings)); uint8 flags = SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS; test::SetFrameFlags(settings_frame.get(), flags, kSpdyVersion3); MockRead reads[] = { @@ -824,7 +826,8 @@ TEST_F(SpdySessionSpdy3Test, SendInitialSettingsOnNewSession) { settings[kSpdySettingsIds2] = SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kInitialRecvWindowSize); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*settings_frame), }; @@ -866,7 +869,8 @@ TEST_F(SpdySessionSpdy3Test, SendSettingsOnNewSession) { settings[kSpdySettingsIds1] = SettingsFlagsAndValue(SETTINGS_FLAG_PERSISTED, kBogusSettingValue); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*settings_frame), }; @@ -1204,7 +1208,7 @@ TEST_F(SpdySessionSpdy3Test, CloseSessionOnError) { session_deps_.host_resolver->set_synchronous_mode(true); MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> goaway(ConstructSpdyGoAway()); + scoped_ptr<SpdyFrame> goaway(spdy_util_.ConstructSpdyGoAway()); MockRead reads[] = { CreateMockRead(*goaway), MockRead(SYNCHRONOUS, 0, 0) // EOF @@ -1623,7 +1627,8 @@ TEST_F(SpdySessionSpdy3Test, CloseTwoStalledCreateStream) { // Set up the socket so we read a SETTINGS frame that sets max concurrent // streams to 1. - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(new_settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(new_settings)); scoped_ptr<SpdyFrame> resp1(ConstructSpdyGetSynReply(NULL, 0, 1)); scoped_ptr<SpdyFrame> body1(ConstructSpdyBodyFrame(1, true)); @@ -1872,7 +1877,8 @@ TEST_F(SpdySessionSpdy3Test, SendCredentials) { MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. }; SettingsMap settings; - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(settings)); MockWrite writes[] = { CreateMockWrite(*settings_frame), }; @@ -1941,7 +1947,8 @@ TEST_F(SpdySessionSpdy3Test, UpdateStreamsSendWindowSize) { // Set up the socket so we read a SETTINGS frame that sets // INITIAL_WINDOW_SIZE. MockConnect connect_data(SYNCHRONOUS, OK); - scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(new_settings)); + scoped_ptr<SpdyFrame> settings_frame( + spdy_util_.ConstructSpdySettings(new_settings)); MockRead reads[] = { CreateMockRead(*settings_frame, 0), MockRead(ASYNC, 0, 1) // EOF @@ -2283,7 +2290,7 @@ TEST_F(SpdySessionSpdy3Test, GoAwayWhileInDoLoop) { scoped_ptr<SpdyFrame> resp1(ConstructSpdyGetSynReply(NULL, 0, 1)); scoped_ptr<SpdyFrame> body1(ConstructSpdyBodyFrame(1, true)); - scoped_ptr<SpdyFrame> goaway(ConstructSpdyGoAway()); + scoped_ptr<SpdyFrame> goaway(spdy_util_.ConstructSpdyGoAway()); MockRead reads[] = { CreateMockRead(*resp1, 1), @@ -2456,11 +2463,11 @@ TEST_F(SpdySessionSpdy3Test, AdjustRecvWindowSize31) { MockRead(ASYNC, 0, 2) // EOF }; scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kSpdySessionInitialWindowSize + delta_window_size)); MockWrite writes[] = { @@ -2553,7 +2560,7 @@ TEST_F(SpdySessionSpdy3Test, SessionFlowControlInactiveStream31) { MockRead(ASYNC, 0, 2) // EOF }; scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); MockWrite writes[] = { @@ -2613,7 +2620,7 @@ TEST_F(SpdySessionSpdy3Test, SessionFlowControlNoReceiveLeaks31) { MockConnect connect_data(SYNCHRONOUS, OK); scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); scoped_ptr<SpdyFrame> req( @@ -2630,7 +2637,7 @@ TEST_F(SpdySessionSpdy3Test, SessionFlowControlNoReceiveLeaks31) { scoped_ptr<SpdyFrame> echo( ConstructSpdyBodyFrame(1, msg_data.data(), msg_data_size, false)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, msg_data_size)); MockRead reads[] = { CreateMockRead(*resp, 2), @@ -2700,7 +2707,7 @@ TEST_F(SpdySessionSpdy3Test, SessionFlowControlNoSendLeaks31) { MockConnect connect_data(SYNCHRONOUS, OK); scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); scoped_ptr<SpdyFrame> req( @@ -2781,7 +2788,7 @@ TEST_F(SpdySessionSpdy3Test, SessionFlowControlEndToEnd31) { MockConnect connect_data(SYNCHRONOUS, OK); scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); scoped_ptr<SpdyFrame> req( @@ -2798,7 +2805,7 @@ TEST_F(SpdySessionSpdy3Test, SessionFlowControlEndToEnd31) { scoped_ptr<SpdyFrame> echo( ConstructSpdyBodyFrame(1, msg_data.data(), msg_data_size, false)); scoped_ptr<SpdyFrame> window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, msg_data_size)); MockRead reads[] = { CreateMockRead(*resp, 2), @@ -2908,7 +2915,7 @@ void SpdySessionSpdy3Test::RunResumeAfterUnstallTest31( session_deps_.host_resolver->set_synchronous_mode(true); scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); scoped_ptr<SpdyFrame> req( @@ -3053,7 +3060,7 @@ TEST_F(SpdySessionSpdy3Test, ResumeByPriorityAfterSendWindowSizeIncrease31) { session_deps_.host_resolver->set_synchronous_mode(true); scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); scoped_ptr<SpdyFrame> req1( @@ -3220,7 +3227,7 @@ TEST_F(SpdySessionSpdy3Test, SendWindowSizeIncreaseWithDeletedStreams31) { session_deps_.host_resolver->set_synchronous_mode(true); scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); scoped_ptr<SpdyFrame> req1( @@ -3429,7 +3436,7 @@ TEST_F(SpdySessionSpdy3Test, SendWindowSizeIncreaseWithDeletedSession31) { session_deps_.host_resolver->set_synchronous_mode(true); scoped_ptr<SpdyFrame> initial_window_update( - ConstructSpdyWindowUpdate( + spdy_util_.ConstructSpdyWindowUpdate( kSessionFlowControlStreamId, kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); scoped_ptr<SpdyFrame> req1( @@ -3667,7 +3674,8 @@ TEST_F(SpdySessionSpdy3Test, CloseOneIdleConnectionFailsWhenSessionInUse) { MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. }; scoped_ptr<SpdyFrame> req1(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); - scoped_ptr<SpdyFrame> cancel1(ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); + scoped_ptr<SpdyFrame> cancel1( + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); MockWrite writes[] = { CreateMockWrite(*req1, 1), CreateMockWrite(*cancel1, 1), diff --git a/net/spdy/spdy_stream_spdy3_unittest.cc b/net/spdy/spdy_stream_spdy3_unittest.cc index 10c4a92..94c2356 100644 --- a/net/spdy/spdy_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_stream_spdy3_unittest.cc @@ -368,7 +368,7 @@ TEST_F(SpdyStreamSpdy3Test, IncreaseSendWindowSizeOverflow) { // Triggered by the overflowing call to IncreaseSendWindowSize // below. scoped_ptr<SpdyFrame> rst( - ConstructSpdyRstStream(1, RST_STREAM_FLOW_CONTROL_ERROR)); + spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_FLOW_CONTROL_ERROR)); MockWrite writes[] = { CreateMockWrite(*req, 0), CreateMockWrite(*rst, 1), diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc index d422021..51fb839 100644 --- a/net/spdy/spdy_test_util_common.cc +++ b/net/spdy/spdy_test_util_common.cc @@ -7,6 +7,7 @@ #include <cstddef> #include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" #include "base/string_number_conversions.h" #include "net/cert/mock_cert_verifier.h" #include "net/http/http_cache.h" @@ -15,6 +16,7 @@ #include "net/http/http_server_properties_impl.h" #include "net/socket/socket_test_util.h" #include "net/spdy/buffered_spdy_framer.h" +#include "net/spdy/spdy_framer.h" #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_session.h" #include "net/spdy/spdy_stream.h" @@ -665,4 +667,42 @@ SpdyFrame* SpdyTestUtil::ConstructSpdyControlFrame( return ConstructSpdyFrame(header_info, headers.Pass()); } +SpdyFrame* SpdyTestUtil::ConstructSpdySettings( + const SettingsMap& settings) const { + return CreateFramer()->CreateSettings(settings); +} + +SpdyFrame* SpdyTestUtil::ConstructSpdyCredential( + const SpdyCredential& credential) const { + return CreateFramer()->CreateCredentialFrame(credential); +} + +SpdyFrame* SpdyTestUtil::ConstructSpdyPing(uint32 ping_id) const { + return CreateFramer()->CreatePingFrame(ping_id); +} + +SpdyFrame* SpdyTestUtil::ConstructSpdyGoAway() const { + return ConstructSpdyGoAway(0); +} + +SpdyFrame* SpdyTestUtil::ConstructSpdyGoAway( + SpdyStreamId last_good_stream_id) const { + return CreateFramer()->CreateGoAway(last_good_stream_id, GOAWAY_OK); +} + +SpdyFrame* SpdyTestUtil::ConstructSpdyWindowUpdate( + const SpdyStreamId stream_id, uint32 delta_window_size) const { + return CreateFramer()->CreateWindowUpdate(stream_id, delta_window_size); +} + +SpdyFrame* SpdyTestUtil::ConstructSpdyRstStream( + SpdyStreamId stream_id, + SpdyRstStreamStatus status) const { + return CreateFramer()->CreateRstStream(stream_id, status); +} + +scoped_ptr<SpdyFramer> SpdyTestUtil::CreateFramer() const { + return scoped_ptr<SpdyFramer>(new SpdyFramer(spdy_version_)); +} + } // namespace net diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h index a6685de..22c3327 100644 --- a/net/spdy/spdy_test_util_common.h +++ b/net/spdy/spdy_test_util_common.h @@ -6,6 +6,7 @@ #define NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ #include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" #include "crypto/ec_private_key.h" #include "crypto/ec_signature_creator.h" #include "net/base/completion_callback.h" @@ -316,6 +317,43 @@ class SpdyTestUtil { int tail_headers_size, SpdyStreamId associated_stream_id) const; + // Construct an expected SPDY SETTINGS frame. + // |settings| are the settings to set. + // Returns the constructed frame. The caller takes ownership of the frame. + SpdyFrame* ConstructSpdySettings(const SettingsMap& settings) const; + + // Construct an expected SPDY CREDENTIAL frame. + // |credential| is the credential to send. + // Returns the constructed frame. The caller takes ownership of the frame. + SpdyFrame* ConstructSpdyCredential(const SpdyCredential& credential) const; + + // Construct a SPDY PING frame. + // Returns the constructed frame. The caller takes ownership of the frame. + SpdyFrame* ConstructSpdyPing(uint32 ping_id) const; + + // Construct a SPDY GOAWAY frame with last_good_stream_id = 0. + // Returns the constructed frame. The caller takes ownership of the frame. + SpdyFrame* ConstructSpdyGoAway() const; + + // Construct a SPDY GOAWAY frame with the specified last_good_stream_id. + // Returns the constructed frame. The caller takes ownership of the frame. + SpdyFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id) const; + + // Construct a SPDY WINDOW_UPDATE frame. + // Returns the constructed frame. The caller takes ownership of the frame. + SpdyFrame* ConstructSpdyWindowUpdate( + SpdyStreamId stream_id, + uint32 delta_window_size) const; + + // Construct a SPDY RST_STREAM frame. + // Returns the constructed frame. The caller takes ownership of the frame. + SpdyFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, + SpdyRstStreamStatus status) const; + + NextProto protocol() const { return protocol_; } + int spdy_version() const { return spdy_version_; } + scoped_ptr<SpdyFramer> CreateFramer() const; + private: const NextProto protocol_; const int spdy_version_; diff --git a/net/spdy/spdy_test_util_spdy2.cc b/net/spdy/spdy_test_util_spdy2.cc index c36af9a..962b9e9 100644 --- a/net/spdy/spdy_test_util_spdy2.cc +++ b/net/spdy/spdy_test_util_spdy2.cc @@ -68,43 +68,6 @@ SpdyFrame* ConstructSpdyControlFrame(const char* const extra_headers[], } // namespace -SpdyFrame* ConstructSpdySettings(const SettingsMap& settings) { - BufferedSpdyFramer framer(2, false); - return framer.CreateSettings(settings); -} - -SpdyFrame* ConstructSpdyCredential( - const SpdyCredential& credential) { - BufferedSpdyFramer framer(2, false); - return framer.CreateCredentialFrame(credential); -} - -SpdyFrame* ConstructSpdyPing(uint32 ping_id) { - BufferedSpdyFramer framer(2, false); - return framer.CreatePingFrame(ping_id); -} - -SpdyFrame* ConstructSpdyGoAway() { - return ConstructSpdyGoAway(0); -} - -SpdyFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id) { - BufferedSpdyFramer framer(2, false); - return framer.CreateGoAway(last_good_stream_id, GOAWAY_OK); -} - -SpdyFrame* ConstructSpdyWindowUpdate( - const SpdyStreamId stream_id, uint32 delta_window_size) { - BufferedSpdyFramer framer(2, false); - return framer.CreateWindowUpdate(stream_id, delta_window_size); -} - -SpdyFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) { - BufferedSpdyFramer framer(2, false); - return framer.CreateRstStream(stream_id, status); -} - int ConstructSpdyHeader(const char* const extra_headers[], int extra_header_count, char* buffer, @@ -440,7 +403,7 @@ SpdyFrame* ConstructSpdyPostSynReply(const char* const extra_headers[], } SpdyFrame* ConstructSpdyBodyFrame(int stream_id, bool fin) { - BufferedSpdyFramer framer(2, false); + SpdyFramer framer(2); return framer.CreateDataFrame( stream_id, kUploadData, kUploadDataSize, fin ? DATA_FLAG_FIN : DATA_FLAG_NONE); @@ -448,7 +411,7 @@ SpdyFrame* ConstructSpdyBodyFrame(int stream_id, bool fin) { SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, uint32 len, bool fin) { - BufferedSpdyFramer framer(2, false); + SpdyFramer framer(2); return framer.CreateDataFrame( stream_id, data, len, fin ? DATA_FLAG_FIN : DATA_FLAG_NONE); } diff --git a/net/spdy/spdy_test_util_spdy2.h b/net/spdy/spdy_test_util_spdy2.h index 7c68825..2b2a207 100644 --- a/net/spdy/spdy_test_util_spdy2.h +++ b/net/spdy/spdy_test_util_spdy2.h @@ -34,37 +34,6 @@ int ConstructSpdyReplyString(const char* const extra_headers[], char* buffer, int buffer_length); -// Construct an expected SPDY SETTINGS frame. -// |settings| are the settings to set. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdySettings(const SettingsMap& settings); - -// Construct an expected SPDY CREDENTIAL frame. -// |credential| is the credential to send. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyCredential(const SpdyCredential& credential); - -// Construct a SPDY PING frame. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyPing(uint32 ping_id); - -// Construct a SPDY GOAWAY frame with last_good_stream_id = 0. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyGoAway(); - -// Construct a SPDY GOAWAY frame with the specified last_good_stream_id. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id); - -// Construct a SPDY WINDOW_UPDATE frame. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyWindowUpdate(SpdyStreamId, uint32 delta_window_size); - -// Construct a SPDY RST_STREAM frame. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status); - // Construct a single SPDY header entry, for validation. // |extra_headers| are the extra header-value pairs. // |buffer| is the buffer we're filling in. diff --git a/net/spdy/spdy_test_util_spdy3.cc b/net/spdy/spdy_test_util_spdy3.cc index 547716a..d9fb9d9 100644 --- a/net/spdy/spdy_test_util_spdy3.cc +++ b/net/spdy/spdy_test_util_spdy3.cc @@ -118,43 +118,6 @@ SpdyFrame* ConstructSpdyControlFrame(const char* const extra_headers[], } // namespace -SpdyFrame* ConstructSpdySettings(const SettingsMap& settings) { - BufferedSpdyFramer framer(3, false); - return framer.CreateSettings(settings); -} - -SpdyFrame* ConstructSpdyCredential( - const SpdyCredential& credential) { - BufferedSpdyFramer framer(3, false); - return framer.CreateCredentialFrame(credential); -} - -SpdyFrame* ConstructSpdyPing(uint32 ping_id) { - BufferedSpdyFramer framer(3, false); - return framer.CreatePingFrame(ping_id); -} - -SpdyFrame* ConstructSpdyGoAway() { - return ConstructSpdyGoAway(0); -} - -SpdyFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id) { - BufferedSpdyFramer framer(3, false); - return framer.CreateGoAway(last_good_stream_id, GOAWAY_OK); -} - -SpdyFrame* ConstructSpdyWindowUpdate( - const SpdyStreamId stream_id, uint32 delta_window_size) { - BufferedSpdyFramer framer(3, false); - return framer.CreateWindowUpdate(stream_id, delta_window_size); -} - -SpdyFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) { - BufferedSpdyFramer framer(3, false); - return framer.CreateRstStream(stream_id, status); -} - int ConstructSpdyHeader(const char* const extra_headers[], int extra_header_count, char* buffer, diff --git a/net/spdy/spdy_test_util_spdy3.h b/net/spdy/spdy_test_util_spdy3.h index eabd26b..6b30541 100644 --- a/net/spdy/spdy_test_util_spdy3.h +++ b/net/spdy/spdy_test_util_spdy3.h @@ -38,37 +38,6 @@ int ConstructSpdyReplyString(const char* const extra_headers[], char* buffer, int buffer_length); -// Construct an expected SPDY SETTINGS frame. -// |settings| are the settings to set. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdySettings(const SettingsMap& settings); - -// Construct an expected SPDY CREDENTIAL frame. -// |credential| is the credential to send. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyCredential(const SpdyCredential& credential); - -// Construct a SPDY PING frame. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyPing(uint32 ping_id); - -// Construct a SPDY GOAWAY frame with last_good_stream_id = 0. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyGoAway(); - -// Construct a SPDY GOAWAY frame with the specified last_good_stream_id. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id); - -// Construct a SPDY WINDOW_UPDATE frame. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyWindowUpdate(SpdyStreamId, uint32 delta_window_size); - -// Construct a SPDY RST_STREAM frame. -// Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status); - // Construct a single SPDY header entry, for validation. // |extra_headers| are the extra header-value pairs. // |buffer| is the buffer we're filling in. diff --git a/net/spdy/spdy_websocket_stream_spdy2_unittest.cc b/net/spdy/spdy_websocket_stream_spdy2_unittest.cc index ad49e5b0..85b8286 100644 --- a/net/spdy/spdy_websocket_stream_spdy2_unittest.cc +++ b/net/spdy/spdy_websocket_stream_spdy2_unittest.cc @@ -188,7 +188,9 @@ class SpdyWebSocketStreamSpdy2Test : public testing::Test { } protected: - SpdyWebSocketStreamSpdy2Test() : session_deps_(kProtoSPDY2) {} + SpdyWebSocketStreamSpdy2Test() + : spdy_util_(kProtoSPDY2), + session_deps_(kProtoSPDY2) {} virtual ~SpdyWebSocketStreamSpdy2Test() {} virtual void SetUp() { @@ -281,6 +283,7 @@ class SpdyWebSocketStreamSpdy2Test : public testing::Test { websocket_stream_->SendRequest(headers.Pass()); } + SpdyTestUtil spdy_util_; SpdySettingsIds spdy_settings_id_to_set_; SpdySettingsFlags spdy_settings_flags_to_set_; uint32 spdy_settings_value_to_set_; @@ -519,7 +522,7 @@ TEST_F(SpdyWebSocketStreamSpdy2Test, DestructionAfterExplicitClose) { TEST_F(SpdyWebSocketStreamSpdy2Test, IOPending) { Prepare(1); scoped_ptr<SpdyFrame> settings_frame( - ConstructSpdySettings(spdy_settings_to_send_)); + spdy_util_.ConstructSpdySettings(spdy_settings_to_send_)); MockWrite writes[] = { // Setting throttling make SpdySession send settings frame automatically. CreateMockWrite(*settings_frame.get(), 1), diff --git a/net/spdy/spdy_websocket_stream_spdy3_unittest.cc b/net/spdy/spdy_websocket_stream_spdy3_unittest.cc index 4b8bc26..acb6956 100644 --- a/net/spdy/spdy_websocket_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_websocket_stream_spdy3_unittest.cc @@ -188,7 +188,9 @@ class SpdyWebSocketStreamSpdy3Test : public testing::Test { } protected: - SpdyWebSocketStreamSpdy3Test() : session_deps_(kProtoSPDY3) {} + SpdyWebSocketStreamSpdy3Test() + : spdy_util_(kProtoSPDY3), + session_deps_(kProtoSPDY3) {} virtual ~SpdyWebSocketStreamSpdy3Test() {} virtual void SetUp() { @@ -281,6 +283,7 @@ class SpdyWebSocketStreamSpdy3Test : public testing::Test { websocket_stream_->SendRequest(headers.Pass()); } + SpdyTestUtil spdy_util_; SpdySettingsIds spdy_settings_id_to_set_; SpdySettingsFlags spdy_settings_flags_to_set_; uint32 spdy_settings_value_to_set_; @@ -519,7 +522,7 @@ TEST_F(SpdyWebSocketStreamSpdy3Test, DestructionAfterExplicitClose) { TEST_F(SpdyWebSocketStreamSpdy3Test, IOPending) { Prepare(1); scoped_ptr<SpdyFrame> settings_frame( - ConstructSpdySettings(spdy_settings_to_send_)); + spdy_util_.ConstructSpdySettings(spdy_settings_to_send_)); MockWrite writes[] = { // Setting throttling make SpdySession send settings frame automatically. CreateMockWrite(*settings_frame.get(), 1), |