OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 0x12, 0x34, 0x56, 0x78, | 23 0x12, 0x34, 0x56, 0x78, |
24 0x23, 0x45, 0x67, 0x89}; | 24 0x23, 0x45, 0x67, 0x89}; |
25 const size_t kBlockSizeBytes = sizeof(kBlock); | 25 const size_t kBlockSizeBytes = sizeof(kBlock); |
26 static_assert( | 26 static_assert( |
27 kBlockSizeBytes == Rrtr::kLength, | 27 kBlockSizeBytes == Rrtr::kLength, |
28 "Size of manually created Rrtr block should match class constant"); | 28 "Size of manually created Rrtr block should match class constant"); |
29 | 29 |
30 TEST(RtcpPacketRrtrTest, Create) { | 30 TEST(RtcpPacketRrtrTest, Create) { |
31 uint8_t buffer[Rrtr::kLength]; | 31 uint8_t buffer[Rrtr::kLength]; |
32 Rrtr rrtr; | 32 Rrtr rrtr; |
33 rrtr.SetNtp(NtpTime(kNtpSec, kNtpFrac)); | 33 rrtr.WithNtp(NtpTime(kNtpSec, kNtpFrac)); |
34 | 34 |
35 rrtr.Create(buffer); | 35 rrtr.Create(buffer); |
36 EXPECT_EQ(0, memcmp(buffer, kBlock, kBlockSizeBytes)); | 36 EXPECT_EQ(0, memcmp(buffer, kBlock, kBlockSizeBytes)); |
37 } | 37 } |
38 | 38 |
39 TEST(RtcpPacketRrtrTest, Parse) { | 39 TEST(RtcpPacketRrtrTest, Parse) { |
40 Rrtr read_rrtr; | 40 Rrtr read_rrtr; |
41 read_rrtr.Parse(kBlock); | 41 read_rrtr.Parse(kBlock); |
42 | 42 |
43 // Run checks on const object to ensure all accessors have const modifier. | 43 // Run checks on const object to ensure all accessors have const modifier. |
44 const Rrtr& parsed = read_rrtr; | 44 const Rrtr& parsed = read_rrtr; |
45 | 45 |
46 EXPECT_EQ(kNtpSec, parsed.ntp().seconds()); | 46 EXPECT_EQ(kNtpSec, parsed.ntp().seconds()); |
47 EXPECT_EQ(kNtpFrac, parsed.ntp().fractions()); | 47 EXPECT_EQ(kNtpFrac, parsed.ntp().fractions()); |
48 } | 48 } |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 } // namespace webrtc | 51 } // namespace webrtc |
OLD | NEW |