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

Unified Diff: net/quic/quic_sent_entropy_manager_test.cc

Issue 479543004: Convert QUIC's SentEntropyManager to use a deque instead of a map in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@send_updated_bandwidth_estimates_73579021
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/test_tools/quic_connection_peer.cc » ('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 3648bf3b7495c2775505474134ecaa0ba6f4ae53..78bdcce8a2bdf5f4e014b8668374dbb34ff2debc 100644
--- a/net/quic/quic_sent_entropy_manager_test.cc
+++ b/net/quic/quic_sent_entropy_manager_test.cc
@@ -24,30 +24,24 @@ class QuicSentEntropyManagerTest : public ::testing::Test {
};
TEST_F(QuicSentEntropyManagerTest, SentEntropyHash) {
- EXPECT_EQ(0, entropy_manager_.EntropyHash(0));
+ EXPECT_EQ(0, entropy_manager_.GetCumulativeEntropy(0));
- vector<pair<QuicPacketSequenceNumber, QuicPacketEntropyHash> > entropies;
- entropies.push_back(make_pair(1, 12));
- entropies.push_back(make_pair(2, 1));
- entropies.push_back(make_pair(3, 33));
- entropies.push_back(make_pair(4, 3));
-
- for (size_t i = 0; i < entropies.size(); ++i) {
- entropy_manager_.RecordPacketEntropyHash(entropies[i].first,
- entropies[i].second);
+ QuicPacketEntropyHash entropies[4] = {12, 1, 33, 3};
+ for (size_t i = 0; i < arraysize(entropies); ++i) {
+ entropy_manager_.RecordPacketEntropyHash(i + 1, entropies[i]);
}
QuicPacketEntropyHash hash = 0;
- for (size_t i = 0; i < entropies.size(); ++i) {
- hash ^= entropies[i].second;
- EXPECT_EQ(hash, entropy_manager_.EntropyHash(i + 1));
+ for (size_t i = 0; i < arraysize(entropies); ++i) {
+ hash ^= entropies[i];
+ EXPECT_EQ(hash, entropy_manager_.GetCumulativeEntropy(i + 1));
}
}
TEST_F(QuicSentEntropyManagerTest, IsValidEntropy) {
QuicPacketEntropyHash entropies[10] =
{12, 1, 33, 3, 32, 100, 28, 42, 22, 255};
- for (size_t i = 0; i < 10; ++i) {
+ for (size_t i = 0; i < arraysize(entropies); ++i) {
entropy_manager_.RecordPacketEntropyHash(i + 1, entropies[i]);
}
@@ -58,7 +52,7 @@ TEST_F(QuicSentEntropyManagerTest, IsValidEntropy) {
missing_packets.insert(8);
QuicPacketEntropyHash entropy_hash = 0;
- for (size_t i = 0; i < 10; ++i) {
+ for (size_t i = 0; i < arraysize(entropies); ++i) {
if (missing_packets.find(i + 1) == missing_packets.end()) {
entropy_hash ^= entropies[i];
}
@@ -72,7 +66,7 @@ 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) {
+ for (size_t i = 0; i < arraysize(entropies); ++i) {
entropy_manager_.RecordPacketEntropyHash(i + 1, entropies[i]);
}
@@ -85,7 +79,7 @@ TEST_F(QuicSentEntropyManagerTest, ClearEntropiesBefore) {
missing_packets.insert(8);
QuicPacketEntropyHash entropy_hash = 0;
- for (size_t i = 0; i < 10; ++i) {
+ for (size_t i = 0; i < arraysize(entropies); ++i) {
if (missing_packets.find(i + 1) == missing_packets.end()) {
entropy_hash ^= entropies[i];
}
@@ -94,10 +88,10 @@ TEST_F(QuicSentEntropyManagerTest, ClearEntropiesBefore) {
entropy_hash));
entropy_hash = 0;
- for (size_t i = 0; i < 10; ++i) {
+ for (size_t i = 0; i < arraysize(entropies); ++i) {
entropy_hash ^= entropies[i];
}
- EXPECT_EQ(entropy_hash, entropy_manager_.EntropyHash(10));
+ EXPECT_EQ(entropy_hash, entropy_manager_.GetCumulativeEntropy(10));
}
} // namespace
« no previous file with comments | « net/quic/quic_sent_entropy_manager.cc ('k') | net/quic/test_tools/quic_connection_peer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698