diff options
-rw-r--r-- | net/data/valgrind/net_unittests.gtest-tsan_win32.txt | 3 | ||||
-rw-r--r-- | net/spdy/spdy_http_stream_unittest.cc | 15 | ||||
-rw-r--r-- | net/spdy/spdy_network_transaction_unittest.cc | 46 | ||||
-rw-r--r-- | net/spdy/spdy_session.cc | 12 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.h | 3 | ||||
-rw-r--r-- | net/spdy/spdy_stream.cc | 9 |
6 files changed, 18 insertions, 70 deletions
diff --git a/net/data/valgrind/net_unittests.gtest-tsan_win32.txt b/net/data/valgrind/net_unittests.gtest-tsan_win32.txt index 52de2b7..dac83b1 100644 --- a/net/data/valgrind/net_unittests.gtest-tsan_win32.txt +++ b/net/data/valgrind/net_unittests.gtest-tsan_win32.txt @@ -15,6 +15,9 @@ DiskCacheBackendTest.* # See http://crbug.com/47836 ClientSocketPoolBaseTest.CancelPendingSocketAtSocketLimit +# See http://crbug.com/50198 +SpdyHttpStreamTest.SendRequest + ######################################### # These tests fail if you don't have our SSL certificate installed. # Please see http://dev.chromium.org/developers/testing#TOC-SSL-tests diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc index 83f5185..9c23b54 100644 --- a/net/spdy/spdy_http_stream_unittest.cc +++ b/net/spdy/spdy_http_stream_unittest.cc @@ -10,8 +10,6 @@ namespace net { class SpdyHttpStreamTest : public testing::Test { - public: - OrderedSocketData* data() { return data_; } protected: SpdyHttpStreamTest() {} @@ -74,9 +72,7 @@ TEST_F(SpdyHttpStreamTest, SendRequest) { http_stream->SendRequest(&response, &callback)); MessageLoop::current()->RunAllPending(); EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(host_port_pair)); - http_session_->spdy_session_pool()->CloseAllSessions(); - EXPECT_TRUE(!data()->at_read_eof()); - EXPECT_TRUE(data()->at_write_eof()); + http_session_->spdy_session_pool()->Remove(session_); } // Test case for bug: http://code.google.com/p/chromium/issues/detail?id=50058 @@ -84,12 +80,16 @@ TEST_F(SpdyHttpStreamTest, SpdyURLTest) { EnableCompression(false); SpdySession::SetSSLMode(false); + scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); + MockWrite writes[] = { + CreateMockWrite(*req.get(), 1), + }; MockRead reads[] = { MockRead(false, 0, 2), // EOF }; HostPortPair host_port_pair("www.google.com", 80); - EXPECT_EQ(OK, InitSession(reads, arraysize(reads), NULL, 0, + EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes), host_port_pair)); HttpRequestInfo request; @@ -113,8 +113,7 @@ TEST_F(SpdyHttpStreamTest, SpdyURLTest) { MessageLoop::current()->RunAllPending(); EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(host_port_pair)); - http_session_->spdy_session_pool()->CloseAllSessions(); - EXPECT_TRUE(!data()->at_read_eof()); + http_session_->spdy_session_pool()->Remove(session_); } // TODO(willchan): Write a longer test for SpdyStream that exercises all diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index 3ac38cb..bce3feb 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -1128,46 +1128,6 @@ TEST_P(SpdyNetworkTransactionTest, CancelledTransaction) { helper.VerifyDataNotConsumed(); } -// Verify that the client sends a Rst Frame upon cancelling the stream. -TEST_P(SpdyNetworkTransactionTest, CancelledTransactionSendRst) { - scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); - scoped_ptr<spdy::SpdyFrame> rst( - ConstructSpdyRstStream(1, spdy::CANCEL)); - MockWrite writes[] = { - CreateMockWrite(*req, 1), - CreateMockWrite(*rst, 3), - }; - - scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); - MockRead reads[] = { - CreateMockRead(*resp, 2), - MockRead(true, 0, 0, 4) // EOF - }; - - scoped_refptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - - NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), - GetParam()); - helper.AddData(data.get()); - helper.RunPreTestSetup(); - HttpNetworkTransaction* trans = helper.trans(); - - TestCompletionCallback callback; - - int rv = trans->Start(&CreateGetRequest(), &callback, BoundNetLog()); - EXPECT_EQ(ERR_IO_PENDING, rv); - rv = callback.WaitForResult(); - helper.ResetTrans(); // Cancel the transaction. - - // Finish running rest of tasks. - MessageLoop::current()->RunAllPending(); - data->CompleteRead(); - helper.VerifyDataConsumed(); -} - class SpdyNetworkTransactionTest::StartTransactionCallback : public CallbackRunner< Tuple1<int> > { public: @@ -1736,11 +1696,8 @@ TEST_P(SpdyNetworkTransactionTest, DecompressFailureOnSynReply) { scoped_ptr<spdy::SpdyFrame> compressed( ConstructSpdyGet(NULL, 0, true, 1, LOWEST)); - scoped_ptr<spdy::SpdyFrame> rst( - ConstructSpdyRstStream(1, spdy::PROTOCOL_ERROR)); MockWrite writes[] = { CreateMockWrite(*compressed), - CreateMockWrite(*rst), }; scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); @@ -1748,6 +1705,7 @@ TEST_P(SpdyNetworkTransactionTest, DecompressFailureOnSynReply) { MockRead reads[] = { CreateMockRead(*resp), CreateMockRead(*body), + MockRead(true, 0, 0) // EOF }; scoped_refptr<DelayedSocketData> data( @@ -1757,7 +1715,7 @@ TEST_P(SpdyNetworkTransactionTest, DecompressFailureOnSynReply) { BoundNetLog(), GetParam()); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); - EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); + EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv); data->Reset(); EnableCompression(false); diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 093ea93..26b6a10 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -1122,16 +1122,8 @@ void SpdySession::OnControl(const spdy::SpdyControlFrame* frame) { uint32 type = frame->type(); if (type == spdy::SYN_STREAM || type == spdy::SYN_REPLY) { if (!spdy_framer_.ParseHeaderBlock(frame, headers.get())) { - LOG(WARNING) << "Could not parse Spdy Control Frame Header."; - int stream_id = 0; - if (type == spdy::SYN_STREAM) - stream_id = (reinterpret_cast<const spdy::SpdySynStreamControlFrame*> - (frame))->stream_id(); - if (type == spdy::SYN_REPLY) - stream_id = (reinterpret_cast<const spdy::SpdySynReplyControlFrame*> - (frame))->stream_id(); - if(IsStreamActive(stream_id)) - ResetStream(stream_id, spdy::PROTOCOL_ERROR); + LOG(WARNING) << "Could not parse Spdy Control Frame Header"; + // TODO(mbelshe): Error the session? return; } } diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index fbba64b..0819b71 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h @@ -70,8 +70,7 @@ class SpdySessionPool // Close all Spdy Sessions; used for debugging. void CloseAllSessions(); - // Removes a SpdySession from the SpdySessionPool. This should only be called - // by SpdySession, because otherwise session->state_ is not set to CLOSED. + // Removes a SpdySession from the SpdySessionPool. void Remove(const scoped_refptr<SpdySession>& session); // NetworkChangeNotifier::Observer methods: diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc index dfaf4e2..1de67f2 100644 --- a/net/spdy/spdy_stream.cc +++ b/net/spdy/spdy_stream.cc @@ -58,7 +58,8 @@ void SpdyStream::SetDelegate(Delegate* delegate) { void SpdyStream::DetachDelegate() { delegate_ = NULL; - Cancel(); + if (!cancelled()) + Cancel(); } const linked_ptr<spdy::SpdyHeaderBlock>& SpdyStream::spdy_headers() const { @@ -221,12 +222,8 @@ void SpdyStream::OnClose(int status) { } void SpdyStream::Cancel() { - if (cancelled()) - return; - cancelled_ = true; - if(session_->IsStreamActive(stream_id_)) - session_->ResetStream(stream_id_, spdy::CANCEL); + session_->CloseStream(stream_id_, ERR_ABORTED); } int SpdyStream::DoSendRequest(bool has_upload_data) { |