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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet_unittest.cc

Issue 1496883002: rtcp::Rrtr block moved into own file and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 * This file includes unit tests for the RtcpPacket. 10 * This file includes unit tests for the RtcpPacket.
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 752
753 rtc::scoped_ptr<RawPacket> packet(xr.Build()); 753 rtc::scoped_ptr<RawPacket> packet(xr.Build());
754 RtcpPacketParser parser; 754 RtcpPacketParser parser;
755 parser.Parse(packet->Buffer(), packet->Length()); 755 parser.Parse(packet->Buffer(), packet->Length());
756 EXPECT_EQ(1, parser.xr_header()->num_packets()); 756 EXPECT_EQ(1, parser.xr_header()->num_packets());
757 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); 757 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc());
758 } 758 }
759 759
760 TEST(RtcpPacketTest, XrWithRrtr) { 760 TEST(RtcpPacketTest, XrWithRrtr) {
761 Rrtr rrtr; 761 Rrtr rrtr;
762 rrtr.WithNtpSec(0x11111111); 762 rrtr.WithNtp(NtpTime(0x11111111, 0x22222222));
763 rrtr.WithNtpFrac(0x22222222);
764 Xr xr; 763 Xr xr;
765 xr.From(kSenderSsrc); 764 xr.From(kSenderSsrc);
766 EXPECT_TRUE(xr.WithRrtr(&rrtr)); 765 EXPECT_TRUE(xr.WithRrtr(&rrtr));
767 766
768 rtc::scoped_ptr<RawPacket> packet(xr.Build()); 767 rtc::scoped_ptr<RawPacket> packet(xr.Build());
769 RtcpPacketParser parser; 768 RtcpPacketParser parser;
770 parser.Parse(packet->Buffer(), packet->Length()); 769 parser.Parse(packet->Buffer(), packet->Length());
771 EXPECT_EQ(1, parser.xr_header()->num_packets()); 770 EXPECT_EQ(1, parser.xr_header()->num_packets());
772 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); 771 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc());
773 EXPECT_EQ(1, parser.rrtr()->num_packets()); 772 EXPECT_EQ(1, parser.rrtr()->num_packets());
774 EXPECT_EQ(0x11111111U, parser.rrtr()->NtpSec()); 773 EXPECT_EQ(0x11111111U, parser.rrtr()->NtpSec());
775 EXPECT_EQ(0x22222222U, parser.rrtr()->NtpFrac()); 774 EXPECT_EQ(0x22222222U, parser.rrtr()->NtpFrac());
776 } 775 }
777 776
778 TEST(RtcpPacketTest, XrWithTwoRrtrBlocks) { 777 TEST(RtcpPacketTest, XrWithTwoRrtrBlocks) {
779 Rrtr rrtr1; 778 Rrtr rrtr1;
780 rrtr1.WithNtpSec(0x11111111); 779 rrtr1.WithNtp(NtpTime(0x11111111, 0x22222222));
781 rrtr1.WithNtpFrac(0x22222222);
782 Rrtr rrtr2; 780 Rrtr rrtr2;
783 rrtr2.WithNtpSec(0x33333333); 781 rrtr2.WithNtp(NtpTime(0x33333333, 0x44444444));
784 rrtr2.WithNtpFrac(0x44444444);
785 Xr xr; 782 Xr xr;
786 xr.From(kSenderSsrc); 783 xr.From(kSenderSsrc);
787 EXPECT_TRUE(xr.WithRrtr(&rrtr1)); 784 EXPECT_TRUE(xr.WithRrtr(&rrtr1));
788 EXPECT_TRUE(xr.WithRrtr(&rrtr2)); 785 EXPECT_TRUE(xr.WithRrtr(&rrtr2));
789 786
790 rtc::scoped_ptr<RawPacket> packet(xr.Build()); 787 rtc::scoped_ptr<RawPacket> packet(xr.Build());
791 RtcpPacketParser parser; 788 RtcpPacketParser parser;
792 parser.Parse(packet->Buffer(), packet->Length()); 789 parser.Parse(packet->Buffer(), packet->Length());
793 EXPECT_EQ(1, parser.xr_header()->num_packets()); 790 EXPECT_EQ(1, parser.xr_header()->num_packets());
794 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); 791 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc());
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 EXPECT_TRUE(xr.WithDlrr(&dlrr)); 982 EXPECT_TRUE(xr.WithDlrr(&dlrr));
986 EXPECT_FALSE(xr.WithDlrr(&dlrr)); 983 EXPECT_FALSE(xr.WithDlrr(&dlrr));
987 984
988 VoipMetric voip_metric; 985 VoipMetric voip_metric;
989 for (int i = 0; i < kMaxBlocks; ++i) 986 for (int i = 0; i < kMaxBlocks; ++i)
990 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric)); 987 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric));
991 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric)); 988 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric));
992 } 989 }
993 990
994 } // namespace webrtc 991 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698