| OLD | NEW |
| 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 677 |
| 678 rtc::scoped_ptr<RawPacket> packet(xr.Build()); | 678 rtc::scoped_ptr<RawPacket> packet(xr.Build()); |
| 679 RtcpPacketParser parser; | 679 RtcpPacketParser parser; |
| 680 parser.Parse(packet->Buffer(), packet->Length()); | 680 parser.Parse(packet->Buffer(), packet->Length()); |
| 681 EXPECT_EQ(1, parser.xr_header()->num_packets()); | 681 EXPECT_EQ(1, parser.xr_header()->num_packets()); |
| 682 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); | 682 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); |
| 683 } | 683 } |
| 684 | 684 |
| 685 TEST(RtcpPacketTest, XrWithRrtr) { | 685 TEST(RtcpPacketTest, XrWithRrtr) { |
| 686 Rrtr rrtr; | 686 Rrtr rrtr; |
| 687 rrtr.WithNtpSec(0x11111111); | 687 rrtr.WithNtp(NtpTime(0x11111111, 0x22222222)); |
| 688 rrtr.WithNtpFrac(0x22222222); | |
| 689 Xr xr; | 688 Xr xr; |
| 690 xr.From(kSenderSsrc); | 689 xr.From(kSenderSsrc); |
| 691 EXPECT_TRUE(xr.WithRrtr(&rrtr)); | 690 EXPECT_TRUE(xr.WithRrtr(&rrtr)); |
| 692 | 691 |
| 693 rtc::scoped_ptr<RawPacket> packet(xr.Build()); | 692 rtc::scoped_ptr<RawPacket> packet(xr.Build()); |
| 694 RtcpPacketParser parser; | 693 RtcpPacketParser parser; |
| 695 parser.Parse(packet->Buffer(), packet->Length()); | 694 parser.Parse(packet->Buffer(), packet->Length()); |
| 696 EXPECT_EQ(1, parser.xr_header()->num_packets()); | 695 EXPECT_EQ(1, parser.xr_header()->num_packets()); |
| 697 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); | 696 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); |
| 698 EXPECT_EQ(1, parser.rrtr()->num_packets()); | 697 EXPECT_EQ(1, parser.rrtr()->num_packets()); |
| 699 EXPECT_EQ(0x11111111U, parser.rrtr()->NtpSec()); | 698 EXPECT_EQ(0x11111111U, parser.rrtr()->NtpSec()); |
| 700 EXPECT_EQ(0x22222222U, parser.rrtr()->NtpFrac()); | 699 EXPECT_EQ(0x22222222U, parser.rrtr()->NtpFrac()); |
| 701 } | 700 } |
| 702 | 701 |
| 703 TEST(RtcpPacketTest, XrWithTwoRrtrBlocks) { | 702 TEST(RtcpPacketTest, XrWithTwoRrtrBlocks) { |
| 704 Rrtr rrtr1; | 703 Rrtr rrtr1; |
| 705 rrtr1.WithNtpSec(0x11111111); | 704 rrtr1.WithNtp(NtpTime(0x11111111, 0x22222222)); |
| 706 rrtr1.WithNtpFrac(0x22222222); | |
| 707 Rrtr rrtr2; | 705 Rrtr rrtr2; |
| 708 rrtr2.WithNtpSec(0x33333333); | 706 rrtr2.WithNtp(NtpTime(0x33333333, 0x44444444)); |
| 709 rrtr2.WithNtpFrac(0x44444444); | |
| 710 Xr xr; | 707 Xr xr; |
| 711 xr.From(kSenderSsrc); | 708 xr.From(kSenderSsrc); |
| 712 EXPECT_TRUE(xr.WithRrtr(&rrtr1)); | 709 EXPECT_TRUE(xr.WithRrtr(&rrtr1)); |
| 713 EXPECT_TRUE(xr.WithRrtr(&rrtr2)); | 710 EXPECT_TRUE(xr.WithRrtr(&rrtr2)); |
| 714 | 711 |
| 715 rtc::scoped_ptr<RawPacket> packet(xr.Build()); | 712 rtc::scoped_ptr<RawPacket> packet(xr.Build()); |
| 716 RtcpPacketParser parser; | 713 RtcpPacketParser parser; |
| 717 parser.Parse(packet->Buffer(), packet->Length()); | 714 parser.Parse(packet->Buffer(), packet->Length()); |
| 718 EXPECT_EQ(1, parser.xr_header()->num_packets()); | 715 EXPECT_EQ(1, parser.xr_header()->num_packets()); |
| 719 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); | 716 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 EXPECT_TRUE(xr.WithDlrr(&dlrr)); | 907 EXPECT_TRUE(xr.WithDlrr(&dlrr)); |
| 911 EXPECT_FALSE(xr.WithDlrr(&dlrr)); | 908 EXPECT_FALSE(xr.WithDlrr(&dlrr)); |
| 912 | 909 |
| 913 VoipMetric voip_metric; | 910 VoipMetric voip_metric; |
| 914 for (int i = 0; i < kMaxBlocks; ++i) | 911 for (int i = 0; i < kMaxBlocks; ++i) |
| 915 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric)); | 912 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric)); |
| 916 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric)); | 913 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric)); |
| 917 } | 914 } |
| 918 | 915 |
| 919 } // namespace webrtc | 916 } // namespace webrtc |
| OLD | NEW |