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

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

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: correct quic_client_bin.cc Created 3 years, 12 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
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 TEST_F(QuicStreamSequencerBufferTest, OnStreamDataInvalidSource) { 138 TEST_F(QuicStreamSequencerBufferTest, OnStreamDataInvalidSource) {
139 // Pass in an invalid source, expects to return error. 139 // Pass in an invalid source, expects to return error.
140 StringPiece source; 140 StringPiece source;
141 source = StringPiece(nullptr, 1024); 141 source = StringPiece(nullptr, 1024);
142 size_t written; 142 size_t written;
143 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1)); 143 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
144 QuicTime t = clock_.ApproximateNow(); 144 QuicTime t = clock_.ApproximateNow();
145 EXPECT_EQ(QUIC_STREAM_SEQUENCER_INVALID_STATE, 145 EXPECT_EQ(QUIC_STREAM_SEQUENCER_INVALID_STATE,
146 buffer_->OnStreamData(800, source, t, &written, &error_details_)); 146 buffer_->OnStreamData(800, source, t, &written, &error_details_));
147 EXPECT_EQ( 147 EXPECT_EQ(0u, error_details_.find(QuicStrCat(
148 0u, error_details_.find("QuicStreamSequencerBuffer error: OnStreamData()" 148 "QuicStreamSequencerBuffer error: OnStreamData() "
149 " dest == nullptr: false" 149 "dest == nullptr: ",
150 " source == nullptr: true")); 150 false, " source == nullptr: ", true)));
151 } 151 }
152 152
153 TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithOverlap) { 153 TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithOverlap) {
154 string source(1024, 'a'); 154 string source(1024, 'a');
155 // Write something into [800, 1824) 155 // Write something into [800, 1824)
156 size_t written; 156 size_t written;
157 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1)); 157 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
158 QuicTime t1 = clock_.ApproximateNow(); 158 QuicTime t1 = clock_.ApproximateNow();
159 EXPECT_EQ(QUIC_NO_ERROR, 159 EXPECT_EQ(QUIC_NO_ERROR,
160 buffer_->OnStreamData(800, source, t1, &written, &error_details_)); 160 buffer_->OnStreamData(800, source, t1, &written, &error_details_));
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 EXPECT_LE(bytes_to_buffer_, total_bytes_read_) << "iterations: " 1033 EXPECT_LE(bytes_to_buffer_, total_bytes_read_) << "iterations: "
1034 << iterations; 1034 << iterations;
1035 EXPECT_LE(bytes_to_buffer_, total_bytes_written_); 1035 EXPECT_LE(bytes_to_buffer_, total_bytes_written_);
1036 } 1036 }
1037 1037
1038 } // anonymous namespace 1038 } // anonymous namespace
1039 1039
1040 } // namespace test 1040 } // namespace test
1041 1041
1042 } // namespace net 1042 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698