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

Side by Side Diff: net/quic/core/quic_received_packet_manager_test.cc

Issue 2464683002: adds std:: to stl types (#049) (Closed)
Patch Set: remove dead using std::foo declarations. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_received_packet_manager.cc ('k') | net/quic/core/quic_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/core/quic_received_packet_manager.h" 5 #include "net/quic/core/quic_received_packet_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "net/quic/core/quic_connection_stats.h" 10 #include "net/quic/core/quic_connection_stats.h"
11 #include "net/quic/core/quic_flags.h" 11 #include "net/quic/core/quic_flags.h"
12 #include "net/quic/test_tools/quic_received_packet_manager_peer.h" 12 #include "net/quic/test_tools/quic_received_packet_manager_peer.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 using std::pair;
17 using std::vector;
18
19 namespace net { 16 namespace net {
20 namespace test { 17 namespace test {
21 18
22 class EntropyTrackerPeer { 19 class EntropyTrackerPeer {
23 public: 20 public:
24 static QuicPacketNumber first_gap( 21 static QuicPacketNumber first_gap(
25 const QuicReceivedPacketManager::EntropyTracker& tracker) { 22 const QuicReceivedPacketManager::EntropyTracker& tracker) {
26 return tracker.first_gap_; 23 return tracker.first_gap_;
27 } 24 }
28 static QuicPacketNumber largest_observed( 25 static QuicPacketNumber largest_observed(
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 explicit TestParams(QuicVersion version) : version(version) {} 187 explicit TestParams(QuicVersion version) : version(version) {}
191 188
192 friend std::ostream& operator<<(std::ostream& os, const TestParams& p) { 189 friend std::ostream& operator<<(std::ostream& os, const TestParams& p) {
193 os << "{ version: " << QuicVersionToString(p.version) << " }"; 190 os << "{ version: " << QuicVersionToString(p.version) << " }";
194 return os; 191 return os;
195 } 192 }
196 193
197 QuicVersion version; 194 QuicVersion version;
198 }; 195 };
199 196
200 vector<TestParams> GetTestParams() { 197 std::vector<TestParams> GetTestParams() {
201 vector<TestParams> params; 198 std::vector<TestParams> params;
202 QuicVersionVector all_supported_versions = AllSupportedVersions(); 199 QuicVersionVector all_supported_versions = AllSupportedVersions();
203 for (size_t i = 0; i < all_supported_versions.size(); ++i) { 200 for (size_t i = 0; i < all_supported_versions.size(); ++i) {
204 params.push_back(TestParams(all_supported_versions[i])); 201 params.push_back(TestParams(all_supported_versions[i]));
205 } 202 }
206 return params; 203 return params;
207 } 204 }
208 205
209 class QuicReceivedPacketManagerTest 206 class QuicReceivedPacketManagerTest
210 : public ::testing::TestWithParam<TestParams> { 207 : public ::testing::TestWithParam<TestParams> {
211 protected: 208 protected:
(...skipping 20 matching lines...) Expand all
232 }; 229 };
233 230
234 INSTANTIATE_TEST_CASE_P(QuicReceivedPacketManagerTest, 231 INSTANTIATE_TEST_CASE_P(QuicReceivedPacketManagerTest,
235 QuicReceivedPacketManagerTest, 232 QuicReceivedPacketManagerTest,
236 ::testing::ValuesIn(GetTestParams())); 233 ::testing::ValuesIn(GetTestParams()));
237 234
238 TEST_P(QuicReceivedPacketManagerTest, ReceivedPacketEntropyHash) { 235 TEST_P(QuicReceivedPacketManagerTest, ReceivedPacketEntropyHash) {
239 if (GetParam().version > QUIC_VERSION_33) { 236 if (GetParam().version > QUIC_VERSION_33) {
240 return; 237 return;
241 } 238 }
242 vector<pair<QuicPacketNumber, QuicPacketEntropyHash>> entropies; 239 std::vector<std::pair<QuicPacketNumber, QuicPacketEntropyHash>> entropies;
243 entropies.push_back(std::make_pair(1, 12)); 240 entropies.push_back(std::make_pair(1, 12));
244 entropies.push_back(std::make_pair(7, 1)); 241 entropies.push_back(std::make_pair(7, 1));
245 entropies.push_back(std::make_pair(2, 33)); 242 entropies.push_back(std::make_pair(2, 33));
246 entropies.push_back(std::make_pair(5, 3)); 243 entropies.push_back(std::make_pair(5, 3));
247 entropies.push_back(std::make_pair(8, 34)); 244 entropies.push_back(std::make_pair(8, 34));
248 245
249 for (size_t i = 0; i < entropies.size(); ++i) { 246 for (size_t i = 0; i < entropies.size(); ++i) {
250 RecordPacketReceipt(entropies[i].first, entropies[i].second); 247 RecordPacketReceipt(entropies[i].first, entropies[i].second);
251 } 248 }
252 249
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 281 }
285 EXPECT_EQ(0, received_manager_.EntropyHash(0)); 282 EXPECT_EQ(0, received_manager_.EntropyHash(0));
286 RecordPacketReceipt(4, 5); 283 RecordPacketReceipt(4, 5);
287 EXPECT_EQ(0, received_manager_.EntropyHash(3)); 284 EXPECT_EQ(0, received_manager_.EntropyHash(3));
288 } 285 }
289 286
290 TEST_P(QuicReceivedPacketManagerTest, SetCumulativeEntropyUpTo) { 287 TEST_P(QuicReceivedPacketManagerTest, SetCumulativeEntropyUpTo) {
291 if (GetParam().version > QUIC_VERSION_33) { 288 if (GetParam().version > QUIC_VERSION_33) {
292 return; 289 return;
293 } 290 }
294 vector<pair<QuicPacketNumber, QuicPacketEntropyHash>> entropies; 291 std::vector<std::pair<QuicPacketNumber, QuicPacketEntropyHash>> entropies;
295 entropies.push_back(std::make_pair(1, 12)); 292 entropies.push_back(std::make_pair(1, 12));
296 entropies.push_back(std::make_pair(2, 1)); 293 entropies.push_back(std::make_pair(2, 1));
297 entropies.push_back(std::make_pair(3, 33)); 294 entropies.push_back(std::make_pair(3, 33));
298 entropies.push_back(std::make_pair(4, 3)); 295 entropies.push_back(std::make_pair(4, 3));
299 entropies.push_back(std::make_pair(6, 34)); 296 entropies.push_back(std::make_pair(6, 34));
300 entropies.push_back(std::make_pair(7, 29)); 297 entropies.push_back(std::make_pair(7, 29));
301 298
302 QuicPacketEntropyHash entropy_hash = 0; 299 QuicPacketEntropyHash entropy_hash = 0;
303 for (size_t i = 0; i < entropies.size(); ++i) { 300 for (size_t i = 0; i < entropies.size(); ++i) {
304 RecordPacketReceipt(entropies[i].first, entropies[i].second); 301 RecordPacketReceipt(entropies[i].first, entropies[i].second);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 QuicTime::Zero() + QuicTime::Delta::FromMilliseconds(1)); 384 QuicTime::Zero() + QuicTime::Delta::FromMilliseconds(1));
388 385
389 EXPECT_EQ(4u, stats_.max_sequence_reordering); 386 EXPECT_EQ(4u, stats_.max_sequence_reordering);
390 EXPECT_EQ(1000, stats_.max_time_reordering_us); 387 EXPECT_EQ(1000, stats_.max_time_reordering_us);
391 EXPECT_EQ(1u, stats_.packets_reordered); 388 EXPECT_EQ(1u, stats_.packets_reordered);
392 } 389 }
393 390
394 } // namespace 391 } // namespace
395 } // namespace test 392 } // namespace test
396 } // namespace net 393 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_received_packet_manager.cc ('k') | net/quic/core/quic_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698