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

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

Issue 2501893004: Simplify creating RtpHeaderExtensionMap in EventLogAnalyzer (Closed)
Patch Set: Created 4 years, 1 month 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
11 #include <vector>
12
11 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 13 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
12 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" 14 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
13 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" 15 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
14 #include "webrtc/test/gtest.h" 16 #include "webrtc/test/gtest.h"
15 #include "webrtc/typedefs.h" 17 #include "webrtc/typedefs.h"
16 18
17 namespace webrtc { 19 namespace webrtc {
18 20
19 TEST(RtpHeaderExtensionTest, RegisterByType) { 21 TEST(RtpHeaderExtensionTest, RegisterByType) {
20 RtpHeaderExtensionMap map; 22 RtpHeaderExtensionMap map;
(...skipping 20 matching lines...) Expand all
41 RtpHeaderExtensionMap map; 43 RtpHeaderExtensionMap map;
42 44
43 EXPECT_TRUE(map.Register<TransmissionOffset>(3)); 45 EXPECT_TRUE(map.Register<TransmissionOffset>(3));
44 46
45 EXPECT_TRUE(map.IsRegistered(TransmissionOffset::kId)); 47 EXPECT_TRUE(map.IsRegistered(TransmissionOffset::kId));
46 EXPECT_EQ(3, map.GetId(TransmissionOffset::kId)); 48 EXPECT_EQ(3, map.GetId(TransmissionOffset::kId));
47 EXPECT_EQ(TransmissionOffset::kId, map.GetType(3)); 49 EXPECT_EQ(TransmissionOffset::kId, map.GetType(3));
48 } 50 }
49 51
50 TEST(RtpHeaderExtensionTest, RegisterDuringContruction) { 52 TEST(RtpHeaderExtensionTest, RegisterDuringContruction) {
51 const RtpHeaderExtensionMap map = {{TransmissionOffset::kUri, 1}, 53 const std::vector<RtpExtension> config = {{TransmissionOffset::kUri, 1},
52 {AbsoluteSendTime::kUri, 3}}; 54 {AbsoluteSendTime::kUri, 3}};
55 const RtpHeaderExtensionMap map(config);
53 56
54 EXPECT_EQ(1, map.GetId(TransmissionOffset::kId)); 57 EXPECT_EQ(1, map.GetId(TransmissionOffset::kId));
55 EXPECT_EQ(3, map.GetId(AbsoluteSendTime::kId)); 58 EXPECT_EQ(3, map.GetId(AbsoluteSendTime::kId));
56 } 59 }
57 60
58 TEST(RtpHeaderExtensionTest, RegisterIllegalArg) { 61 TEST(RtpHeaderExtensionTest, RegisterIllegalArg) {
59 RtpHeaderExtensionMap map; 62 RtpHeaderExtensionMap map;
60 // Valid range for id: [1-14]. 63 // Valid range for id: [1-14].
61 EXPECT_FALSE(map.Register<TransmissionOffset>(0)); 64 EXPECT_FALSE(map.Register<TransmissionOffset>(0));
62 EXPECT_FALSE(map.Register<TransmissionOffset>(15)); 65 EXPECT_FALSE(map.Register<TransmissionOffset>(15));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 TEST(RtpHeaderExtensionTest, GetId) { 102 TEST(RtpHeaderExtensionTest, GetId) {
100 RtpHeaderExtensionMap map; 103 RtpHeaderExtensionMap map;
101 EXPECT_EQ(RtpHeaderExtensionMap::kInvalidId, 104 EXPECT_EQ(RtpHeaderExtensionMap::kInvalidId,
102 map.GetId(TransmissionOffset::kId)); 105 map.GetId(TransmissionOffset::kId));
103 EXPECT_TRUE(map.Register<TransmissionOffset>(3)); 106 EXPECT_TRUE(map.Register<TransmissionOffset>(3));
104 107
105 EXPECT_EQ(3, map.GetId(TransmissionOffset::kId)); 108 EXPECT_EQ(3, map.GetId(TransmissionOffset::kId));
106 } 109 }
107 110
108 } // namespace webrtc 111 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_header_extension.cc ('k') | webrtc/tools/event_log_visualizer/analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698