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

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

Issue 2326723004: Move encrypted_buffer into QuicPacketCreator::CreateAndSerializeStreamFrame. No functional change. … (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_packet_creator.cc ('k') | net/quic/core/quic_packet_generator.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) 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/core/quic_packet_creator.h" 5 #include "net/quic/core/quic_packet_creator.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 1025
1026 TEST_P(QuicPacketCreatorTest, SerializeAndSendStreamFrame) { 1026 TEST_P(QuicPacketCreatorTest, SerializeAndSendStreamFrame) {
1027 if (!GetParam().version_serialization) { 1027 if (!GetParam().version_serialization) {
1028 creator_.StopSendingVersion(); 1028 creator_.StopSendingVersion();
1029 } 1029 }
1030 EXPECT_FALSE(creator_.HasPendingFrames()); 1030 EXPECT_FALSE(creator_.HasPendingFrames());
1031 1031
1032 QuicIOVector iov(MakeIOVector("test")); 1032 QuicIOVector iov(MakeIOVector("test"));
1033 EXPECT_CALL(delegate_, OnSerializedPacket(_)) 1033 EXPECT_CALL(delegate_, OnSerializedPacket(_))
1034 .WillOnce(Invoke(this, &QuicPacketCreatorTest::SaveSerializedPacket)); 1034 .WillOnce(Invoke(this, &QuicPacketCreatorTest::SaveSerializedPacket));
1035 ALIGNAS(64) char encrypted_buffer[kMaxPacketSize];
1036 size_t num_bytes_consumed; 1035 size_t num_bytes_consumed;
1037 creator_.CreateAndSerializeStreamFrame(kHeadersStreamId, iov, 0, 0, true, 1036 creator_.CreateAndSerializeStreamFrame(kHeadersStreamId, iov, 0, 0, true,
1038 nullptr, encrypted_buffer, 1037 nullptr, &num_bytes_consumed);
1039 kMaxPacketSize, &num_bytes_consumed);
1040 EXPECT_EQ(static_cast<size_t>(4), num_bytes_consumed); 1038 EXPECT_EQ(static_cast<size_t>(4), num_bytes_consumed);
1041 1039
1042 // Ensure the packet is successfully created. 1040 // Ensure the packet is successfully created.
1043 ASSERT_TRUE(serialized_packet_.encrypted_buffer); 1041 ASSERT_TRUE(serialized_packet_.encrypted_buffer);
1044 ASSERT_FALSE(serialized_packet_.retransmittable_frames.empty()); 1042 ASSERT_FALSE(serialized_packet_.retransmittable_frames.empty());
1045 const QuicFrames& retransmittable = serialized_packet_.retransmittable_frames; 1043 const QuicFrames& retransmittable = serialized_packet_.retransmittable_frames;
1046 ASSERT_EQ(1u, retransmittable.size()); 1044 ASSERT_EQ(1u, retransmittable.size());
1047 EXPECT_EQ(STREAM_FRAME, retransmittable[0].type); 1045 EXPECT_EQ(STREAM_FRAME, retransmittable[0].type);
1048 ASSERT_TRUE(retransmittable[0].stream_frame); 1046 ASSERT_TRUE(retransmittable[0].stream_frame);
1049 DeleteSerializedPacket(); 1047 DeleteSerializedPacket();
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 EXPECT_CALL(delegate_, 1325 EXPECT_CALL(delegate_,
1328 OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _, _)); 1326 OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _, _));
1329 EXPECT_QUIC_BUG( 1327 EXPECT_QUIC_BUG(
1330 creator_.ConsumeData(1u, data_iovec, 0u, 0u, false, false, &frame), 1328 creator_.ConsumeData(1u, data_iovec, 0u, 0u, false, false, &frame),
1331 "Client hello won't fit in a single packet."); 1329 "Client hello won't fit in a single packet.");
1332 } 1330 }
1333 1331
1334 } // namespace 1332 } // namespace
1335 } // namespace test 1333 } // namespace test
1336 } // namespace net 1334 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_packet_creator.cc ('k') | net/quic/core/quic_packet_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698