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

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

Issue 2867713003: Remove hardcoded kValueSizeBytes values from variable-length header extensions. (Closed)
Patch Set: Patch 1 Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 TEST(RtpHeaderExtensionTest, NonUniqueId) { 78 TEST(RtpHeaderExtensionTest, NonUniqueId) {
79 RtpHeaderExtensionMap map; 79 RtpHeaderExtensionMap map;
80 EXPECT_TRUE(map.Register<TransmissionOffset>(3)); 80 EXPECT_TRUE(map.Register<TransmissionOffset>(3));
81 81
82 EXPECT_FALSE(map.Register<AudioLevel>(3)); 82 EXPECT_FALSE(map.Register<AudioLevel>(3));
83 EXPECT_TRUE(map.Register<AudioLevel>(4)); 83 EXPECT_TRUE(map.Register<AudioLevel>(4));
84 } 84 }
85 85
86 TEST(RtpHeaderExtensionTest, GetTotalLength) { 86 TEST(RtpHeaderExtensionTest, GetTotalLength) {
87 RtpHeaderExtensionMap map; 87 RtpHeaderExtensionMap map;
88 EXPECT_EQ(0u, map.GetTotalLengthInBytes()); 88 constexpr RtpExtensionSize kExtensionSizes[] = {
89 CreateExtensionSize<TransmissionOffset>(),
90 };
91 EXPECT_EQ(0u, map.GetTotalLengthInBytes(kExtensionSizes));
89 EXPECT_TRUE(map.Register<TransmissionOffset>(3)); 92 EXPECT_TRUE(map.Register<TransmissionOffset>(3));
90 static constexpr size_t kRtpOneByteHeaderLength = 4; 93 static constexpr size_t kRtpOneByteHeaderLength = 4;
91 EXPECT_EQ(kRtpOneByteHeaderLength + (TransmissionOffset::kValueSizeBytes + 1), 94 EXPECT_EQ(
92 map.GetTotalLengthInBytes()); 95 kRtpOneByteHeaderLength + (TransmissionOffset::kValueSizeBytes + 1),
96 map.GetTotalLengthInBytes(kExtensionSizes));
93 } 97 }
94 98
95 TEST(RtpHeaderExtensionTest, GetType) { 99 TEST(RtpHeaderExtensionTest, GetType) {
96 RtpHeaderExtensionMap map; 100 RtpHeaderExtensionMap map;
97 EXPECT_EQ(RtpHeaderExtensionMap::kInvalidType, map.GetType(3)); 101 EXPECT_EQ(RtpHeaderExtensionMap::kInvalidType, map.GetType(3));
98 EXPECT_TRUE(map.Register<TransmissionOffset>(3)); 102 EXPECT_TRUE(map.Register<TransmissionOffset>(3));
99 103
100 EXPECT_EQ(TransmissionOffset::kId, map.GetType(3)); 104 EXPECT_EQ(TransmissionOffset::kId, map.GetType(3));
101 } 105 }
102 106
103 TEST(RtpHeaderExtensionTest, GetId) { 107 TEST(RtpHeaderExtensionTest, GetId) {
104 RtpHeaderExtensionMap map; 108 RtpHeaderExtensionMap map;
105 EXPECT_EQ(RtpHeaderExtensionMap::kInvalidId, 109 EXPECT_EQ(RtpHeaderExtensionMap::kInvalidId,
106 map.GetId(TransmissionOffset::kId)); 110 map.GetId(TransmissionOffset::kId));
107 EXPECT_TRUE(map.Register<TransmissionOffset>(3)); 111 EXPECT_TRUE(map.Register<TransmissionOffset>(3));
108 112
109 EXPECT_EQ(3, map.GetId(TransmissionOffset::kId)); 113 EXPECT_EQ(3, map.GetId(TransmissionOffset::kId));
110 } 114 }
111 115
112 } // namespace webrtc 116 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698