| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <map> | 6 #include <map> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 // but large numbers should not (even if they're out of order). | 341 // but large numbers should not (even if they're out of order). |
| 342 for (uint64 j = 0; j < 10; j++) { | 342 for (uint64 j = 0; j < 10; j++) { |
| 343 uint64 num = kEpoch - 1 - j; | 343 uint64 num = kEpoch - 1 - j; |
| 344 CheckCalculatePacketSequenceNumber(cur_epoch + num, last); | 344 CheckCalculatePacketSequenceNumber(cur_epoch + num, last); |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 | 348 |
| 349 TEST_F(QuicFramerTest, CalculatePacketSequenceNumberFromWireNearNextMax) { | 349 TEST_F(QuicFramerTest, CalculatePacketSequenceNumberFromWireNearNextMax) { |
| 350 const uint64 max_number = std::numeric_limits<uint64>::max(); | 350 const uint64 max_number = numeric_limits<uint64>::max(); |
| 351 const uint64 max_epoch = max_number & ~kMask; | 351 const uint64 max_epoch = max_number & ~kMask; |
| 352 | 352 |
| 353 // Cases where the last number was close to the end of the range | 353 // Cases where the last number was close to the end of the range |
| 354 for (uint64 i = 0; i < 10; i++) { | 354 for (uint64 i = 0; i < 10; i++) { |
| 355 QuicPacketSequenceNumber last = max_number - i; | 355 QuicPacketSequenceNumber last = max_number - i; |
| 356 | 356 |
| 357 // Small numbers should not wrap (because they have nowhere to go. | 357 // Small numbers should not wrap (because they have nowhere to go. |
| 358 for (uint64 j = 0; j < 10; j++) { | 358 for (uint64 j = 0; j < 10; j++) { |
| 359 CheckCalculatePacketSequenceNumber(max_epoch + j, last); | 359 CheckCalculatePacketSequenceNumber(max_epoch + j, last); |
| 360 } | 360 } |
| (...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2020 | 2020 |
| 2021 original_raw_length = raw_close_packet->length(); | 2021 original_raw_length = raw_close_packet->length(); |
| 2022 raw_close_packet.reset( | 2022 raw_close_packet.reset( |
| 2023 framer_.ConstructFrameDataPacket(header, frames)); | 2023 framer_.ConstructFrameDataPacket(header, frames)); |
| 2024 ASSERT_TRUE(raw_ack_packet != NULL); | 2024 ASSERT_TRUE(raw_ack_packet != NULL); |
| 2025 EXPECT_EQ(original_raw_length, raw_close_packet->length()); | 2025 EXPECT_EQ(original_raw_length, raw_close_packet->length()); |
| 2026 } | 2026 } |
| 2027 | 2027 |
| 2028 } // namespace test | 2028 } // namespace test |
| 2029 } // namespace net | 2029 } // namespace net |
| OLD | NEW |