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

Unified Diff: net/quic/quic_sent_entropy_manager_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_sent_entropy_manager.cc ('k') | net/quic/quic_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_sent_entropy_manager_test.cc
diff --git a/net/quic/quic_sent_entropy_manager_test.cc b/net/quic/quic_sent_entropy_manager_test.cc
index e4e9847b516dc62bb8796aa0828343b12d3f1f43..3648bf3b7495c2775505474134ecaa0ba6f4ae53 100644
--- a/net/quic/quic_sent_entropy_manager_test.cc
+++ b/net/quic/quic_sent_entropy_manager_test.cc
@@ -68,6 +68,38 @@ TEST_F(QuicSentEntropyManagerTest, IsValidEntropy) {
entropy_hash));
}
+TEST_F(QuicSentEntropyManagerTest, ClearEntropiesBefore) {
+ QuicPacketEntropyHash entropies[10] =
+ {12, 1, 33, 3, 32, 100, 28, 42, 22, 255};
+
+ for (size_t i = 0; i < 10; ++i) {
+ entropy_manager_.RecordPacketEntropyHash(i + 1, entropies[i]);
+ }
+
+ // Discard the first 5 entropies and ensure IsValidEntropy and EntropyHash
+ // still return correct results.
+ entropy_manager_.ClearEntropyBefore(5);
+
+ SequenceNumberSet missing_packets;
+ missing_packets.insert(7);
+ missing_packets.insert(8);
+
+ QuicPacketEntropyHash entropy_hash = 0;
+ for (size_t i = 0; i < 10; ++i) {
+ if (missing_packets.find(i + 1) == missing_packets.end()) {
+ entropy_hash ^= entropies[i];
+ }
+ }
+ EXPECT_TRUE(entropy_manager_.IsValidEntropy(10, missing_packets,
+ entropy_hash));
+
+ entropy_hash = 0;
+ for (size_t i = 0; i < 10; ++i) {
+ entropy_hash ^= entropies[i];
+ }
+ EXPECT_EQ(entropy_hash, entropy_manager_.EntropyHash(10));
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_sent_entropy_manager.cc ('k') | net/quic/quic_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698