OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #include <list> | 11 #include <list> |
| 12 #include <memory> |
12 | 13 |
13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "webrtc/modules/pacing/paced_sender.h" | 16 #include "webrtc/modules/pacing/paced_sender.h" |
16 #include "webrtc/system_wrappers/include/clock.h" | 17 #include "webrtc/system_wrappers/include/clock.h" |
17 | 18 |
18 using testing::_; | 19 using testing::_; |
19 using testing::Return; | 20 using testing::Return; |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 send_bucket_->InsertPacket(priority, ssrc, sequence_number, capture_time_ms, | 128 send_bucket_->InsertPacket(priority, ssrc, sequence_number, capture_time_ms, |
128 size, retransmission); | 129 size, retransmission); |
129 EXPECT_CALL(callback_, | 130 EXPECT_CALL(callback_, |
130 TimeToSendPacket(ssrc, sequence_number, capture_time_ms, false)) | 131 TimeToSendPacket(ssrc, sequence_number, capture_time_ms, false)) |
131 .Times(1) | 132 .Times(1) |
132 .WillRepeatedly(Return(true)); | 133 .WillRepeatedly(Return(true)); |
133 } | 134 } |
134 | 135 |
135 SimulatedClock clock_; | 136 SimulatedClock clock_; |
136 MockPacedSenderCallback callback_; | 137 MockPacedSenderCallback callback_; |
137 rtc::scoped_ptr<PacedSender> send_bucket_; | 138 std::unique_ptr<PacedSender> send_bucket_; |
138 }; | 139 }; |
139 | 140 |
140 TEST_F(PacedSenderTest, QueuePacket) { | 141 TEST_F(PacedSenderTest, QueuePacket) { |
141 uint32_t ssrc = 12345; | 142 uint32_t ssrc = 12345; |
142 uint16_t sequence_number = 1234; | 143 uint16_t sequence_number = 1234; |
143 // Due to the multiplicative factor we can send 3 packets not 2 packets. | 144 // Due to the multiplicative factor we can send 3 packets not 2 packets. |
144 SendAndExpectPacket(PacedSender::kNormalPriority, | 145 SendAndExpectPacket(PacedSender::kNormalPriority, |
145 ssrc, | 146 ssrc, |
146 sequence_number++, | 147 sequence_number++, |
147 clock_.TimeInMilliseconds(), | 148 clock_.TimeInMilliseconds(), |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 for (int i = 0; i < 3; ++i) { | 900 for (int i = 0; i < 3; ++i) { |
900 clock_.AdvanceTimeMilliseconds(30); // Max delta. | 901 clock_.AdvanceTimeMilliseconds(30); // Max delta. |
901 send_bucket_->Process(); | 902 send_bucket_->Process(); |
902 } | 903 } |
903 | 904 |
904 EXPECT_EQ(0, send_bucket_->AverageQueueTimeMs()); | 905 EXPECT_EQ(0, send_bucket_->AverageQueueTimeMs()); |
905 } | 906 } |
906 | 907 |
907 } // namespace test | 908 } // namespace test |
908 } // namespace webrtc | 909 } // namespace webrtc |
OLD | NEW |