| 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_utils.h" | 9 #include "net/quic/quic_utils.h" |
| 10 #include "net/quic/quic_write_blocked_list.h" | 10 #include "net/quic/quic_write_blocked_list.h" |
| 11 #include "net/quic/spdy_utils.h" | 11 #include "net/quic/spdy_utils.h" |
| 12 #include "net/quic/test_tools/quic_session_peer.h" | 12 #include "net/quic/test_tools/quic_session_peer.h" |
| 13 #include "net/quic/test_tools/quic_test_utils.h" | 13 #include "net/quic/test_tools/quic_test_utils.h" |
| 14 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 14 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
| 15 #include "net/test/gtest_util.h" | 15 #include "net/test/gtest_util.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 | 17 |
| 18 using base::StringPiece; | 18 using base::StringPiece; |
| 19 using std::min; | 19 using std::min; |
| 20 using testing::_; | 20 using testing::_; |
| 21 using testing::InSequence; | 21 using testing::InSequence; |
| 22 using testing::Return; | 22 using testing::Return; |
| 23 using testing::SaveArg; | 23 using testing::SaveArg; |
| 24 using testing::StrEq; | |
| 25 using testing::StrictMock; | 24 using testing::StrictMock; |
| 26 | 25 |
| 27 namespace net { | 26 namespace net { |
| 28 namespace test { | 27 namespace test { |
| 29 namespace { | 28 namespace { |
| 30 | 29 |
| 31 const char kData1[] = "FooAndBar"; | 30 const char kData1[] = "FooAndBar"; |
| 32 const char kData2[] = "EepAndBaz"; | 31 const char kData2[] = "EepAndBaz"; |
| 33 const size_t kDataLen = 9; | 32 const size_t kDataLen = 9; |
| 34 const QuicConnectionId kStreamId = 3; | 33 const QuicConnectionId kStreamId = 3; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 52 | 51 |
| 53 virtual QuicPriority EffectivePriority() const OVERRIDE { | 52 virtual QuicPriority EffectivePriority() const OVERRIDE { |
| 54 return QuicUtils::HighestPriority(); | 53 return QuicUtils::HighestPriority(); |
| 55 } | 54 } |
| 56 | 55 |
| 57 using ReliableQuicStream::WriteOrBufferData; | 56 using ReliableQuicStream::WriteOrBufferData; |
| 58 using ReliableQuicStream::CloseReadSide; | 57 using ReliableQuicStream::CloseReadSide; |
| 59 using ReliableQuicStream::CloseWriteSide; | 58 using ReliableQuicStream::CloseWriteSide; |
| 60 using ReliableQuicStream::OnClose; | 59 using ReliableQuicStream::OnClose; |
| 61 | 60 |
| 62 const string& data() const { return data_; } | |
| 63 | |
| 64 private: | 61 private: |
| 65 bool should_process_data_; | 62 bool should_process_data_; |
| 66 string data_; | 63 string data_; |
| 67 }; | 64 }; |
| 68 | 65 |
| 69 class ReliableQuicStreamTest : public ::testing::TestWithParam<bool> { | 66 class ReliableQuicStreamTest : public ::testing::TestWithParam<bool> { |
| 70 public: | 67 public: |
| 71 ReliableQuicStreamTest() { | 68 ReliableQuicStreamTest() { |
| 72 headers_[":host"] = "www.google.com"; | 69 headers_[":host"] = "www.google.com"; |
| 73 headers_[":path"] = "/index.hml"; | 70 headers_[":path"] = "/index.hml"; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // Now close the stream (any further resets being sent would break the | 283 // Now close the stream (any further resets being sent would break the |
| 287 // expectation above). | 284 // expectation above). |
| 288 stream_->OnClose(); | 285 stream_->OnClose(); |
| 289 EXPECT_FALSE(fin_sent()); | 286 EXPECT_FALSE(fin_sent()); |
| 290 EXPECT_TRUE(rst_sent()); | 287 EXPECT_TRUE(rst_sent()); |
| 291 } | 288 } |
| 292 | 289 |
| 293 } // namespace | 290 } // namespace |
| 294 } // namespace test | 291 } // namespace test |
| 295 } // namespace net | 292 } // namespace net |
| OLD | NEW |