OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 #include "net/quic/core/quic_stream_sequencer_buffer.h" | 4 #include "net/quic/core/quic_stream_sequencer_buffer.h" |
5 | 5 |
6 #include <algorithm> | 6 #include <algorithm> |
7 #include <limits> | 7 #include <limits> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 EXPECT_EQ(max_capacity_bytes_ + 512, buffer_->BytesConsumed()); | 827 EXPECT_EQ(max_capacity_bytes_ + 512, buffer_->BytesConsumed()); |
828 EXPECT_TRUE(buffer_->Empty()); | 828 EXPECT_TRUE(buffer_->Empty()); |
829 EXPECT_TRUE(helper_->CheckBufferInvariants()); | 829 EXPECT_TRUE(helper_->CheckBufferInvariants()); |
830 // Clear buffer at this point should still preserve BytesConsumed(). | 830 // Clear buffer at this point should still preserve BytesConsumed(). |
831 buffer_->Clear(); | 831 buffer_->Clear(); |
832 EXPECT_EQ(max_capacity_bytes_ + 512, buffer_->BytesConsumed()); | 832 EXPECT_EQ(max_capacity_bytes_ + 512, buffer_->BytesConsumed()); |
833 EXPECT_TRUE(helper_->CheckBufferInvariants()); | 833 EXPECT_TRUE(helper_->CheckBufferInvariants()); |
834 } | 834 } |
835 | 835 |
836 TEST_F(QuicStreamSequencerBufferTest, TooManyGaps) { | 836 TEST_F(QuicStreamSequencerBufferTest, TooManyGaps) { |
| 837 QuicFlagSaver flags; |
837 FLAGS_quic_limit_frame_gaps_in_buffer = true; | 838 FLAGS_quic_limit_frame_gaps_in_buffer = true; |
838 // Make sure max capacity is large enough that it is possible to have more | 839 // Make sure max capacity is large enough that it is possible to have more |
839 // than |kMaxNumGapsAllowed| number of gaps. | 840 // than |kMaxNumGapsAllowed| number of gaps. |
840 max_capacity_bytes_ = 3 * kBlockSizeBytes; | 841 max_capacity_bytes_ = 3 * kBlockSizeBytes; |
841 // Feed buffer with 1-byte discontiguous frames. e.g. [1,2), [3,4), [5,6)... | 842 // Feed buffer with 1-byte discontiguous frames. e.g. [1,2), [3,4), [5,6)... |
842 for (QuicStreamOffset begin = 1; begin <= max_capacity_bytes_; begin += 2) { | 843 for (QuicStreamOffset begin = 1; begin <= max_capacity_bytes_; begin += 2) { |
843 size_t written; | 844 size_t written; |
844 QuicErrorCode rs = buffer_->OnStreamData( | 845 QuicErrorCode rs = buffer_->OnStreamData( |
845 begin, "a", clock_.ApproximateNow(), &written, &error_details_); | 846 begin, "a", clock_.ApproximateNow(), &written, &error_details_); |
846 | 847 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 EXPECT_LE(bytes_to_buffer_, total_bytes_read_) << "iterations: " | 1078 EXPECT_LE(bytes_to_buffer_, total_bytes_read_) << "iterations: " |
1078 << iterations; | 1079 << iterations; |
1079 EXPECT_LE(bytes_to_buffer_, total_bytes_written_); | 1080 EXPECT_LE(bytes_to_buffer_, total_bytes_written_); |
1080 } | 1081 } |
1081 | 1082 |
1082 } // anonymous namespace | 1083 } // anonymous namespace |
1083 | 1084 |
1084 } // namespace test | 1085 } // namespace test |
1085 | 1086 |
1086 } // namespace net | 1087 } // namespace net |
OLD | NEW |