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

Side by Side Diff: webrtc/modules/pacing/packet_router_unittest.cc

Issue 2986093003: Add PacketRouterTest.Sanity_NoModuleRegistered_* (Closed)
Patch Set: Created 3 years, 4 months 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 30
31 class PacketRouterTest : public ::testing::Test { 31 class PacketRouterTest : public ::testing::Test {
32 public: 32 public:
33 PacketRouterTest() : packet_router_(new PacketRouter()) {} 33 PacketRouterTest() : packet_router_(new PacketRouter()) {}
34 protected: 34 protected:
35 static const int kProbeMinProbes = 5; 35 static const int kProbeMinProbes = 5;
36 static const int kProbeMinBytes = 1000; 36 static const int kProbeMinBytes = 1000;
37 const std::unique_ptr<PacketRouter> packet_router_; 37 const std::unique_ptr<PacketRouter> packet_router_;
38 }; 38 };
39 39
40 TEST_F(PacketRouterTest, Sanity_NoModuleRegistered_TimeToSendPacket) {
41 PacketRouter packet_router;
42
43 constexpr uint16_t ssrc = 1234;
44 constexpr uint16_t sequence_number = 17;
45 constexpr uint64_t timestamp = 7890;
46 constexpr bool retransmission = false;
47 const PacedPacketInfo paced_info(1, kProbeMinProbes, kProbeMinBytes);
48
49 // TODO(eladalon): !!! Discuss with reviewers - it's interesting that this
50 // returns true even when no modules are found that match the SSRC.
danilchap 2017/07/28 12:25:48 looking for documentation for the return value of
eladalon 2017/07/29 11:27:10 I'll use this CL to introduce the sanity tests, an
51 EXPECT_TRUE(packet_router.TimeToSendPacket(ssrc, sequence_number, timestamp,
52 retransmission, paced_info));
53 }
54
40 TEST_F(PacketRouterTest, TimeToSendPacket) { 55 TEST_F(PacketRouterTest, TimeToSendPacket) {
41 NiceMock<MockRtpRtcp> rtp_1; 56 NiceMock<MockRtpRtcp> rtp_1;
42 NiceMock<MockRtpRtcp> rtp_2; 57 NiceMock<MockRtpRtcp> rtp_2;
43 packet_router_->AddSendRtpModule(&rtp_1); 58 packet_router_->AddSendRtpModule(&rtp_1);
44 packet_router_->AddSendRtpModule(&rtp_2); 59 packet_router_->AddSendRtpModule(&rtp_2);
45 60
46 const uint16_t kSsrc1 = 1234; 61 const uint16_t kSsrc1 = 1234;
47 uint16_t sequence_number = 17; 62 uint16_t sequence_number = 17;
48 uint64_t timestamp = 7890; 63 uint64_t timestamp = 7890;
49 bool retransmission = false; 64 bool retransmission = false;
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 485
471 // Lower the estimate to trigger a new packet REMB packet. 486 // Lower the estimate to trigger a new packet REMB packet.
472 EXPECT_CALL(rtp, SetREMBData(bitrate_estimate - 100, ssrcs)).Times(1); 487 EXPECT_CALL(rtp, SetREMBData(bitrate_estimate - 100, ssrcs)).Times(1);
473 packet_router.OnReceiveBitrateChanged(ssrcs, bitrate_estimate - 100); 488 packet_router.OnReceiveBitrateChanged(ssrcs, bitrate_estimate - 100);
474 489
475 EXPECT_CALL(rtp, SetREMBStatus(false)).Times(1); 490 EXPECT_CALL(rtp, SetREMBStatus(false)).Times(1);
476 packet_router.RemoveReceiveRtpModule(&rtp); 491 packet_router.RemoveReceiveRtpModule(&rtp);
477 } 492 }
478 493
479 } // namespace webrtc 494 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698