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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/port.h" | 13 #include "base/port.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "net/quic/quic_framer.h" | 15 #include "net/quic/quic_framer.h" |
16 #include "net/quic/quic_protocol.h" | 16 #include "net/quic/quic_protocol.h" |
17 #include "net/quic/quic_utils.h" | 17 #include "net/quic/quic_utils.h" |
18 #include "net/quic/test_tools/quic_test_utils.h" | 18 #include "net/quic/test_tools/quic_test_utils.h" |
19 | 19 |
20 using base::hash_set; | 20 using base::hash_set; |
21 using base::StringPiece; | 21 using base::StringPiece; |
| 22 using std::make_pair; |
22 using std::map; | 23 using std::map; |
23 using std::string; | 24 using std::string; |
24 using std::vector; | 25 using std::vector; |
25 | 26 |
26 namespace net { | 27 namespace net { |
27 namespace test { | 28 namespace test { |
28 | 29 |
29 class TestEncrypter : public QuicEncrypter { | 30 class TestEncrypter : public QuicEncrypter { |
30 public: | 31 public: |
31 virtual ~TestEncrypter() {} | 32 virtual ~TestEncrypter() {} |
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 QuicPacketHeader header; | 1190 QuicPacketHeader header; |
1190 header.guid = GG_UINT64_C(0xFEDCBA9876543210); | 1191 header.guid = GG_UINT64_C(0xFEDCBA9876543210); |
1191 header.packet_sequence_number = GG_UINT64_C(0x123456789ABC); | 1192 header.packet_sequence_number = GG_UINT64_C(0x123456789ABC); |
1192 header.flags = PACKET_FLAGS_NONE; | 1193 header.flags = PACKET_FLAGS_NONE; |
1193 header.fec_group = 0; | 1194 header.fec_group = 0; |
1194 | 1195 |
1195 QuicCongestionFeedbackFrame frame; | 1196 QuicCongestionFeedbackFrame frame; |
1196 frame.type = kInterArrival; | 1197 frame.type = kInterArrival; |
1197 frame.inter_arrival.accumulated_number_of_lost_packets | 1198 frame.inter_arrival.accumulated_number_of_lost_packets |
1198 = 0x0302; | 1199 = 0x0302; |
1199 frame.inter_arrival.received_packet_times[GG_UINT64_C(0x0123456789ABA)] = | 1200 frame.inter_arrival.received_packet_times.insert( |
1200 QuicTime::FromMicroseconds(GG_UINT64_C(0x07E1D2C3B4A59687)); | 1201 make_pair(GG_UINT64_C(0x0123456789ABA), |
1201 frame.inter_arrival.received_packet_times[GG_UINT64_C(0x0123456789ABB)] = | 1202 QuicTime::FromMicroseconds(GG_UINT64_C(0x07E1D2C3B4A59687)))); |
1202 QuicTime::FromMicroseconds(GG_UINT64_C(0x07E1D2C3B4A59688)); | 1203 frame.inter_arrival.received_packet_times.insert( |
1203 frame.inter_arrival.received_packet_times[GG_UINT64_C(0x0123456789ABD)] = | 1204 make_pair(GG_UINT64_C(0x0123456789ABB), |
1204 QuicTime::FromMicroseconds(GG_UINT64_C(0x07E1D2C3B4A59689)); | 1205 QuicTime::FromMicroseconds(GG_UINT64_C(0x07E1D2C3B4A59688)))); |
1205 | 1206 frame.inter_arrival.received_packet_times.insert( |
| 1207 make_pair(GG_UINT64_C(0x0123456789ABD), |
| 1208 QuicTime::FromMicroseconds(GG_UINT64_C(0x07E1D2C3B4A59689)))); |
1206 QuicFrames frames; | 1209 QuicFrames frames; |
1207 frames.push_back(QuicFrame(&frame)); | 1210 frames.push_back(QuicFrame(&frame)); |
1208 | 1211 |
1209 unsigned char packet[] = { | 1212 unsigned char packet[] = { |
1210 // guid | 1213 // guid |
1211 0x10, 0x32, 0x54, 0x76, | 1214 0x10, 0x32, 0x54, 0x76, |
1212 0x98, 0xBA, 0xDC, 0xFE, | 1215 0x98, 0xBA, 0xDC, 0xFE, |
1213 // packet sequence number | 1216 // packet sequence number |
1214 0xBC, 0x9A, 0x78, 0x56, | 1217 0xBC, 0x9A, 0x78, 0x56, |
1215 0x34, 0x12, | 1218 0x34, 0x12, |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); | 1584 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); |
1582 EXPECT_EQ(0x05060708, visitor_.connection_close_frame_.error_code); | 1585 EXPECT_EQ(0x05060708, visitor_.connection_close_frame_.error_code); |
1583 EXPECT_EQ("because I can", visitor_.connection_close_frame_.error_details); | 1586 EXPECT_EQ("because I can", visitor_.connection_close_frame_.error_details); |
1584 | 1587 |
1585 ValidateTruncatedAck(visitor_.ack_frames_[0], 194); | 1588 ValidateTruncatedAck(visitor_.ack_frames_[0], 194); |
1586 ValidateTruncatedAck(&visitor_.connection_close_frame_.ack_frame, 191); | 1589 ValidateTruncatedAck(&visitor_.connection_close_frame_.ack_frame, 191); |
1587 } | 1590 } |
1588 | 1591 |
1589 } // namespace test | 1592 } // namespace test |
1590 } // namespace net | 1593 } // namespace net |
OLD | NEW |