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

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

Issue 2986093003: Add PacketRouterTest.Sanity_NoModuleRegistered_* (Closed)
Patch Set: Rebased and added TODO elsewhere. 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 | « webrtc/modules/pacing/paced_sender.cc ('k') | 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 MockRtpRtcpWithRembTracking() { 44 MockRtpRtcpWithRembTracking() {
45 ON_CALL(*this, SetREMBStatus(_)).WillByDefault(SaveArg<0>(&remb_)); 45 ON_CALL(*this, SetREMBStatus(_)).WillByDefault(SaveArg<0>(&remb_));
46 ON_CALL(*this, REMB()).WillByDefault(ReturnPointee(&remb_)); 46 ON_CALL(*this, REMB()).WillByDefault(ReturnPointee(&remb_));
47 } 47 }
48 48
49 private: 49 private:
50 bool remb_ = false; 50 bool remb_ = false;
51 }; 51 };
52 } // namespace 52 } // namespace
53 53
54 TEST(PacketRouterTest, Sanity_NoModuleRegistered_TimeToSendPacket) {
55 PacketRouter packet_router;
56
57 constexpr uint16_t ssrc = 1234;
58 constexpr uint16_t sequence_number = 17;
59 constexpr uint64_t timestamp = 7890;
60 constexpr bool retransmission = false;
61 const PacedPacketInfo paced_info(1, kProbeMinProbes, kProbeMinBytes);
62
63 // TODO(eladalon): TimeToSendPacket() returning true when nothing was
64 // sent, because no modules were registered, is sub-optimal.
65 // https://bugs.chromium.org/p/webrtc/issues/detail?id=8052
66 EXPECT_TRUE(packet_router.TimeToSendPacket(ssrc, sequence_number, timestamp,
67 retransmission, paced_info));
68 }
69
70 TEST(PacketRouterTest, Sanity_NoModuleRegistered_TimeToSendPadding) {
71 PacketRouter packet_router;
72
73 constexpr size_t bytes = 300;
74 const PacedPacketInfo paced_info(1, kProbeMinProbes, kProbeMinBytes);
75
76 EXPECT_EQ(packet_router.TimeToSendPadding(bytes, paced_info), 0u);
77 }
78
79 TEST(PacketRouterTest, Sanity_NoModuleRegistered_OnReceiveBitrateChanged) {
80 PacketRouter packet_router;
81
82 const std::vector<uint32_t> ssrcs = {1, 2, 3};
83 constexpr uint32_t bitrate_bps = 10000;
84
85 packet_router.OnReceiveBitrateChanged(ssrcs, bitrate_bps);
86 }
87
88 TEST(PacketRouterTest, Sanity_NoModuleRegistered_SendRemb) {
89 PacketRouter packet_router;
90
91 const std::vector<uint32_t> ssrcs = {1, 2, 3};
92 constexpr uint32_t bitrate_bps = 10000;
93
94 EXPECT_FALSE(packet_router.SendRemb(bitrate_bps, ssrcs));
95 }
96
97 TEST(PacketRouterTest, Sanity_NoModuleRegistered_SendTransportFeedback) {
98 PacketRouter packet_router;
99
100 rtcp::TransportFeedback feedback;
101
102 EXPECT_FALSE(packet_router.SendTransportFeedback(&feedback));
103 }
104
54 TEST(PacketRouterTest, TimeToSendPacket) { 105 TEST(PacketRouterTest, TimeToSendPacket) {
55 PacketRouter packet_router; 106 PacketRouter packet_router;
56 NiceMock<MockRtpRtcp> rtp_1; 107 NiceMock<MockRtpRtcp> rtp_1;
57 NiceMock<MockRtpRtcp> rtp_2; 108 NiceMock<MockRtpRtcp> rtp_2;
58 109
59 packet_router.AddSendRtpModule(&rtp_1, false); 110 packet_router.AddSendRtpModule(&rtp_1, false);
60 packet_router.AddSendRtpModule(&rtp_2, false); 111 packet_router.AddSendRtpModule(&rtp_2, false);
61 112
62 const uint16_t kSsrc1 = 1234; 113 const uint16_t kSsrc1 = 1234;
63 uint16_t sequence_number = 17; 114 uint16_t sequence_number = 17;
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 EXPECT_CALL(receive_module, SetREMBData(bitrate_estimate, ssrcs)).Times(1); 757 EXPECT_CALL(receive_module, SetREMBData(bitrate_estimate, ssrcs)).Times(1);
707 758
708 clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(1000)); 759 clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(1000));
709 packet_router.OnReceiveBitrateChanged(ssrcs, bitrate_estimate); 760 packet_router.OnReceiveBitrateChanged(ssrcs, bitrate_estimate);
710 761
711 // Test tear-down 762 // Test tear-down
712 packet_router.RemoveReceiveRtpModule(&receive_module); 763 packet_router.RemoveReceiveRtpModule(&receive_module);
713 } 764 }
714 765
715 } // namespace webrtc 766 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/paced_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698