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

Side by Side Diff: net/quic/core/quic_stream_sequencer_buffer_test.cc

Issue 2331343003: Deprecate flag FLAGS_quic_sequencer_buffer_retire_block_in_time. (Closed)
Patch Set: Created 4 years, 3 months 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_stream_sequencer_buffer.cc ('k') | net/tools/quic/quic_server_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 EXPECT_TRUE(buffer_->HasBytesToRead()); 409 EXPECT_TRUE(buffer_->HasBytesToRead());
410 EXPECT_EQ(2u, helper_->frame_arrival_time_map()->size()); 410 EXPECT_EQ(2u, helper_->frame_arrival_time_map()->size());
411 // Read into a iovec array with total capacity of 120 bytes. 411 // Read into a iovec array with total capacity of 120 bytes.
412 char dest[120]; 412 char dest[120];
413 iovec iovecs[3]{iovec{dest, 40}, iovec{dest + 40, 40}, iovec{dest + 80, 40}}; 413 iovec iovecs[3]{iovec{dest, 40}, iovec{dest + 40, 40}, iovec{dest + 80, 40}};
414 size_t read = buffer_->Readv(iovecs, 3); 414 size_t read = buffer_->Readv(iovecs, 3);
415 EXPECT_EQ(100u, read); 415 EXPECT_EQ(100u, read);
416 EXPECT_EQ(100u, buffer_->BytesConsumed()); 416 EXPECT_EQ(100u, buffer_->BytesConsumed());
417 EXPECT_EQ(source, string(dest, read)); 417 EXPECT_EQ(source, string(dest, read));
418 EXPECT_EQ(1u, helper_->frame_arrival_time_map()->size()); 418 EXPECT_EQ(1u, helper_->frame_arrival_time_map()->size());
419 if (FLAGS_quic_sequencer_buffer_retire_block_in_time) { 419 // The first block should be released as its data has been read out.
420 // The first block should be released as its data has been read out. 420 EXPECT_EQ(nullptr, helper_->GetBlock(0));
421 EXPECT_EQ(nullptr, helper_->GetBlock(0));
422 }
423 EXPECT_TRUE(helper_->CheckBufferInvariants()); 421 EXPECT_TRUE(helper_->CheckBufferInvariants());
424 } 422 }
425 423
426 TEST_F(QuicStreamSequencerBufferTest, ReadvAcrossBlocks) { 424 TEST_F(QuicStreamSequencerBufferTest, ReadvAcrossBlocks) {
427 string source(kBlockSizeBytes + 50, 'a'); 425 string source(kBlockSizeBytes + 50, 'a');
428 // Write 1st block to full and extand 50 bytes to next block. 426 // Write 1st block to full and extand 50 bytes to next block.
429 size_t written; 427 size_t written;
430 buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written, 428 buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
431 &error_details_); 429 &error_details_);
432 EXPECT_EQ(source.size(), helper_->ReadableBytes()); 430 EXPECT_EQ(source.size(), helper_->ReadableBytes());
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 EXPECT_LE(bytes_to_buffer_, total_bytes_read_) << "iterations: " 1112 EXPECT_LE(bytes_to_buffer_, total_bytes_read_) << "iterations: "
1115 << iterations; 1113 << iterations;
1116 EXPECT_LE(bytes_to_buffer_, total_bytes_written_); 1114 EXPECT_LE(bytes_to_buffer_, total_bytes_written_);
1117 } 1115 }
1118 1116
1119 } // anonymous namespace 1117 } // anonymous namespace
1120 1118
1121 } // namespace test 1119 } // namespace test
1122 1120
1123 } // namespace net 1121 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_stream_sequencer_buffer.cc ('k') | net/tools/quic/quic_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698