OLD | NEW |
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 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 TEST_P(QuicPacketCreatorTest, AddUnencryptedStreamDataClosesConnection) { | 1212 TEST_P(QuicPacketCreatorTest, AddUnencryptedStreamDataClosesConnection) { |
1213 FLAGS_quic_never_write_unencrypted_data = true; | 1213 FLAGS_quic_never_write_unencrypted_data = true; |
1214 EXPECT_CALL(delegate_, OnUnrecoverableError(_, _, _)); | 1214 EXPECT_CALL(delegate_, OnUnrecoverableError(_, _, _)); |
1215 QuicStreamFrame stream_frame(kHeadersStreamId, /*fin=*/false, 0u, | 1215 QuicStreamFrame stream_frame(kHeadersStreamId, /*fin=*/false, 0u, |
1216 StringPiece()); | 1216 StringPiece()); |
1217 EXPECT_DFATAL(creator_.AddSavedFrame(QuicFrame(&stream_frame)), | 1217 EXPECT_DFATAL(creator_.AddSavedFrame(QuicFrame(&stream_frame)), |
1218 "Cannot send stream data without encryption."); | 1218 "Cannot send stream data without encryption."); |
1219 } | 1219 } |
1220 | 1220 |
1221 TEST_P(QuicPacketCreatorTest, ChloTooLarge) { | 1221 TEST_P(QuicPacketCreatorTest, ChloTooLarge) { |
1222 ValueRestore<bool> old_flag(&FLAGS_quic_disallow_multi_packet_chlo, true); | |
1223 CryptoHandshakeMessage message; | 1222 CryptoHandshakeMessage message; |
1224 message.set_tag(kCHLO); | 1223 message.set_tag(kCHLO); |
1225 message.set_minimum_size(kMaxPacketSize); | 1224 message.set_minimum_size(kMaxPacketSize); |
1226 CryptoFramer framer; | 1225 CryptoFramer framer; |
1227 std::unique_ptr<QuicData> message_data; | 1226 std::unique_ptr<QuicData> message_data; |
1228 message_data.reset(framer.ConstructHandshakeMessage(message)); | 1227 message_data.reset(framer.ConstructHandshakeMessage(message)); |
1229 | 1228 |
1230 struct iovec iov; | 1229 struct iovec iov; |
1231 QuicIOVector data_iovec(::net::MakeIOVector( | 1230 QuicIOVector data_iovec(::net::MakeIOVector( |
1232 StringPiece(message_data->data(), message_data->length()), &iov)); | 1231 StringPiece(message_data->data(), message_data->length()), &iov)); |
1233 QuicFrame frame; | 1232 QuicFrame frame; |
1234 EXPECT_CALL(delegate_, | 1233 EXPECT_CALL(delegate_, |
1235 OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _, _)); | 1234 OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _, _)); |
1236 EXPECT_DFATAL( | 1235 EXPECT_DFATAL( |
1237 creator_.ConsumeData(1u, data_iovec, 0u, 0u, false, false, &frame), | 1236 creator_.ConsumeData(1u, data_iovec, 0u, 0u, false, false, &frame), |
1238 "Client hello won't fit in a single packet."); | 1237 "Client hello won't fit in a single packet."); |
1239 } | 1238 } |
1240 | 1239 |
1241 } // namespace | 1240 } // namespace |
1242 } // namespace test | 1241 } // namespace test |
1243 } // namespace net | 1242 } // namespace net |
OLD | NEW |