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 d4b7f449a33871989062b8cbff9bc7e56b14a09e..91646c5e2735f0e7545862d611c79751763aed47 100644 |
--- a/net/quic/quic_packet_creator_test.cc |
+++ b/net/quic/quic_packet_creator_test.cc |
@@ -120,6 +120,14 @@ class QuicPacketCreatorTest : public ::testing::TestWithParam<TestParams> { |
kClientDataStreamId1, kOffset, |
true, is_in_fec_group); |
} |
+ |
+ // Enables and turns on FEC protection. Returns true if FEC protection is on. |
+ bool SwitchFecProtectionOn(size_t max_packets_per_fec_group) { |
+ creator_.set_max_packets_per_fec_group(max_packets_per_fec_group); |
+ creator_.StartFecProtectingPackets(); |
+ return creator_.IsFecProtected(); |
+ } |
+ |
static const QuicStreamOffset kOffset = 1u; |
QuicFrames frames_; |
@@ -167,7 +175,7 @@ TEST_P(QuicPacketCreatorTest, SerializeFrames) { |
TEST_P(QuicPacketCreatorTest, SerializeWithFEC) { |
// Enable FEC protection, and send FEC packet every 6 packets. |
- EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(&creator_, 6)); |
+ EXPECT_TRUE(SwitchFecProtectionOn(6)); |
// Should return false since we do not have enough packets in the FEC group to |
// trigger an FEC packet. |
ASSERT_FALSE(creator_.ShouldSendFec(/*force_close=*/false)); |
@@ -339,7 +347,7 @@ TEST_P(QuicPacketCreatorTest, SerializeWithFECChangingSequenceNumberLength) { |
// of the open FEC group. |
// Enable FEC protection, and send FEC packet every 6 packets. |
- EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(&creator_, 6)); |
+ EXPECT_TRUE(SwitchFecProtectionOn(6)); |
// Should return false since we do not have enough packets in the FEC group to |
// trigger an FEC packet. |
ASSERT_FALSE(creator_.ShouldSendFec(/*force_close=*/false)); |
@@ -488,7 +496,7 @@ TEST_P(QuicPacketCreatorTest, SwitchFecOnOffWithNoGroup) { |
TEST_P(QuicPacketCreatorTest, SwitchFecOnOffWithGroupInProgress) { |
// Enable FEC protection, and send FEC packet every 6 packets. |
- EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(&creator_, 6)); |
+ EXPECT_TRUE(SwitchFecProtectionOn(6)); |
frames_.push_back(QuicFrame(new QuicStreamFrame(0u, false, 0u, IOVector()))); |
SerializedPacket serialized = creator_.SerializeAllFrames(frames_); |
delete frames_[0].stream_frame; |
@@ -626,7 +634,7 @@ TEST_P(QuicPacketCreatorTest, StreamFrameConsumption) { |
TEST_P(QuicPacketCreatorTest, StreamFrameConsumptionWithFec) { |
// Enable FEC protection, and send FEC packet every 6 packets. |
- EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(&creator_, 6)); |
+ EXPECT_TRUE(SwitchFecProtectionOn(6)); |
// Compute the total overhead for a single frame in packet. |
const size_t overhead = GetPacketHeaderOverhead(IN_FEC_GROUP) |
+ GetEncryptionOverhead() + GetStreamFrameOverhead(IN_FEC_GROUP); |