+TEST_P(QuicConnectionTest, ReviveMissingPacketWithVaryingSeqNumLengths) {
+ if (version() < QUIC_VERSION_15) {
+ return;
+ }
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+
+ // Set up a debug visitor to the connection.
+ scoped_ptr<FecQuicConnectionDebugVisitor>
+ fec_visitor(new FecQuicConnectionDebugVisitor);
+ connection_.set_debug_visitor(fec_visitor.get());
+
+ QuicPacketSequenceNumber fec_packet = 0;
+ QuicSequenceNumberLength lengths[] = {PACKET_6BYTE_SEQUENCE_NUMBER,
+ PACKET_4BYTE_SEQUENCE_NUMBER,
+ PACKET_2BYTE_SEQUENCE_NUMBER,
+ PACKET_1BYTE_SEQUENCE_NUMBER};
+ // For each sequence number length size, revive a packet and check sequence
+ // number length in the revived packet.
+ for (size_t i = 0; i < arraysize(lengths); ++i) {
+ // Set sequence_number_length_ (for data and FEC packets).
+ sequence_number_length_ = lengths[i];
+ fec_packet += 2;
+ // Don't send missing packet, but send fec packet right after it.
+ ProcessFecPacket(/*seq_num=*/fec_packet, /*fec_group=*/fec_packet - 1,
+ true, !kEntropyFlag, NULL);
+ // Sequence number length in the revived header should be the same as
+ // in the original data/fec packet headers.
+ EXPECT_EQ(sequence_number_length_, fec_visitor->revived_header().
+ public_header.sequence_number_length);
+ }
+}
+
+TEST_P(QuicConnectionTest, ReviveMissingPacketWithVaryingConnectionIdLengths) {
+ if (version() < QUIC_VERSION_15) {
+ return;
+ }
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+
+ // Set up a debug visitor to the connection.
+ scoped_ptr<FecQuicConnectionDebugVisitor>
+ fec_visitor(new FecQuicConnectionDebugVisitor);
+ connection_.set_debug_visitor(fec_visitor.get());
+
+ QuicPacketSequenceNumber fec_packet = 0;
+ QuicConnectionIdLength lengths[] = {PACKET_8BYTE_CONNECTION_ID,
+ PACKET_4BYTE_CONNECTION_ID,
+ PACKET_1BYTE_CONNECTION_ID,
+ PACKET_0BYTE_CONNECTION_ID};
+ // For each connection id length size, revive a packet and check connection
+ // id length in the revived packet.
+ for (size_t i = 0; i < arraysize(lengths); ++i) {
+ // Set connection id length (for data and FEC packets).
+ connection_id_length_ = lengths[i];
+ fec_packet += 2;
+ // Don't send missing packet, but send fec packet right after it.
+ ProcessFecPacket(/*seq_num=*/fec_packet, /*fec_group=*/fec_packet - 1,
+ true, !kEntropyFlag, NULL);
+ // Connection id length in the revived header should be the same as
+ // in the original data/fec packet headers.
+ EXPECT_EQ(connection_id_length_,
+ fec_visitor->revived_header().public_header.connection_id_length);
+ }
+}
+