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

Side by Side Diff: net/quic/reliable_quic_stream_test.cc

Issue 1904213002: QUIC: support diversified keys with version 33. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hkdf
Patch Set: Rebase Created 4 years, 7 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/quic_protocol.cc ('k') | net/quic/test_tools/crypto_test_utils.h » ('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) 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 <memory> 7 #include <memory>
8 8
9 #include "net/quic/quic_connection.h" 9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_flags.h" 10 #include "net/quic/quic_flags.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 QuicWriteBlockedList* write_blocked_list_; 158 QuicWriteBlockedList* write_blocked_list_;
159 uint32_t initial_flow_control_window_bytes_; 159 uint32_t initial_flow_control_window_bytes_;
160 QuicTime::Delta zero_; 160 QuicTime::Delta zero_;
161 QuicVersionVector supported_versions_; 161 QuicVersionVector supported_versions_;
162 const QuicStreamId kTestStreamId = 5u; 162 const QuicStreamId kTestStreamId = 5u;
163 }; 163 };
164 164
165 TEST_F(ReliableQuicStreamTest, WriteAllData) { 165 TEST_F(ReliableQuicStreamTest, WriteAllData) {
166 Initialize(kShouldProcessData); 166 Initialize(kShouldProcessData);
167 167
168 size_t length = 1 + QuicPacketCreator::StreamFramePacketOverhead( 168 size_t length =
169 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, 169 1 + QuicPacketCreator::StreamFramePacketOverhead(
170 !kIncludePathId, PACKET_6BYTE_PACKET_NUMBER, 0u); 170 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId,
171 !kIncludeDiversificationNonce, PACKET_6BYTE_PACKET_NUMBER, 0u);
171 connection_->SetMaxPacketLength(length); 172 connection_->SetMaxPacketLength(length);
172 173
173 EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _)) 174 EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _))
174 .WillOnce(Return(QuicConsumedData(kDataLen, true))); 175 .WillOnce(Return(QuicConsumedData(kDataLen, true)));
175 stream_->WriteOrBufferData(kData1, false, nullptr); 176 stream_->WriteOrBufferData(kData1, false, nullptr);
176 EXPECT_FALSE(HasWriteBlockedStreams()); 177 EXPECT_FALSE(HasWriteBlockedStreams());
177 } 178 }
178 179
179 TEST_F(ReliableQuicStreamTest, NoBlockingIfNoDataOrFin) { 180 TEST_F(ReliableQuicStreamTest, NoBlockingIfNoDataOrFin) {
180 Initialize(kShouldProcessData); 181 Initialize(kShouldProcessData);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _)) 231 EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _))
231 .WillOnce(Invoke(this, &ReliableQuicStreamTest::CloseStreamOnWriteError)); 232 .WillOnce(Invoke(this, &ReliableQuicStreamTest::CloseStreamOnWriteError));
232 stream_->WriteOrBufferData(StringPiece(kData1, 2), false, nullptr); 233 stream_->WriteOrBufferData(StringPiece(kData1, 2), false, nullptr);
233 ASSERT_EQ(0u, write_blocked_list_->NumBlockedStreams()); 234 ASSERT_EQ(0u, write_blocked_list_->NumBlockedStreams());
234 } 235 }
235 236
236 TEST_F(ReliableQuicStreamTest, WriteOrBufferData) { 237 TEST_F(ReliableQuicStreamTest, WriteOrBufferData) {
237 Initialize(kShouldProcessData); 238 Initialize(kShouldProcessData);
238 239
239 EXPECT_FALSE(HasWriteBlockedStreams()); 240 EXPECT_FALSE(HasWriteBlockedStreams());
240 size_t length = 1 + QuicPacketCreator::StreamFramePacketOverhead( 241 size_t length =
241 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, 242 1 + QuicPacketCreator::StreamFramePacketOverhead(
242 !kIncludePathId, PACKET_6BYTE_PACKET_NUMBER, 0u); 243 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId,
244 !kIncludeDiversificationNonce, PACKET_6BYTE_PACKET_NUMBER, 0u);
243 connection_->SetMaxPacketLength(length); 245 connection_->SetMaxPacketLength(length);
244 246
245 EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) 247 EXPECT_CALL(*session_, WritevData(_, _, _, _, _))
246 .WillOnce(Return(QuicConsumedData(kDataLen - 1, false))); 248 .WillOnce(Return(QuicConsumedData(kDataLen - 1, false)));
247 stream_->WriteOrBufferData(kData1, false, nullptr); 249 stream_->WriteOrBufferData(kData1, false, nullptr);
248 EXPECT_TRUE(HasWriteBlockedStreams()); 250 EXPECT_TRUE(HasWriteBlockedStreams());
249 251
250 // Queue a bytes_consumed write. 252 // Queue a bytes_consumed write.
251 stream_->WriteOrBufferData(kData2, false, nullptr); 253 stream_->WriteOrBufferData(kData2, false, nullptr);
252 254
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 // Receive remaining data and FIN for the request. 662 // Receive remaining data and FIN for the request.
661 QuicStreamFrame frame2(stream_->id(), true, 0, StringPiece("End")); 663 QuicStreamFrame frame2(stream_->id(), true, 0, StringPiece("End"));
662 stream_->OnStreamFrame(frame2); 664 stream_->OnStreamFrame(frame2);
663 EXPECT_TRUE(stream_->fin_received()); 665 EXPECT_TRUE(stream_->fin_received());
664 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); 666 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset());
665 } 667 }
666 668
667 } // namespace 669 } // namespace
668 } // namespace test 670 } // namespace test
669 } // namespace net 671 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/test_tools/crypto_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698