OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 21 matching lines...) Expand all Loading... |
32 RapidResyncRequest mutable_parsed; | 32 RapidResyncRequest mutable_parsed; |
33 EXPECT_TRUE(test::ParseSinglePacket(kPacket, &mutable_parsed)); | 33 EXPECT_TRUE(test::ParseSinglePacket(kPacket, &mutable_parsed)); |
34 const RapidResyncRequest& parsed = mutable_parsed; | 34 const RapidResyncRequest& parsed = mutable_parsed; |
35 | 35 |
36 EXPECT_EQ(kSenderSsrc, parsed.sender_ssrc()); | 36 EXPECT_EQ(kSenderSsrc, parsed.sender_ssrc()); |
37 EXPECT_EQ(kRemoteSsrc, parsed.media_ssrc()); | 37 EXPECT_EQ(kRemoteSsrc, parsed.media_ssrc()); |
38 } | 38 } |
39 | 39 |
40 TEST(RtcpPacketRapidResyncRequestTest, Create) { | 40 TEST(RtcpPacketRapidResyncRequestTest, Create) { |
41 RapidResyncRequest rrr; | 41 RapidResyncRequest rrr; |
42 rrr.SetSenderSsrc(kSenderSsrc); | 42 rrr.From(kSenderSsrc); |
43 rrr.SetMediaSsrc(kRemoteSsrc); | 43 rrr.To(kRemoteSsrc); |
44 | 44 |
45 rtc::Buffer packet = rrr.Build(); | 45 rtc::Buffer packet = rrr.Build(); |
46 | 46 |
47 EXPECT_THAT(make_tuple(packet.data(), packet.size()), | 47 EXPECT_THAT(make_tuple(packet.data(), packet.size()), |
48 ElementsAreArray(kPacket)); | 48 ElementsAreArray(kPacket)); |
49 } | 49 } |
50 | 50 |
51 TEST(RtcpPacketRapidResyncRequestTest, ParseFailsOnTooSmallPacket) { | 51 TEST(RtcpPacketRapidResyncRequestTest, ParseFailsOnTooSmallPacket) { |
52 const uint8_t kTooSmallPacket[] = {0x85, 205, 0x00, 0x01, | 52 const uint8_t kTooSmallPacket[] = {0x85, 205, 0x00, 0x01, |
53 0x12, 0x34, 0x56, 0x78}; | 53 0x12, 0x34, 0x56, 0x78}; |
54 RapidResyncRequest parsed; | 54 RapidResyncRequest parsed; |
55 EXPECT_FALSE(test::ParseSinglePacket(kTooSmallPacket, &parsed)); | 55 EXPECT_FALSE(test::ParseSinglePacket(kTooSmallPacket, &parsed)); |
56 } | 56 } |
57 | 57 |
58 TEST(RtcpPacketRapidResyncRequestTest, ParseFailsOnTooLargePacket) { | 58 TEST(RtcpPacketRapidResyncRequestTest, ParseFailsOnTooLargePacket) { |
59 const uint8_t kTooLargePacket[] = {0x85, 205, 0x00, 0x03, | 59 const uint8_t kTooLargePacket[] = {0x85, 205, 0x00, 0x03, |
60 0x12, 0x34, 0x56, 0x78, | 60 0x12, 0x34, 0x56, 0x78, |
61 0x32, 0x21, 0x65, 0x87, | 61 0x32, 0x21, 0x65, 0x87, |
62 0x23, 0x45, 0x67, 0x89}; | 62 0x23, 0x45, 0x67, 0x89}; |
63 RapidResyncRequest parsed; | 63 RapidResyncRequest parsed; |
64 EXPECT_FALSE(test::ParseSinglePacket(kTooLargePacket, &parsed)); | 64 EXPECT_FALSE(test::ParseSinglePacket(kTooLargePacket, &parsed)); |
65 } | 65 } |
66 } // namespace webrtc | 66 } // namespace webrtc |
OLD | NEW |