| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/reliable_quic_stream.h" | 5 #include "net/quic/reliable_quic_stream.h" |
| 6 | 6 |
| 7 #include "net/quic/quic_ack_notifier.h" | 7 #include "net/quic/quic_ack_notifier.h" |
| 8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
| 9 #include "net/quic/quic_spdy_compressor.h" | |
| 10 #include "net/quic/quic_spdy_decompressor.h" | |
| 11 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
| 12 #include "net/quic/quic_write_blocked_list.h" | 10 #include "net/quic/quic_write_blocked_list.h" |
| 13 #include "net/quic/spdy_utils.h" | 11 #include "net/quic/spdy_utils.h" |
| 14 #include "net/quic/test_tools/quic_session_peer.h" | 12 #include "net/quic/test_tools/quic_session_peer.h" |
| 15 #include "net/quic/test_tools/quic_test_utils.h" | 13 #include "net/quic/test_tools/quic_test_utils.h" |
| 16 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 14 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
| 17 #include "net/test/gtest_util.h" | 15 #include "net/test/gtest_util.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 19 | 17 |
| 20 using base::StringPiece; | 18 using base::StringPiece; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; | 98 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; |
| 101 } | 99 } |
| 102 | 100 |
| 103 void Initialize(bool stream_should_process_data) { | 101 void Initialize(bool stream_should_process_data) { |
| 104 connection_ = new StrictMock<MockConnection>(kIsServer); | 102 connection_ = new StrictMock<MockConnection>(kIsServer); |
| 105 session_.reset(new StrictMock<MockSession>(connection_)); | 103 session_.reset(new StrictMock<MockSession>(connection_)); |
| 106 stream_.reset(new TestStream(kStreamId, session_.get(), | 104 stream_.reset(new TestStream(kStreamId, session_.get(), |
| 107 stream_should_process_data)); | 105 stream_should_process_data)); |
| 108 stream2_.reset(new TestStream(kStreamId + 2, session_.get(), | 106 stream2_.reset(new TestStream(kStreamId + 2, session_.get(), |
| 109 stream_should_process_data)); | 107 stream_should_process_data)); |
| 110 compressor_.reset(new QuicSpdyCompressor()); | |
| 111 decompressor_.reset(new QuicSpdyDecompressor); | |
| 112 write_blocked_list_ = | 108 write_blocked_list_ = |
| 113 QuicSessionPeer::GetWriteblockedStreams(session_.get()); | 109 QuicSessionPeer::GetWriteblockedStreams(session_.get()); |
| 114 } | 110 } |
| 115 | 111 |
| 116 bool fin_sent() { return ReliableQuicStreamPeer::FinSent(stream_.get()); } | 112 bool fin_sent() { return ReliableQuicStreamPeer::FinSent(stream_.get()); } |
| 117 bool rst_sent() { return ReliableQuicStreamPeer::RstSent(stream_.get()); } | 113 bool rst_sent() { return ReliableQuicStreamPeer::RstSent(stream_.get()); } |
| 118 | 114 |
| 119 protected: | 115 protected: |
| 120 MockConnection* connection_; | 116 MockConnection* connection_; |
| 121 scoped_ptr<MockSession> session_; | 117 scoped_ptr<MockSession> session_; |
| 122 scoped_ptr<TestStream> stream_; | 118 scoped_ptr<TestStream> stream_; |
| 123 scoped_ptr<TestStream> stream2_; | 119 scoped_ptr<TestStream> stream2_; |
| 124 scoped_ptr<QuicSpdyCompressor> compressor_; | |
| 125 scoped_ptr<QuicSpdyDecompressor> decompressor_; | |
| 126 SpdyHeaderBlock headers_; | 120 SpdyHeaderBlock headers_; |
| 127 QuicWriteBlockedList* write_blocked_list_; | 121 QuicWriteBlockedList* write_blocked_list_; |
| 128 }; | 122 }; |
| 129 | 123 |
| 130 TEST_F(ReliableQuicStreamTest, WriteAllData) { | 124 TEST_F(ReliableQuicStreamTest, WriteAllData) { |
| 131 Initialize(kShouldProcessData); | 125 Initialize(kShouldProcessData); |
| 132 | 126 |
| 133 connection_->options()->max_packet_length = | 127 connection_->options()->max_packet_length = |
| 134 1 + QuicPacketCreator::StreamFramePacketOverhead( | 128 1 + QuicPacketCreator::StreamFramePacketOverhead( |
| 135 connection_->version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, | 129 connection_->version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // Now close the stream (any further resets being sent would break the | 286 // Now close the stream (any further resets being sent would break the |
| 293 // expectation above). | 287 // expectation above). |
| 294 stream_->OnClose(); | 288 stream_->OnClose(); |
| 295 EXPECT_FALSE(fin_sent()); | 289 EXPECT_FALSE(fin_sent()); |
| 296 EXPECT_TRUE(rst_sent()); | 290 EXPECT_TRUE(rst_sent()); |
| 297 } | 291 } |
| 298 | 292 |
| 299 } // namespace | 293 } // namespace |
| 300 } // namespace test | 294 } // namespace test |
| 301 } // namespace net | 295 } // namespace net |
| OLD | NEW |