Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Unified Diff: net/quic/quic_connection_test.cc

Issue 476023002: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0814_2
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_connection_helper_test.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 13f97bf436c9a65226141596283009b101f8fe5b..db62ef4b9ee2fc62d35248ac1d635b5dbbcfb1d4 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -904,15 +904,12 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
frame.least_unacked = least_unacked;
return frame;
}
+
// Explicitly nack a packet.
void NackPacket(QuicPacketSequenceNumber missing, QuicAckFrame* frame) {
frame->missing_packets.insert(missing);
frame->entropy_hash ^=
- QuicConnectionPeer::GetSentEntropyHash(&connection_, missing);
- if (missing > 1) {
- frame->entropy_hash ^=
- QuicConnectionPeer::GetSentEntropyHash(&connection_, missing - 1);
- }
+ QuicConnectionPeer::PacketEntropy(&connection_, missing);
}
// Undo nacking a packet within the frame.
@@ -920,11 +917,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
EXPECT_THAT(frame->missing_packets, Contains(arrived));
frame->missing_packets.erase(arrived);
frame->entropy_hash ^=
- QuicConnectionPeer::GetSentEntropyHash(&connection_, arrived);
- if (arrived > 1) {
- frame->entropy_hash ^=
- QuicConnectionPeer::GetSentEntropyHash(&connection_, arrived - 1);
- }
+ QuicConnectionPeer::PacketEntropy(&connection_, arrived);
}
void TriggerConnectionClose() {
@@ -2639,7 +2632,10 @@ TEST_P(QuicConnectionTest, PingAfterSend) {
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
ProcessAckPacket(&frame);
EXPECT_TRUE(connection_.GetPingAlarm()->IsSet());
- EXPECT_EQ(clock_.ApproximateNow().Add(QuicTime::Delta::FromSeconds(15)),
+ // The ping timer is set slightly less than 15 seconds in the future, because
+ // of the 1s ping timer alarm granularity.
+ EXPECT_EQ(clock_.ApproximateNow().Add(QuicTime::Delta::FromSeconds(15))
+ .Subtract(QuicTime::Delta::FromMilliseconds(5)),
connection_.GetPingAlarm()->deadline());
writer_->Reset();
@@ -3246,35 +3242,6 @@ TEST_P(QuicConnectionTest, EntropyCalculationForTruncatedAck) {
}
}
-TEST_P(QuicConnectionTest, CheckSentEntropyHash) {
- peer_creator_.set_sequence_number(1);
- SequenceNumberSet missing_packets;
- QuicPacketEntropyHash entropy_hash = 0;
- QuicPacketSequenceNumber max_sequence_number = 51;
- for (QuicPacketSequenceNumber i = 1; i <= max_sequence_number; ++i) {
- bool is_missing = i % 10 != 0;
- bool entropy_flag = (i & (i - 1)) != 0;
- QuicPacketEntropyHash packet_entropy_hash = 0;
- if (entropy_flag) {
- packet_entropy_hash = 1 << (i % 8);
- }
- QuicPacket* packet = ConstructDataPacket(i, 0, entropy_flag);
- connection_.SendPacket(
- ENCRYPTION_NONE, i, packet, packet_entropy_hash,
- HAS_RETRANSMITTABLE_DATA);
-
- if (is_missing) {
- missing_packets.insert(i);
- continue;
- }
-
- entropy_hash ^= packet_entropy_hash;
- }
- EXPECT_TRUE(QuicConnectionPeer::IsValidEntropy(
- &connection_, max_sequence_number, missing_packets, entropy_hash))
- << "";
-}
-
TEST_P(QuicConnectionTest, ServerSendsVersionNegotiationPacket) {
connection_.SetSupportedVersions(QuicSupportedVersions());
framer_.set_version_for_tests(QUIC_VERSION_UNSUPPORTED);
« no previous file with comments | « net/quic/quic_connection_helper_test.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698