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

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

Issue 2007223002: Explicitly disallow multi-packet CHLOs. Protected by FLAGS_quic_disallow_multi_packet_chlo, default… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122481524
Patch Set: remove static_cast Created 4 years, 6 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_packet_creator.cc ('k') | net/quic/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/quic_packet_creator.h" 5 #include "net/quic/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 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 1183
1184 TEST_P(QuicPacketCreatorTest, AddUnencryptedStreamDataClosesConnection) { 1184 TEST_P(QuicPacketCreatorTest, AddUnencryptedStreamDataClosesConnection) {
1185 FLAGS_quic_never_write_unencrypted_data = true; 1185 FLAGS_quic_never_write_unencrypted_data = true;
1186 EXPECT_CALL(delegate_, OnUnrecoverableError(_, _, _)); 1186 EXPECT_CALL(delegate_, OnUnrecoverableError(_, _, _));
1187 QuicStreamFrame stream_frame(kHeadersStreamId, /*fin=*/false, 0u, 1187 QuicStreamFrame stream_frame(kHeadersStreamId, /*fin=*/false, 0u,
1188 StringPiece()); 1188 StringPiece());
1189 EXPECT_DFATAL(creator_.AddSavedFrame(QuicFrame(&stream_frame)), 1189 EXPECT_DFATAL(creator_.AddSavedFrame(QuicFrame(&stream_frame)),
1190 "Cannot send stream data without encryption."); 1190 "Cannot send stream data without encryption.");
1191 } 1191 }
1192 1192
1193 TEST_P(QuicPacketCreatorTest, ChloTooLarge) {
1194 ValueRestore<bool> old_flag(&FLAGS_quic_disallow_multi_packet_chlo, true);
1195 CryptoHandshakeMessage message;
1196 message.set_tag(kCHLO);
1197 message.set_minimum_size(kMaxPacketSize);
1198 CryptoFramer framer;
1199 std::unique_ptr<QuicData> message_data;
1200 message_data.reset(framer.ConstructHandshakeMessage(message));
1201
1202 struct iovec iov;
1203 QuicIOVector data_iovec(::net::MakeIOVector(
1204 StringPiece(message_data->data(), message_data->length()), &iov));
1205 QuicFrame frame;
1206 EXPECT_CALL(delegate_,
1207 OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _, _));
1208 EXPECT_DFATAL(
1209 creator_.ConsumeData(1u, data_iovec, 0u, 0u, false, false, &frame),
1210 "Client hello won't fit in a single packet.");
1211 }
1212
1193 } // namespace 1213 } // namespace
1194 } // namespace test 1214 } // namespace test
1195 } // namespace net 1215 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698