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

Unified Diff: net/quic/quic_packet_creator_test.cc

Issue 1562833003: relnote: Clear the FEC group in QuicPacketCreator when encryption_level is none and close the conne… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26_CL_111359954
Patch Set: sync quic_error_map with quic_protocol Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_packet_generator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_packet_creator_test.cc
diff --git a/net/quic/quic_packet_creator_test.cc b/net/quic/quic_packet_creator_test.cc
index 1026941811031ab9a8127c4152569e55e837bb13..c7fe0237390e5ca6943002d8e5fc6669c670281b 100644
--- a/net/quic/quic_packet_creator_test.cc
+++ b/net/quic/quic_packet_creator_test.cc
@@ -136,6 +136,7 @@ class QuicPacketCreatorTest : public ::testing::TestWithParam<TestParams> {
server_framer_.set_visitor(&framer_visitor_);
// TODO(ianswett): Fix this test so it uses a non-null encrypter.
FLAGS_quic_never_write_unencrypted_data = false;
+ FLAGS_quic_no_unencrypted_fec = false;
}
~QuicPacketCreatorTest() override {}
@@ -1588,6 +1589,56 @@ TEST_P(QuicPacketCreatorTest, AddUnencryptedStreamDataClosesConnection) {
"Cannot send stream data without encryption.");
}
+TEST_P(QuicPacketCreatorTest, DontSendUnencryptedFec) {
+ FLAGS_quic_no_unencrypted_fec = true;
+ // Send FEC packet every 6 packets.
+ creator_.set_max_packets_per_fec_group(6);
+ // Send stream data encrypted with FEC protection.
+ creator_.set_encryption_level(ENCRYPTION_INITIAL);
+ // Turn on FEC protection.
+ QuicFrame frame;
+ QuicIOVector io_vector(MakeIOVector("test"));
+ ASSERT_TRUE(creator_.ConsumeData(kHeadersStreamId, io_vector, 0u, 0u, false,
+ false, &frame, MUST_FEC_PROTECT));
+ EXPECT_TRUE(QuicPacketCreatorPeer::IsFecProtected(&creator_));
+ // Serialize the packet.
+ EXPECT_CALL(delegate_, OnSerializedPacket(_))
+ .WillOnce(Invoke(this, &QuicPacketCreatorTest::ClearSerializedPacket));
+ creator_.Flush();
+
+ // The creator will clear the FEC group rather than try to send without
+ // encryption.
+ creator_.set_encryption_level(ENCRYPTION_NONE);
+ EXPECT_CALL(delegate_, OnResetFecGroup());
+ creator_.MaybeSendFecPacketAndCloseGroup(true, false);
+}
+
+TEST_P(QuicPacketCreatorTest, SerializeUnencryptedFecClosesConnection) {
+ FLAGS_quic_no_unencrypted_fec = true;
+ // Send FEC packet every 6 packets.
+ creator_.set_max_packets_per_fec_group(6);
+ // Send stream data encrypted with FEC protection.
+ creator_.set_encryption_level(ENCRYPTION_INITIAL);
+ // Turn on FEC protection.
+ QuicFrame frame;
+ QuicIOVector io_vector(MakeIOVector("test"));
+ ASSERT_TRUE(creator_.ConsumeData(kHeadersStreamId, io_vector, 0u, 0u, false,
+ false, &frame, MUST_FEC_PROTECT));
+ EXPECT_TRUE(QuicPacketCreatorPeer::IsFecProtected(&creator_));
+ // Serialize the packet.
+ EXPECT_CALL(delegate_, OnSerializedPacket(_))
+ .WillOnce(Invoke(this, &QuicPacketCreatorTest::ClearSerializedPacket));
+ creator_.Flush();
+
+ // Try to send an FEC packet unencrypted.
+ creator_.set_encryption_level(ENCRYPTION_NONE);
+ EXPECT_CALL(delegate_, CloseConnection(QUIC_UNENCRYPTED_FEC_DATA, _));
+ char seralized_fec_buffer[kMaxPacketSize];
+ EXPECT_DFATAL(QuicPacketCreatorPeer::SerializeFec(
+ &creator_, seralized_fec_buffer, kMaxPacketSize),
+ "SerializeFEC must be called with encryption.");
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_packet_generator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698