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..6ed8f91901e1ba3c7155d91eabf14f4795444268 100644 |
--- a/net/quic/quic_packet_creator_test.cc |
+++ b/net/quic/quic_packet_creator_test.cc |
@@ -73,7 +73,8 @@ class QuicPacketCreatorTest : public ::testing::TestWithParam<TestParams> { |
client_framer_.set_received_entropy_calculator(&entropy_calculator_); |
server_framer_.set_visitor(&framer_visitor_); |
} |
- ~QuicPacketCreatorTest() { |
+ |
+ virtual ~QuicPacketCreatorTest() OVERRIDE { |
} |
void ProcessPacket(QuicPacket* packet) { |
@@ -120,6 +121,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 +176,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 +348,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 +497,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 +635,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); |