| Index: net/quic/quic_connection_test.cc
|
| diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
|
| index 958541138c0d5f28cd34a16926ba7aa77190af7a..b70d2c0d0fbb06264148e8ceeab47c7f8cbc2b6b 100644
|
| --- a/net/quic/quic_connection_test.cc
|
| +++ b/net/quic/quic_connection_test.cc
|
| @@ -13,7 +13,6 @@
|
| #include "net/quic/crypto/null_encrypter.h"
|
| #include "net/quic/crypto/quic_decrypter.h"
|
| #include "net/quic/crypto/quic_encrypter.h"
|
| -#include "net/quic/crypto/quic_random.h"
|
| #include "net/quic/quic_protocol.h"
|
| #include "net/quic/quic_sent_packet_manager.h"
|
| #include "net/quic/quic_utils.h"
|
| @@ -507,7 +506,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<bool> {
|
| QuicConnectionTest()
|
| : guid_(42),
|
| framer_(QuicSupportedVersions(), QuicTime::Zero(), false),
|
| - creator_(guid_, &framer_, QuicRandom::GetInstance(), false),
|
| + creator_(guid_, &framer_, &random_generator_, false),
|
| send_algorithm_(new StrictMock<MockSendAlgorithm>),
|
| helper_(new TestConnectionHelper(&clock_, &random_generator_)),
|
| writer_(new TestPacketWriter()),
|
| @@ -920,6 +919,7 @@ TEST_F(QuicConnectionTest, TruncatedAck) {
|
| for (QuicPacketSequenceNumber i = 1; i <= 256; ++i) {
|
| frame.received_info.missing_packets.insert(i * 2);
|
| }
|
| + frame.received_info.entropy_hash = 0;
|
| EXPECT_CALL(entropy_calculator_,
|
| EntropyHash(511)).WillOnce(testing::Return(0));
|
| EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(256);
|
| @@ -934,6 +934,7 @@ TEST_F(QuicConnectionTest, TruncatedAck) {
|
| received_packet_manager->peer_largest_observed_packet());
|
|
|
| frame.received_info.missing_packets.erase(192);
|
| + frame.received_info.entropy_hash = 2;
|
|
|
| // Removing one missing packet allows us to ack 192 and one more range.
|
| EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(2);
|
| @@ -1024,6 +1025,8 @@ TEST_F(QuicConnectionTest, AckReceiptCausesAckSend) {
|
|
|
| // But an ack with no missing packets will not send an ack.
|
| frame2.received_info.missing_packets.clear();
|
| + frame2.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, retransmission);
|
| ProcessAckPacket(&frame2);
|
| ProcessAckPacket(&frame2);
|
| }
|
| @@ -1653,7 +1656,7 @@ TEST_F(QuicConnectionTest, DiscardRetransmit) {
|
|
|
| // Now, ack the previous transmission.
|
| QuicAckFrame ack_all(3, QuicTime::Zero(), 0);
|
| - nack_two.received_info.entropy_hash =
|
| + ack_all.received_info.entropy_hash =
|
| QuicConnectionPeer::GetSentEntropyHash(&connection_, 3);
|
| ProcessAckPacket(&ack_all);
|
|
|
| @@ -1795,7 +1798,7 @@ TEST_F(QuicConnectionTest, MultipleAcks) {
|
| frame1.received_info.entropy_hash =
|
| QuicConnectionPeer::GetSentEntropyHash(&connection_, 5) ^
|
| QuicConnectionPeer::GetSentEntropyHash(&connection_, 3) ^
|
| - QuicConnectionPeer::GetSentEntropyHash(&connection_, 1);
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 2);
|
|
|
| EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
|
|
| @@ -2130,8 +2133,11 @@ TEST_F(QuicConnectionTest, RetransmissionCountCalculation) {
|
| // Ack the retransmitted packet.
|
| ack.received_info.missing_packets.insert(original_sequence_number);
|
| ack.received_info.missing_packets.insert(rto_sequence_number);
|
| - ack.received_info.entropy_hash = QuicConnectionPeer::GetSentEntropyHash(
|
| - &connection_, rto_sequence_number - 1);
|
| + ack.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_,
|
| + rto_sequence_number - 1) ^
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_,
|
| + original_sequence_number);
|
| for (int i = 0; i < 3; i++) {
|
| ProcessAckPacket(&ack);
|
| }
|
| @@ -2170,6 +2176,8 @@ TEST_F(QuicConnectionTest, DelayRTOWithAckReceipt) {
|
| clock_.AdvanceTime(DefaultRetransmissionTime());
|
| EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1);
|
| QuicAckFrame ack(1, QuicTime::Zero(), 0);
|
| + ack.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 1);
|
| ProcessAckPacket(&ack);
|
| EXPECT_TRUE(retransmission_alarm->IsSet());
|
|
|
| @@ -3144,6 +3152,8 @@ TEST_F(QuicConnectionTest, AckNotifierTriggerCallback) {
|
| // Process an ACK from the server which should trigger the callback.
|
| EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1);
|
| QuicAckFrame frame(1, QuicTime::Zero(), 0);
|
| + frame.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 1);
|
| ProcessAckPacket(&frame);
|
| }
|
|
|
| @@ -3168,6 +3178,9 @@ TEST_F(QuicConnectionTest, AckNotifierFailToTriggerCallback) {
|
| // which we registered to be notified about.
|
| QuicAckFrame frame(3, QuicTime::Zero(), 0);
|
| frame.received_info.missing_packets.insert(1);
|
| + frame.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 3) ^
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 1);
|
| EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _));
|
| EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _));
|
| ProcessAckPacket(&frame);
|
| @@ -3192,6 +3205,10 @@ TEST_F(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) {
|
| // Now we receive ACK for packets 1, 3, and 4, which invokes fast retransmit.
|
| QuicAckFrame frame(4, QuicTime::Zero(), 0);
|
| frame.received_info.missing_packets.insert(2);
|
| + frame.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 4) ^
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 2) ^
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 1);
|
| EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _));
|
| EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _));
|
| EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
|
| @@ -3200,6 +3217,8 @@ TEST_F(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) {
|
| // Now we get an ACK for packet 5 (retransmitted packet 2), which should
|
| // trigger the callback.
|
| QuicAckFrame second_ack_frame(5, QuicTime::Zero(), 0);
|
| + second_ack_frame.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 5);
|
| ProcessAckPacket(&second_ack_frame);
|
| }
|
|
|
| @@ -3224,6 +3243,8 @@ TEST_F(QuicConnectionTest, AckNotifierCallbackAfterFECRecovery) {
|
| QuicFrames frames;
|
|
|
| QuicAckFrame ack_frame(1, QuicTime::Zero(), 0);
|
| + ack_frame.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 1);
|
| frames.push_back(QuicFrame(&ack_frame));
|
|
|
| // Dummy stream frame to satisfy expectations set elsewhere.
|
|
|