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

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

Issue 2430973004: Landing Recent QUIC changes until 10:38 AM, Oct 17, 2016 UTC-4 (Closed)
Patch Set: Improving flagsaver logging Created 4 years, 2 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_generator.cc ('k') | net/quic/core/quic_protocol.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/core/quic_packet_generator.h" 5 #include "net/quic/core/quic_packet_generator.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 memset(data_array_.get(), '?', len); 200 memset(data_array_.get(), '?', len);
201 iov_.iov_base = data_array_.get(); 201 iov_.iov_base = data_array_.get();
202 iov_.iov_len = len; 202 iov_.iov_len = len;
203 return QuicIOVector(&iov_, 1, len); 203 return QuicIOVector(&iov_, 1, len);
204 } 204 }
205 205
206 QuicIOVector MakeIOVector(StringPiece s) { 206 QuicIOVector MakeIOVector(StringPiece s) {
207 return ::net::MakeIOVector(s, &iov_); 207 return ::net::MakeIOVector(s, &iov_);
208 } 208 }
209 209
210 QuicFlagSaver flags_; // Save/restore all QUIC flag values.
211 QuicFramer framer_; 210 QuicFramer framer_;
212 MockRandom random_; 211 MockRandom random_;
213 SimpleBufferAllocator buffer_allocator_; 212 SimpleBufferAllocator buffer_allocator_;
214 StrictMock<MockDelegate> delegate_; 213 StrictMock<MockDelegate> delegate_;
215 QuicPacketGenerator generator_; 214 QuicPacketGenerator generator_;
216 QuicPacketCreator* creator_; 215 QuicPacketCreator* creator_;
217 SimpleQuicFramer simple_framer_; 216 SimpleQuicFramer simple_framer_;
218 vector<SerializedPacket> packets_; 217 vector<SerializedPacket> packets_;
219 QuicAckFrame ack_frame_; 218 QuicAckFrame ack_frame_;
220 219
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 EXPECT_CALL(delegate_, OnSerializedPacket(_)) 871 EXPECT_CALL(delegate_, OnSerializedPacket(_))
873 .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket)); 872 .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket));
874 generator_.FlushAllQueuedFrames(); 873 generator_.FlushAllQueuedFrames();
875 EXPECT_FALSE(generator_.HasQueuedFrames()); 874 EXPECT_FALSE(generator_.HasQueuedFrames());
876 generator_.SetCurrentPath(kTestPathId1, 1, 0); 875 generator_.SetCurrentPath(kTestPathId1, 1, 0);
877 EXPECT_EQ(kTestPathId1, QuicPacketCreatorPeer::GetCurrentPath(creator_)); 876 EXPECT_EQ(kTestPathId1, QuicPacketCreatorPeer::GetCurrentPath(creator_));
878 } 877 }
879 878
880 // Regression test for b/31486443. 879 // Regression test for b/31486443.
881 TEST_F(QuicPacketGeneratorTest, ConnectionCloseFrameLargerThanPacketSize) { 880 TEST_F(QuicPacketGeneratorTest, ConnectionCloseFrameLargerThanPacketSize) {
882 FLAGS_quic_close_connection_on_huge_frames = true;
883 delegate_.SetCanWriteAnything(); 881 delegate_.SetCanWriteAnything();
884 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame(); 882 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame();
885 frame->error_code = QUIC_PACKET_WRITE_ERROR; 883 frame->error_code = QUIC_PACKET_WRITE_ERROR;
886 char buf[2000]; 884 char buf[2000];
887 StringPiece error_details(buf, 2000); 885 StringPiece error_details(buf, 2000);
888 frame->error_details = error_details.as_string(); 886 frame->error_details = error_details.as_string();
889 EXPECT_CALL(delegate_, 887 EXPECT_CALL(delegate_,
890 OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET, 888 OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET,
891 "Single frame cannot fit into a packet", _)); 889 "Single frame cannot fit into a packet", _));
892 EXPECT_QUIC_BUG(generator_.AddControlFrame(QuicFrame(frame)), ""); 890 EXPECT_QUIC_BUG(generator_.AddControlFrame(QuicFrame(frame)), "");
893 EXPECT_TRUE(generator_.HasQueuedFrames()); 891 EXPECT_TRUE(generator_.HasQueuedFrames());
894 } 892 }
895 893
896 } // namespace test 894 } // namespace test
897 } // namespace net 895 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_packet_generator.cc ('k') | net/quic/core/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698