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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc

Issue 2979413002: Refactor composing report blocks for rtcp Sender/Receiver reports (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc
index 4061db889f2b39a0a2681f680722bc2ea2c08c43..4ead09eb3608c3d3967d04b96b977277d7926d98 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc
@@ -127,4 +127,25 @@ TEST(RtcpPacketReceiverReportTest, CreateWithTooManyReportBlocks) {
EXPECT_FALSE(rr.AddReportBlock(rb));
}
+TEST(RtcpPacketReceiverReportTest, SetReportBlocksOverwritesOldBlocks) {
eladalon 2017/07/21 12:53:19 nit: Checking by size only does not guarantee corr
danilchap 2017/07/21 17:11:14 I lack imagination to see that code, but it's not
+ ReceiverReport rr;
+ rr.AddReportBlock(ReportBlock());
+ ASSERT_EQ(rr.report_blocks().size(), 1u);
+
+ std::vector<ReportBlock> blocks(3);
+ EXPECT_TRUE(rr.SetReportBlocks(blocks));
+ EXPECT_EQ(rr.report_blocks().size(), 3u);
+}
+
+TEST(RtcpPacketReceiverReportTest, SetTooManyReportBlocks) {
+ ReceiverReport rr;
+ const size_t kMaxReportBlocks = (1 << 5) - 1;
+
+ std::vector<ReportBlock> blocks(kMaxReportBlocks);
+ EXPECT_TRUE(rr.SetReportBlocks(blocks));
eladalon 2017/07/21 12:53:19 nit: Two tests here: 1. Max number of blocks accep
danilchap 2017/07/21 17:11:14 renamed to document this test is about showing the
+
+ blocks.push_back(ReportBlock());
+ EXPECT_FALSE(rr.SetReportBlocks(blocks));
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698