Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Unified Diff: net/quic/reliable_quic_stream_test.cc

Issue 1458003004: Fix bug in ReliableQuicStream::WritevData() where if the write failed and the connection was closed… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@107427162
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/reliable_quic_stream_test.cc
diff --git a/net/quic/reliable_quic_stream_test.cc b/net/quic/reliable_quic_stream_test.cc
index 46a3fff525ccabc56c2f1ecb0457ceac6aed028a..515c5cf646dd4fe74c713b1ba9f4e6d48a43c612 100644
--- a/net/quic/reliable_quic_stream_test.cc
+++ b/net/quic/reliable_quic_stream_test.cc
@@ -27,6 +27,7 @@ using testing::AtLeast;
using testing::CreateFunctor;
using testing::InSequence;
using testing::Invoke;
+using testing::DoAll;
using testing::Return;
using testing::StrictMock;
using testing::WithArgs;
@@ -140,6 +141,18 @@ class ReliableQuicStreamTest : public ::testing::TestWithParam<bool> {
write_blocked_list_->HasWriteBlockedDataStreams();
}
+ QuicConsumedData CloseStreamOnWriteError(
+ QuicStreamId id,
+ QuicIOVector /*iov*/,
+ QuicStreamOffset /*offset*/,
+ bool /*fin*/,
+ FecProtection /*fec_protection*/,
+ QuicAckListenerInterface* /*ack_notifier_delegate*/) {
+ session_->CloseStream(id);
+ return QuicConsumedData(1, false);
+
+ }
+
protected:
MockConnectionHelper helper_;
MockConnection* connection_;
@@ -211,6 +224,18 @@ TEST_F(ReliableQuicStreamTest, BlockIfSoloFinNotConsumed) {
ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
}
+TEST_F(ReliableQuicStreamTest, CloseOnPartialWrite) {
+ Initialize(kShouldProcessData);
+
+ // Write some data and no fin. However, while writing the data
+ // close the stream and verify that MarkConnectionLevelWriteBlocked does not
+ // crash with an unknown stream.
+ EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
+ .WillOnce(Invoke(this, &ReliableQuicStreamTest::CloseStreamOnWriteError));
+ stream_->WriteOrBufferData(StringPiece(kData1, 2), false, nullptr);
+ ASSERT_EQ(0u, write_blocked_list_->NumBlockedStreams());
+}
+
TEST_F(ReliableQuicStreamTest, WriteOrBufferData) {
Initialize(kShouldProcessData);
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698