OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 webrtc::SimulatedClock clock_; | 45 webrtc::SimulatedClock clock_; |
46 SendTimeHistory history_; | 46 SendTimeHistory history_; |
47 }; | 47 }; |
48 | 48 |
49 TEST_F(SendTimeHistoryTest, SaveAndRestoreNetworkId) { | 49 TEST_F(SendTimeHistoryTest, SaveAndRestoreNetworkId) { |
50 const PacedPacketInfo kPacingInfo(0, 5, 1200); | 50 const PacedPacketInfo kPacingInfo(0, 5, 1200); |
51 uint16_t sequence_number = 0; | 51 uint16_t sequence_number = 0; |
52 int64_t now_ms = clock_.TimeInMilliseconds(); | 52 int64_t now_ms = clock_.TimeInMilliseconds(); |
53 for (int i = 1; i < 5; ++i) { | 53 for (int i = 1; i < 5; ++i) { |
54 PacketFeedback packet(now_ms, sequence_number++, 1000, i, i - 1, | 54 PacketFeedback packet(now_ms, sequence_number, 1000, i, i - 1, |
55 kPacingInfo); | 55 kPacingInfo); |
56 history_.AddAndRemoveOld(packet); | 56 history_.AddAndRemoveOld(packet); |
57 history_.OnSentPacket(sequence_number, now_ms); | 57 history_.OnSentPacket(sequence_number, now_ms); |
58 PacketFeedback restored(now_ms, sequence_number); | 58 PacketFeedback restored(now_ms, sequence_number); |
59 EXPECT_TRUE(history_.GetFeedback(&restored, sequence_number)); | 59 EXPECT_TRUE(history_.GetFeedback(&restored, sequence_number++)); |
60 EXPECT_EQ(packet.local_net_id, restored.local_net_id); | 60 EXPECT_EQ(packet.local_net_id, restored.local_net_id); |
61 EXPECT_EQ(packet.remote_net_id, restored.remote_net_id); | 61 EXPECT_EQ(packet.remote_net_id, restored.remote_net_id); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 TEST_F(SendTimeHistoryTest, AddRemoveOne) { | 65 TEST_F(SendTimeHistoryTest, AddRemoveOne) { |
66 const uint16_t kSeqNo = 10; | 66 const uint16_t kSeqNo = 10; |
67 // TODO(philipel): Fix PacedPacketInfo constructor? | 67 // TODO(philipel): Fix PacedPacketInfo constructor? |
68 const PacedPacketInfo kPacingInfo(0, 5, 1200); | 68 const PacedPacketInfo kPacingInfo(0, 5, 1200); |
69 const PacketFeedback kSentPacket(0, 1, kSeqNo, 1, kPacingInfo); | 69 const PacketFeedback kSentPacket(0, 1, kSeqNo, 1, kPacingInfo); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 PacketFeedback packet2(0, 0, packets[1].sequence_number, 0, kPacingInfo1); | 226 PacketFeedback packet2(0, 0, packets[1].sequence_number, 0, kPacingInfo1); |
227 EXPECT_TRUE(history_.GetFeedback(&packet2, true)); | 227 EXPECT_TRUE(history_.GetFeedback(&packet2, true)); |
228 EXPECT_EQ(packets[1], packet2); | 228 EXPECT_EQ(packets[1], packet2); |
229 | 229 |
230 PacketFeedback packet3(0, 0, packets[2].sequence_number, 0, kPacingInfo2); | 230 PacketFeedback packet3(0, 0, packets[2].sequence_number, 0, kPacingInfo2); |
231 EXPECT_TRUE(history_.GetFeedback(&packet3, true)); | 231 EXPECT_TRUE(history_.GetFeedback(&packet3, true)); |
232 EXPECT_EQ(packets[2], packet3); | 232 EXPECT_EQ(packets[2], packet3); |
233 } | 233 } |
234 } // namespace test | 234 } // namespace test |
235 } // namespace webrtc | 235 } // namespace webrtc |
OLD | NEW |