| Index: net/quic/quic_connection_test.cc
|
| diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
|
| index 83331ee10ddd14079e5509ff25c4d5ef242b5183..c8f4d3250f0d6602a8fe94e455e61ad881c97ac6 100644
|
| --- a/net/quic/quic_connection_test.cc
|
| +++ b/net/quic/quic_connection_test.cc
|
| @@ -591,21 +591,6 @@ class TestConnection : public QuicConnection {
|
| DISALLOW_COPY_AND_ASSIGN(TestConnection);
|
| };
|
|
|
| -// Used for testing packets revived from FEC packets.
|
| -class FecQuicConnectionDebugVisitor : public QuicConnectionDebugVisitor {
|
| - public:
|
| - void OnRevivedPacket(const QuicPacketHeader& header,
|
| - StringPiece data) override {
|
| - revived_header_ = header;
|
| - }
|
| -
|
| - // Public accessor method.
|
| - QuicPacketHeader revived_header() const { return revived_header_; }
|
| -
|
| - private:
|
| - QuicPacketHeader revived_header_;
|
| -};
|
| -
|
| enum class AckResponse { kDefer, kImmediate };
|
|
|
| // Run tests with combinations of {QuicVersion, AckResponse}.
|
| @@ -735,7 +720,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
|
|
| void ProcessPacket(QuicPathId path_id, QuicPacketNumber number) {
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacket(path_id, number, 0, !kEntropyFlag);
|
| + ProcessDataPacket(path_id, number, !kEntropyFlag);
|
| if (connection_.GetSendAlarm()->IsSet()) {
|
| connection_.GetSendAlarm()->Fire();
|
| }
|
| @@ -794,20 +779,18 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
|
|
| size_t ProcessDataPacket(QuicPathId path_id,
|
| QuicPacketNumber number,
|
| - QuicFecGroupNumber fec_group,
|
| bool entropy_flag) {
|
| - return ProcessDataPacketAtLevel(path_id, number, fec_group, entropy_flag,
|
| - false, ENCRYPTION_NONE);
|
| + return ProcessDataPacketAtLevel(path_id, number, entropy_flag, false,
|
| + ENCRYPTION_NONE);
|
| }
|
|
|
| size_t ProcessDataPacketAtLevel(QuicPathId path_id,
|
| QuicPacketNumber number,
|
| - QuicFecGroupNumber fec_group,
|
| bool entropy_flag,
|
| bool has_stop_waiting,
|
| EncryptionLevel level) {
|
| - scoped_ptr<QuicPacket> packet(ConstructDataPacket(
|
| - path_id, number, fec_group, entropy_flag, has_stop_waiting));
|
| + scoped_ptr<QuicPacket> packet(
|
| + ConstructDataPacket(path_id, number, entropy_flag, has_stop_waiting));
|
| char buffer[kMaxPacketSize];
|
| size_t encrypted_length = framer_.EncryptPayload(
|
| level, path_id, number, *packet, buffer, kMaxPacketSize);
|
| @@ -820,10 +803,8 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
| return encrypted_length;
|
| }
|
|
|
| - void ProcessClosePacket(QuicPathId path_id,
|
| - QuicPacketNumber number,
|
| - QuicFecGroupNumber fec_group) {
|
| - scoped_ptr<QuicPacket> packet(ConstructClosePacket(number, fec_group));
|
| + void ProcessClosePacket(QuicPathId path_id, QuicPacketNumber number) {
|
| + scoped_ptr<QuicPacket> packet(ConstructClosePacket(number));
|
| char buffer[kMaxPacketSize];
|
| size_t encrypted_length = framer_.EncryptPayload(
|
| ENCRYPTION_NONE, path_id, number, *packet, buffer, kMaxPacketSize);
|
| @@ -832,109 +813,6 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
| QuicEncryptedPacket(buffer, encrypted_length, false));
|
| }
|
|
|
| - size_t ProcessFecProtectedPacket(QuicPathId path_id,
|
| - QuicPacketNumber number,
|
| - bool expect_revival,
|
| - bool entropy_flag,
|
| - bool has_stop_waiting) {
|
| - return ProcessFecProtectedPacketAtLevel(path_id, number, 1, expect_revival,
|
| - entropy_flag, has_stop_waiting,
|
| - ENCRYPTION_NONE);
|
| - }
|
| -
|
| - size_t ProcessFecProtectedPacketAtLevel(QuicPathId path_id,
|
| - QuicPacketNumber number,
|
| - QuicFecGroupNumber fec_group,
|
| - bool expect_revival,
|
| - bool entropy_flag,
|
| - bool has_stop_waiting,
|
| - EncryptionLevel level) {
|
| - if (expect_revival) {
|
| - EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - }
|
| - EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1).RetiresOnSaturation();
|
| - return ProcessDataPacketAtLevel(path_id, number, fec_group, entropy_flag,
|
| - has_stop_waiting, level);
|
| - }
|
| -
|
| - // Processes an FEC packet that covers the packets that would have been
|
| - // received.
|
| - size_t ProcessFecPacket(QuicPathId path_id,
|
| - QuicPacketNumber number,
|
| - QuicPacketNumber min_protected_packet,
|
| - bool expect_revival,
|
| - bool entropy_flag,
|
| - QuicPacket* packet) {
|
| - return ProcessFecPacketAtLevel(path_id, number, min_protected_packet,
|
| - expect_revival, entropy_flag, packet,
|
| - ENCRYPTION_NONE);
|
| - }
|
| -
|
| - // Processes an FEC packet that covers the packets that would have been
|
| - // received.
|
| - size_t ProcessFecPacketAtLevel(QuicPathId path_id,
|
| - QuicPacketNumber number,
|
| - QuicPacketNumber min_protected_packet,
|
| - bool expect_revival,
|
| - bool entropy_flag,
|
| - QuicPacket* packet,
|
| - EncryptionLevel level) {
|
| - if (expect_revival) {
|
| - EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - }
|
| -
|
| - // Construct the decrypted data packet so we can compute the correct
|
| - // redundancy. If |packet| has been provided then use that, otherwise
|
| - // construct a default data packet.
|
| - scoped_ptr<QuicPacket> data_packet;
|
| - if (packet) {
|
| - data_packet.reset(packet);
|
| - } else {
|
| - data_packet.reset(ConstructDataPacket(path_id, number, 1, !kEntropyFlag,
|
| - !kHasStopWaiting));
|
| - }
|
| -
|
| - QuicPacketHeader header;
|
| - header.public_header.connection_id = connection_id_;
|
| - header.public_header.packet_number_length = packet_number_length_;
|
| - header.public_header.connection_id_length = connection_id_length_;
|
| - header.public_header.multipath_flag = path_id != kDefaultPathId;
|
| - header.path_id = path_id;
|
| - header.packet_number = number;
|
| - header.entropy_flag = entropy_flag;
|
| - header.fec_flag = true;
|
| - header.is_in_fec_group = IN_FEC_GROUP;
|
| - header.fec_group = min_protected_packet;
|
| -
|
| - // Since all data packets in this test have the same payload, the
|
| - // redundancy is either equal to that payload or the xor of that payload
|
| - // with itself, depending on the number of packets.
|
| - if (((number - min_protected_packet) % 2) == 0) {
|
| - for (size_t i = GetStartOfFecProtectedData(
|
| - header.public_header.connection_id_length,
|
| - header.public_header.version_flag,
|
| - header.public_header.multipath_flag,
|
| - header.public_header.packet_number_length);
|
| - i < data_packet->length(); ++i) {
|
| - data_packet->mutable_data()[i] ^= data_packet->data()[i];
|
| - }
|
| - }
|
| -
|
| - scoped_ptr<QuicPacket> fec_packet(
|
| - framer_.BuildFecPacket(header, data_packet->FecProtectedData()));
|
| - char buffer[kMaxPacketSize];
|
| - size_t encrypted_length = framer_.EncryptPayload(
|
| - level, path_id, number, *fec_packet, buffer, kMaxPacketSize);
|
| -
|
| - connection_.ProcessUdpPacket(
|
| - kSelfAddress, kPeerAddress,
|
| - QuicEncryptedPacket(buffer, encrypted_length, false));
|
| - if (connection_.GetSendAlarm()->IsSet()) {
|
| - connection_.GetSendAlarm()->Fire();
|
| - }
|
| - return encrypted_length;
|
| - }
|
| -
|
| QuicByteCount SendStreamDataToPeer(QuicStreamId id,
|
| StringPiece data,
|
| QuicStreamOffset offset,
|
| @@ -1001,7 +879,6 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
|
|
| QuicPacket* ConstructDataPacket(QuicPathId path_id,
|
| QuicPacketNumber number,
|
| - QuicFecGroupNumber fec_group,
|
| bool entropy_flag,
|
| bool has_stop_waiting) {
|
| QuicPacketHeader header;
|
| @@ -1012,8 +889,8 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
| header.entropy_flag = entropy_flag;
|
| header.path_id = path_id;
|
| header.packet_number = number;
|
| - header.is_in_fec_group = fec_group == 0u ? NOT_IN_FEC_GROUP : IN_FEC_GROUP;
|
| - header.fec_group = fec_group;
|
| + header.is_in_fec_group = NOT_IN_FEC_GROUP;
|
| + header.fec_group = 0;
|
|
|
| QuicFrames frames;
|
| frames.push_back(QuicFrame(&frame1_));
|
| @@ -1023,13 +900,12 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
| return ConstructPacket(header, frames);
|
| }
|
|
|
| - QuicPacket* ConstructClosePacket(QuicPacketNumber number,
|
| - QuicFecGroupNumber fec_group) {
|
| + QuicPacket* ConstructClosePacket(QuicPacketNumber number) {
|
| QuicPacketHeader header;
|
| header.public_header.connection_id = connection_id_;
|
| header.packet_number = number;
|
| - header.is_in_fec_group = fec_group == 0u ? NOT_IN_FEC_GROUP : IN_FEC_GROUP;
|
| - header.fec_group = fec_group;
|
| + header.is_in_fec_group = NOT_IN_FEC_GROUP;
|
| + header.fec_group = 0;
|
|
|
| QuicConnectionCloseFrame qccf;
|
| qccf.error_code = QUIC_PEER_GOING_AWAY;
|
| @@ -1085,7 +961,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
| ConnectionCloseSource::FROM_SELF));
|
| // Call ProcessDataPacket rather than ProcessPacket, as we should not get a
|
| // packet call to the visitor.
|
| - ProcessDataPacket(kDefaultPathId, 6000, 0, !kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 6000, !kEntropyFlag);
|
| EXPECT_FALSE(QuicConnectionPeer::GetConnectionClosePacket(&connection_) ==
|
| nullptr);
|
| }
|
| @@ -1332,7 +1208,7 @@ TEST_P(QuicConnectionTest, DuplicatePacket) {
|
|
|
| // Send packet 3 again, but do not set the expectation that
|
| // the visitor OnStreamFrame() will be called.
|
| - ProcessDataPacket(kDefaultPathId, 3, 0, !kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 3, !kEntropyFlag);
|
| EXPECT_EQ(3u, outgoing_ack()->largest_observed);
|
| EXPECT_TRUE(IsMissing(2));
|
| EXPECT_TRUE(IsMissing(1));
|
| @@ -1373,7 +1249,7 @@ TEST_P(QuicConnectionTest, RejectPacketTooFarOut) {
|
| ConnectionCloseSource::FROM_SELF));
|
| // Call ProcessDataPacket rather than ProcessPacket, as we should not get a
|
| // packet call to the visitor.
|
| - ProcessDataPacket(kDefaultPathId, 6000, 0, !kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 6000, !kEntropyFlag);
|
| EXPECT_FALSE(QuicConnectionPeer::GetConnectionClosePacket(&connection_) ==
|
| nullptr);
|
| }
|
| @@ -1384,7 +1260,7 @@ TEST_P(QuicConnectionTest, RejectUnencryptedStreamData) {
|
| EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_UNENCRYPTED_STREAM_DATA,
|
| ConnectionCloseSource::FROM_SELF));
|
| - EXPECT_DFATAL(ProcessDataPacket(kDefaultPathId, 1, 0, !kEntropyFlag), "");
|
| + EXPECT_DFATAL(ProcessDataPacket(kDefaultPathId, 1, !kEntropyFlag), "");
|
| EXPECT_FALSE(QuicConnectionPeer::GetConnectionClosePacket(&connection_) ==
|
| nullptr);
|
| const vector<QuicConnectionCloseFrame>& connection_close_frames =
|
| @@ -1917,7 +1793,7 @@ TEST_P(QuicConnectionTest, FramePackingAckResponse) {
|
| EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| // Process a data packet to queue up a pending ack.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacket(kDefaultPathId, 1, 1, kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 1, kEntropyFlag);
|
|
|
| EXPECT_CALL(visitor_, OnCanWrite())
|
| .WillOnce(DoAll(IgnoreResult(InvokeWithoutArgs(
|
| @@ -2540,128 +2416,6 @@ TEST_P(QuicConnectionTest, DontLatchUnackedPacket) {
|
| EXPECT_EQ(6u, stop_waiting()->least_unacked);
|
| }
|
|
|
| -TEST_P(QuicConnectionTest, ReviveMissingPacketAfterFecPacket) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| -
|
| - // Don't send missing packet 1.
|
| - ProcessFecPacket(kDefaultPathId, 2, 1, true, !kEntropyFlag, nullptr);
|
| - // Entropy flag should be false, so entropy should be 0.
|
| - EXPECT_EQ(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 2));
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest, ReviveMissingPacketWithVaryingSeqNumLengths) {
|
| - 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());
|
| -
|
| - QuicPacketNumber fec_packet = 0;
|
| - // clang-format off
|
| - QuicPacketNumberLength lengths[] = {
|
| - PACKET_6BYTE_PACKET_NUMBER, PACKET_4BYTE_PACKET_NUMBER,
|
| - PACKET_2BYTE_PACKET_NUMBER, PACKET_1BYTE_PACKET_NUMBER};
|
| - // clang-format on
|
| - // For each packet 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 packet_number_length_ (for data and FEC packets).
|
| - packet_number_length_ = lengths[i];
|
| - fec_packet += 2;
|
| - // Don't send missing packet, but send fec packet right after it.
|
| - ProcessFecPacket(kDefaultPathId, fec_packet, fec_packet - 1, true,
|
| - !kEntropyFlag, nullptr);
|
| - // packet number length in the revived header should be the same as
|
| - // in the original data/fec packet headers.
|
| - EXPECT_EQ(packet_number_length_,
|
| - fec_visitor->revived_header().public_header.packet_number_length);
|
| - }
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest, ReviveMissingPacketWithVaryingConnectionIdLengths) {
|
| - 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());
|
| -
|
| - QuicPacketNumber 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(kDefaultPathId, fec_packet, fec_packet - 1, true,
|
| - !kEntropyFlag, nullptr);
|
| - // 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);
|
| - }
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest, ReviveMissingPacketAfterDataPacketThenFecPacket) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| -
|
| - ProcessFecProtectedPacket(kDefaultPathId, 1, false, kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - // Don't send missing packet 2.
|
| - ProcessFecPacket(kDefaultPathId, 3, 1, true, !kEntropyFlag, nullptr);
|
| - // Entropy flag should be true, so entropy should not be 0.
|
| - EXPECT_NE(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 2));
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest, ReviveMissingPacketAfterDataPacketsThenFecPacket) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| -
|
| - ProcessFecProtectedPacket(kDefaultPathId, 1, false, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - // Don't send missing packet 2.
|
| - ProcessFecProtectedPacket(kDefaultPathId, 3, false, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - ProcessFecPacket(kDefaultPathId, 4, 1, true, kEntropyFlag, nullptr);
|
| - // Ensure QUIC no longer revives entropy for lost packets.
|
| - EXPECT_EQ(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 2));
|
| - EXPECT_NE(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 4));
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest, ReviveMissingPacketAfterDataPacket) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| -
|
| - // Don't send missing packet 1.
|
| - ProcessFecPacket(kDefaultPathId, 3, 1, false, !kEntropyFlag, nullptr);
|
| - // Out of order.
|
| - ProcessFecProtectedPacket(kDefaultPathId, 2, true, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - // Entropy flag should be false, so entropy should be 0.
|
| - EXPECT_EQ(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 2));
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest, ReviveMissingPacketAfterDataPackets) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| -
|
| - ProcessFecProtectedPacket(kDefaultPathId, 1, false, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - // Don't send missing packet 2.
|
| - ProcessFecPacket(kDefaultPathId, 6, 1, false, kEntropyFlag, nullptr);
|
| - ProcessFecProtectedPacket(kDefaultPathId, 3, false, kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - ProcessFecProtectedPacket(kDefaultPathId, 4, false, kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - ProcessFecProtectedPacket(kDefaultPathId, 5, true, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - // Ensure entropy is not revived for the missing packet.
|
| - EXPECT_EQ(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 2));
|
| - EXPECT_NE(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 3));
|
| -}
|
| -
|
| TEST_P(QuicConnectionTest, TLP) {
|
| QuicSentPacketManagerPeer::SetMaxTailLossProbes(manager_, 1);
|
|
|
| @@ -2870,7 +2624,7 @@ TEST_P(QuicConnectionTest, BufferNonDecryptablePackets) {
|
|
|
| // Process an encrypted packet which can not yet be decrypted which should
|
| // result in the packet being buffered.
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 1, 0, kEntropyFlag, !kHasStopWaiting,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 1, kEntropyFlag, !kHasStopWaiting,
|
| ENCRYPTION_INITIAL);
|
|
|
| // Transition to the new encryption state and process another encrypted packet
|
| @@ -2879,55 +2633,16 @@ TEST_P(QuicConnectionTest, BufferNonDecryptablePackets) {
|
| connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
|
| connection_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag));
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(2);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 2, 0, kEntropyFlag, !kHasStopWaiting,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 2, kEntropyFlag, !kHasStopWaiting,
|
| ENCRYPTION_INITIAL);
|
|
|
| // Finally, process a third packet and note that we do not reprocess the
|
| // buffered packet.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 3, 0, kEntropyFlag, !kHasStopWaiting,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 3, kEntropyFlag, !kHasStopWaiting,
|
| ENCRYPTION_INITIAL);
|
| }
|
|
|
| -TEST_P(QuicConnectionTest, ProcessBufferedFECGroup) {
|
| - // SetFromConfig is always called after construction from InitializeSession.
|
| - EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
|
| - QuicConfig config;
|
| - config.set_max_undecryptable_packets(100);
|
| - connection_.SetFromConfig(config);
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - use_tagging_decrypter();
|
| -
|
| - const uint8_t tag = 0x07;
|
| - framer_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag));
|
| -
|
| - // Don't send packet 1 and buffer initially encrypted packets.
|
| - ProcessFecProtectedPacketAtLevel(kDefaultPathId, 2, 1, false, !kEntropyFlag,
|
| - !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| - ProcessFecPacketAtLevel(kDefaultPathId, 3, 1, false, kEntropyFlag, nullptr,
|
| - ENCRYPTION_INITIAL);
|
| - // Since the packets were buffered, no FEC group should be open.
|
| - ASSERT_EQ(0u, connection_.NumFecGroups());
|
| -
|
| - // Now send non-fec protected ack packet and close the group.
|
| - QuicStopWaitingFrame frame = InitStopWaitingFrame(4);
|
| - ProcessStopWaitingPacketAtLevel(kDefaultPathId, 4, &frame,
|
| - ENCRYPTION_INITIAL);
|
| -
|
| - // Transition to the new encryption state and process another encrypted packet
|
| - // which should result in the original packets being processed. The missing
|
| - // packet should be revived before the STOP_WAITING packet is processed.
|
| - connection_.SetDecrypter(ENCRYPTION_INITIAL, new StrictTaggingDecrypter(tag));
|
| - connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
|
| - connection_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag));
|
| -
|
| - EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(2).RetiresOnSaturation();
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 5, 0, kEntropyFlag, !kHasStopWaiting,
|
| - ENCRYPTION_INITIAL);
|
| - const QuicConnectionStats& stats = connection_.GetStats();
|
| - EXPECT_EQ(1u, stats.packets_revived);
|
| -}
|
| -
|
| TEST_P(QuicConnectionTest, Buffer100NonDecryptablePackets) {
|
| // SetFromConfig is always called after construction from InitializeSession.
|
| EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
|
| @@ -2943,8 +2658,8 @@ TEST_P(QuicConnectionTest, Buffer100NonDecryptablePackets) {
|
| // Process an encrypted packet which can not yet be decrypted which should
|
| // result in the packet being buffered.
|
| for (QuicPacketNumber i = 1; i <= 100; ++i) {
|
| - ProcessDataPacketAtLevel(kDefaultPathId, i, 0, kEntropyFlag,
|
| - !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| + ProcessDataPacketAtLevel(kDefaultPathId, i, kEntropyFlag, !kHasStopWaiting,
|
| + ENCRYPTION_INITIAL);
|
| }
|
|
|
| // Transition to the new encryption state and process another encrypted packet
|
| @@ -2953,14 +2668,14 @@ TEST_P(QuicConnectionTest, Buffer100NonDecryptablePackets) {
|
| connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
|
| connection_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag));
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(101);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 101, 0, kEntropyFlag,
|
| - !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 101, kEntropyFlag, !kHasStopWaiting,
|
| + ENCRYPTION_INITIAL);
|
|
|
| // Finally, process a third packet and note that we do not reprocess the
|
| // buffered packet.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 102, 0, kEntropyFlag,
|
| - !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 102, kEntropyFlag, !kHasStopWaiting,
|
| + ENCRYPTION_INITIAL);
|
| }
|
|
|
| TEST_P(QuicConnectionTest, TestRetransmitOrder) {
|
| @@ -3056,53 +2771,6 @@ TEST_P(QuicConnectionTest, TestQueued) {
|
| EXPECT_EQ(0u, connection_.NumQueuedPackets());
|
| }
|
|
|
| -TEST_P(QuicConnectionTest, CloseFecGroup) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - // Don't send missing packet 1.
|
| - // Don't send missing packet 2.
|
| - ProcessFecProtectedPacket(kDefaultPathId, 3, false, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - // Don't send missing FEC packet 3.
|
| - ASSERT_EQ(1u, connection_.NumFecGroups());
|
| -
|
| - // Now send non-fec protected ack packet and close the group.
|
| - QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 4);
|
| - QuicStopWaitingFrame frame = InitStopWaitingFrame(5);
|
| - ProcessStopWaitingPacket(&frame);
|
| - ASSERT_EQ(0u, connection_.NumFecGroups());
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest,
|
| - CloseFecGroupUnderStopWaitingAndWaitingForPacketsBelowStopWaiting) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - // Don't send missing packet 1.
|
| - ProcessFecProtectedPacket(kDefaultPathId, 2, false, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - EXPECT_EQ(1u, connection_.NumFecGroups());
|
| - stop_waiting_ = InitStopWaitingFrame(2);
|
| - ProcessFecProtectedPacket(kDefaultPathId, 3, false, !kEntropyFlag,
|
| - kHasStopWaiting);
|
| - // This Fec group would be closed.
|
| - EXPECT_EQ(0u, connection_.NumFecGroups());
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest,
|
| - DoNotCloseFecGroupUnderStopWaitingButNotWaitingForPacketsBelow) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - ProcessFecProtectedPacket(kDefaultPathId, 1, false, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - ProcessFecProtectedPacket(kDefaultPathId, 2, false, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| - // Don't send missing packet 3.
|
| - EXPECT_EQ(1u, connection_.NumFecGroups());
|
| - stop_waiting_ = InitStopWaitingFrame(2);
|
| - ProcessFecProtectedPacket(kDefaultPathId, 3, false, !kEntropyFlag,
|
| - kHasStopWaiting);
|
| - // This group will not be closed because this group is not waiting for packets
|
| - // below stop waiting.
|
| - EXPECT_EQ(1u, connection_.NumFecGroups());
|
| -}
|
| -
|
| TEST_P(QuicConnectionTest, InitialTimeout) {
|
| EXPECT_TRUE(connection_.connected());
|
| EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AnyNumber());
|
| @@ -3668,8 +3336,8 @@ TEST_P(QuicConnectionTest, TimeoutAfterReceiveNotSendWhenUnacked) {
|
|
|
| TEST_P(QuicConnectionTest, SendScheduler) {
|
| // Test that if we send a packet without delay, it is not queued.
|
| - QuicPacket* packet = ConstructDataPacket(kDefaultPathId, 1, 0, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| + QuicPacket* packet =
|
| + ConstructDataPacket(kDefaultPathId, 1, !kEntropyFlag, !kHasStopWaiting);
|
| EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
|
| connection_.SendPacket(ENCRYPTION_NONE, kDefaultPathId, 1, packet,
|
| kTestEntropyHash, HAS_RETRANSMITTABLE_DATA, false,
|
| @@ -3681,8 +3349,8 @@ TEST_P(QuicConnectionTest, FailToSendFirstPacket) {
|
| // Test that the connection does not crash when it fails to send the first
|
| // packet at which point self_address_ might be uninitialized.
|
| EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(1);
|
| - QuicPacket* packet = ConstructDataPacket(kDefaultPathId, 1, 0, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| + QuicPacket* packet =
|
| + ConstructDataPacket(kDefaultPathId, 1, !kEntropyFlag, !kHasStopWaiting);
|
| writer_->SetShouldWriteFail();
|
| connection_.SendPacket(ENCRYPTION_NONE, kDefaultPathId, 1, packet,
|
| kTestEntropyHash, HAS_RETRANSMITTABLE_DATA, false,
|
| @@ -3690,8 +3358,8 @@ TEST_P(QuicConnectionTest, FailToSendFirstPacket) {
|
| }
|
|
|
| TEST_P(QuicConnectionTest, SendSchedulerEAGAIN) {
|
| - QuicPacket* packet = ConstructDataPacket(kDefaultPathId, 1, 0, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| + QuicPacket* packet =
|
| + ConstructDataPacket(kDefaultPathId, 1, !kEntropyFlag, !kHasStopWaiting);
|
| BlockOnNextWrite();
|
| EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 1, _, _)).Times(0);
|
| connection_.SendPacket(ENCRYPTION_NONE, kDefaultPathId, 1, packet,
|
| @@ -3705,8 +3373,7 @@ TEST_P(QuicConnectionTest, TestQueueLimitsOnSendStreamData) {
|
| size_t payload_length;
|
| size_t length = GetPacketLengthForOneStream(
|
| connection_.version(), kIncludeVersion, !kIncludePathId,
|
| - PACKET_8BYTE_CONNECTION_ID, PACKET_1BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP,
|
| - &payload_length);
|
| + PACKET_8BYTE_CONNECTION_ID, PACKET_1BYTE_PACKET_NUMBER, &payload_length);
|
| connection_.SetMaxPacketLength(length);
|
|
|
| // Queue the first packet.
|
| @@ -3727,11 +3394,10 @@ TEST_P(QuicConnectionTest, LoopThroughSendingPackets) {
|
| // offset 0, and 2 for non-zero offsets up through 16K. Increase
|
| // max_packet_length by 2 so that subsequent packets containing subsequent
|
| // stream frames with non-zero offets will fit within the packet length.
|
| - size_t length =
|
| - 2 + GetPacketLengthForOneStream(
|
| - connection_.version(), kIncludeVersion, !kIncludePathId,
|
| - PACKET_8BYTE_CONNECTION_ID, PACKET_1BYTE_PACKET_NUMBER,
|
| - NOT_IN_FEC_GROUP, &payload_length);
|
| + size_t length = 2 + GetPacketLengthForOneStream(
|
| + connection_.version(), kIncludeVersion,
|
| + !kIncludePathId, PACKET_8BYTE_CONNECTION_ID,
|
| + PACKET_1BYTE_PACKET_NUMBER, &payload_length);
|
| connection_.SetMaxPacketLength(length);
|
|
|
| // Queue the first packet.
|
| @@ -3804,8 +3470,8 @@ TEST_P(QuicConnectionTest, SendDelayedAck) {
|
| // The same as ProcessPacket(1) except that ENCRYPTION_INITIAL is used
|
| // instead of ENCRYPTION_NONE.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 1, 0, !kEntropyFlag,
|
| - !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 1, !kEntropyFlag, !kHasStopWaiting,
|
| + ENCRYPTION_INITIAL);
|
|
|
| // Check if delayed ack timer is running for the expected interval.
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| @@ -3842,15 +3508,15 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimation) {
|
| QuicPacketNumber kFirstDecimatedPacket = 101;
|
| for (unsigned int i = 0; i < kFirstDecimatedPacket - 1; ++i) {
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 1 + i, 0, !kEntropyFlag,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 1 + i, !kEntropyFlag,
|
| !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| }
|
| EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
|
| // The same as ProcessPacket(1) except that ENCRYPTION_INITIAL is used
|
| // instead of ENCRYPTION_NONE.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket, 0,
|
| - !kEntropyFlag, !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket, !kEntropyFlag,
|
| + !kHasStopWaiting, ENCRYPTION_INITIAL);
|
|
|
| // Check if delayed ack timer is running for the expected interval.
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| @@ -3860,7 +3526,7 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimation) {
|
| for (int i = 0; i < 9; ++i) {
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 1 + i, 0,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 1 + i,
|
| !kEntropyFlag, !kHasStopWaiting,
|
| ENCRYPTION_INITIAL);
|
| }
|
| @@ -3896,15 +3562,15 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithReordering) {
|
| QuicPacketNumber kFirstDecimatedPacket = 101;
|
| for (unsigned int i = 0; i < kFirstDecimatedPacket - 1; ++i) {
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 1 + i, 0, !kEntropyFlag,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 1 + i, !kEntropyFlag,
|
| !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| }
|
| EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
|
| // The same as ProcessPacket(1) except that ENCRYPTION_INITIAL is used
|
| // instead of ENCRYPTION_NONE.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket, 0,
|
| - !kEntropyFlag, !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket, !kEntropyFlag,
|
| + !kHasStopWaiting, ENCRYPTION_INITIAL);
|
|
|
| // Check if delayed ack timer is running for the expected interval.
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| @@ -3912,7 +3578,7 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithReordering) {
|
|
|
| // Process packet 10 first and ensure the alarm is one eighth min_rtt.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 9, 0,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 9,
|
| !kEntropyFlag, !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| ack_time = clock_.ApproximateNow().Add(QuicTime::Delta::FromMilliseconds(5));
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| @@ -3922,7 +3588,7 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithReordering) {
|
| for (int i = 0; i < 8; ++i) {
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 1 + i, 0,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 1 + i,
|
| !kEntropyFlag, !kHasStopWaiting,
|
| ENCRYPTION_INITIAL);
|
| }
|
| @@ -3958,15 +3624,15 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithLargeReordering) {
|
| QuicPacketNumber kFirstDecimatedPacket = 101;
|
| for (unsigned int i = 0; i < kFirstDecimatedPacket - 1; ++i) {
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, 1 + i, 0, !kEntropyFlag,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, 1 + i, !kEntropyFlag,
|
| !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| }
|
| EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
|
| // The same as ProcessPacket(1) except that ENCRYPTION_INITIAL is used
|
| // instead of ENCRYPTION_NONE.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket, 0,
|
| - !kEntropyFlag, !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket, !kEntropyFlag,
|
| + !kHasStopWaiting, ENCRYPTION_INITIAL);
|
|
|
| // Check if delayed ack timer is running for the expected interval.
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| @@ -3974,7 +3640,7 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithLargeReordering) {
|
|
|
| // Process packet 10 first and ensure the alarm is one eighth min_rtt.
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 19, 0,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 19,
|
| !kEntropyFlag, !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| ack_time = clock_.ApproximateNow().Add(QuicTime::Delta::FromMilliseconds(5));
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| @@ -3984,7 +3650,7 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithLargeReordering) {
|
| for (int i = 0; i < 8; ++i) {
|
| EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 1 + i, 0,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 1 + i,
|
| !kEntropyFlag, !kHasStopWaiting,
|
| ENCRYPTION_INITIAL);
|
| }
|
| @@ -3998,7 +3664,7 @@ TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithLargeReordering) {
|
| // because it fills a hole.
|
| EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
|
| - ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 10, 0,
|
| + ProcessDataPacketAtLevel(kDefaultPathId, kFirstDecimatedPacket + 10,
|
| !kEntropyFlag, !kHasStopWaiting, ENCRYPTION_INITIAL);
|
| // Check that ack is sent and that delayed ack alarm is reset.
|
| EXPECT_EQ(2u, writer_->frame_count());
|
| @@ -4178,7 +3844,7 @@ TEST_P(QuicConnectionTest, NoAckSentForClose) {
|
| EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PEER_GOING_AWAY,
|
| ConnectionCloseSource::FROM_PEER));
|
| EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
|
| - ProcessClosePacket(kDefaultPathId, 2, 0);
|
| + ProcessClosePacket(kDefaultPathId, 2);
|
| }
|
|
|
| TEST_P(QuicConnectionTest, SendWhenDisconnected) {
|
| @@ -4189,8 +3855,8 @@ TEST_P(QuicConnectionTest, SendWhenDisconnected) {
|
| ConnectionCloseSource::FROM_SELF);
|
| EXPECT_FALSE(connection_.connected());
|
| EXPECT_FALSE(connection_.CanWriteStreamData());
|
| - QuicPacket* packet = ConstructDataPacket(kDefaultPathId, 1, 0, !kEntropyFlag,
|
| - !kHasStopWaiting);
|
| + QuicPacket* packet =
|
| + ConstructDataPacket(kDefaultPathId, 1, !kEntropyFlag, !kHasStopWaiting);
|
| EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 1, _, _)).Times(0);
|
| connection_.SendPacket(ENCRYPTION_NONE, kDefaultPathId, 1, packet,
|
| kTestEntropyHash, HAS_RETRANSMITTABLE_DATA, false,
|
| @@ -4268,30 +3934,19 @@ TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) {
|
| TEST_P(QuicConnectionTest, ReceivedEntropyHashCalculation) {
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AtLeast(1));
|
| EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - ProcessDataPacket(kDefaultPathId, 1, 1, kEntropyFlag);
|
| - ProcessDataPacket(kDefaultPathId, 4, 1, kEntropyFlag);
|
| - ProcessDataPacket(kDefaultPathId, 3, 1, !kEntropyFlag);
|
| - ProcessDataPacket(kDefaultPathId, 7, 1, kEntropyFlag);
|
| - EXPECT_EQ(146u, outgoing_ack()->entropy_hash);
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest, ReceivedEntropyHashCalculationHalfFEC) {
|
| - // FEC packets should not change the entropy hash calculation.
|
| - EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AtLeast(1));
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - ProcessDataPacket(kDefaultPathId, 1, 1, kEntropyFlag);
|
| - ProcessFecPacket(kDefaultPathId, 4, 1, false, kEntropyFlag, nullptr);
|
| - ProcessDataPacket(kDefaultPathId, 3, 3, !kEntropyFlag);
|
| - ProcessFecPacket(kDefaultPathId, 7, 3, false, kEntropyFlag, nullptr);
|
| + ProcessDataPacket(kDefaultPathId, 1, kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 4, kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 3, !kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 7, kEntropyFlag);
|
| EXPECT_EQ(146u, outgoing_ack()->entropy_hash);
|
| }
|
|
|
| TEST_P(QuicConnectionTest, UpdateEntropyForReceivedPackets) {
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AtLeast(1));
|
| EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - ProcessDataPacket(kDefaultPathId, 1, 1, kEntropyFlag);
|
| - ProcessDataPacket(kDefaultPathId, 5, 1, kEntropyFlag);
|
| - ProcessDataPacket(kDefaultPathId, 4, 1, !kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 1, kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 5, kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 4, !kEntropyFlag);
|
| EXPECT_EQ(34u, outgoing_ack()->entropy_hash);
|
| // Make 4th packet my least unacked, and update entropy for 2, 3 packets.
|
| QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5);
|
| @@ -4310,9 +3965,9 @@ TEST_P(QuicConnectionTest, UpdateEntropyForReceivedPackets) {
|
| TEST_P(QuicConnectionTest, UpdateEntropyHashUptoCurrentPacket) {
|
| EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AtLeast(1));
|
| EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - ProcessDataPacket(kDefaultPathId, 1, 1, kEntropyFlag);
|
| - ProcessDataPacket(kDefaultPathId, 5, 1, !kEntropyFlag);
|
| - ProcessDataPacket(kDefaultPathId, 22, 1, kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 1, kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 5, !kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 22, kEntropyFlag);
|
| EXPECT_EQ(66u, outgoing_ack()->entropy_hash);
|
| QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 22);
|
| QuicPacketEntropyHash random_entropy_hash = 85u;
|
| @@ -4323,7 +3978,7 @@ TEST_P(QuicConnectionTest, UpdateEntropyHashUptoCurrentPacket) {
|
| ack_entropy_hash = ProcessStopWaitingPacket(&frame);
|
| EXPECT_EQ((random_entropy_hash + ack_entropy_hash),
|
| outgoing_ack()->entropy_hash);
|
| - ProcessDataPacket(kDefaultPathId, 25, 1, kEntropyFlag);
|
| + ProcessDataPacket(kDefaultPathId, 25, kEntropyFlag);
|
| EXPECT_EQ((random_entropy_hash + ack_entropy_hash + (1 << (25 % 8))),
|
| outgoing_ack()->entropy_hash);
|
| }
|
| @@ -4345,7 +4000,7 @@ TEST_P(QuicConnectionTest, EntropyCalculationForTruncatedAck) {
|
| } else {
|
| entropy[i] = entropy[i - 1];
|
| }
|
| - ProcessDataPacket(kDefaultPathId, i, 1, entropy_flag);
|
| + ProcessDataPacket(kDefaultPathId, i, entropy_flag);
|
| }
|
| for (int i = 1; i < 50; ++i) {
|
| EXPECT_EQ(entropy[i],
|
| @@ -4549,52 +4204,6 @@ TEST_P(QuicConnectionTest, CheckSendStats) {
|
| EXPECT_EQ(kDefaultMaxPacketSize, stats.max_packet_size);
|
| }
|
|
|
| -TEST_P(QuicConnectionTest, CheckReceiveStats) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| -
|
| - size_t received_bytes = 0;
|
| - received_bytes += ProcessFecProtectedPacket(kDefaultPathId, 1, false,
|
| - !kEntropyFlag, !kHasStopWaiting);
|
| - received_bytes += ProcessFecProtectedPacket(kDefaultPathId, 3, false,
|
| - !kEntropyFlag, !kHasStopWaiting);
|
| - // Should be counted against dropped packets.
|
| - received_bytes += ProcessDataPacket(kDefaultPathId, 3, 1, !kEntropyFlag);
|
| - received_bytes +=
|
| - ProcessFecPacket(kDefaultPathId, 4, 1, true, !kEntropyFlag, nullptr);
|
| -
|
| - EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
|
| - .WillOnce(Return(QuicBandwidth::Zero()));
|
| -
|
| - const QuicConnectionStats& stats = connection_.GetStats();
|
| - EXPECT_EQ(received_bytes, stats.bytes_received);
|
| - EXPECT_EQ(4u, stats.packets_received);
|
| -
|
| - EXPECT_EQ(1u, stats.packets_revived);
|
| - EXPECT_EQ(1u, stats.packets_dropped);
|
| -}
|
| -
|
| -TEST_P(QuicConnectionTest, TestFecGroupLimits) {
|
| - // Create and return a group for 1.
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 1) != nullptr);
|
| -
|
| - // Create and return a group for 2.
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 2) != nullptr);
|
| -
|
| - // Create and return a group for 4. This should remove 1 but not 2.
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 4) != nullptr);
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 1) == nullptr);
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 2) != nullptr);
|
| -
|
| - // Create and return a group for 3. This will kill off 2.
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 3) != nullptr);
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 2) == nullptr);
|
| -
|
| - // Verify that adding 5 kills off 3, despite 4 being created before 3.
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 5) != nullptr);
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 4) != nullptr);
|
| - ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 3) == nullptr);
|
| -}
|
| -
|
| TEST_P(QuicConnectionTest, ProcessFramesIfPacketClosedConnection) {
|
| // Construct a packet with stream frame and connection close frame.
|
| QuicPacketHeader header;
|
| @@ -4857,47 +4466,6 @@ TEST_P(QuicConnectionTest, AckNotifierFECTriggerCallback) {
|
| ProcessAckPacket(&frame);
|
| }
|
|
|
| -TEST_P(QuicConnectionTest, AckNotifierCallbackAfterFECRecovery) {
|
| - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| - EXPECT_CALL(visitor_, OnCanWrite());
|
| -
|
| - // Create a listener which we expect to be called.
|
| - scoped_refptr<MockAckListener> listener(new MockAckListener);
|
| - EXPECT_CALL(*listener, OnPacketAcked(_, _)).Times(1);
|
| -
|
| - // Expect ACKs for 1 packet.
|
| - EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
|
| -
|
| - // Send one packet, and register to be notified on ACK.
|
| - connection_.SendStreamDataWithString(1, "foo", 0, !kFin, listener.get());
|
| -
|
| - // Ack packet gets dropped, but we receive an FEC packet that covers it.
|
| - // Should recover the Ack packet and trigger the notification callback.
|
| - QuicFrames frames;
|
| -
|
| - QuicAckFrame ack_frame = InitAckFrame(1);
|
| - frames.push_back(QuicFrame(&ack_frame));
|
| -
|
| - // Dummy stream frame to satisfy expectations set elsewhere.
|
| - frames.push_back(QuicFrame(&frame1_));
|
| -
|
| - QuicPacketHeader ack_header;
|
| - ack_header.public_header.connection_id = connection_id_;
|
| - ack_header.public_header.reset_flag = false;
|
| - ack_header.public_header.version_flag = false;
|
| - ack_header.entropy_flag = !kEntropyFlag;
|
| - ack_header.fec_flag = true;
|
| - ack_header.packet_number = 1;
|
| - ack_header.is_in_fec_group = IN_FEC_GROUP;
|
| - ack_header.fec_group = 1;
|
| -
|
| - QuicPacket* packet = BuildUnsizedDataPacket(&framer_, ack_header, frames);
|
| -
|
| - // Take the packet which contains the ACK frame, and construct and deliver an
|
| - // FEC packet which allows the ACK packet to be recovered.
|
| - ProcessFecPacket(kDefaultPathId, 2, 1, true, !kEntropyFlag, packet);
|
| -}
|
| -
|
| TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) {
|
| QuicPacketHeader header;
|
|
|
|
|