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