• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "api/rtp_parameters.h"
12 
13 #include "test/gtest.h"
14 
15 namespace webrtc {
16 
17 using webrtc::RtpExtension;
18 
19 static const char kExtensionUri1[] = "extension-uri1";
20 static const char kExtensionUri2[] = "extension-uri2";
21 
22 static const RtpExtension kExtension1(kExtensionUri1, 1);
23 static const RtpExtension kExtension1Encrypted(kExtensionUri1, 10, true);
24 static const RtpExtension kExtension2(kExtensionUri2, 2);
25 
TEST(RtpExtensionTest,FilterDuplicateNonEncrypted)26 TEST(RtpExtensionTest, FilterDuplicateNonEncrypted) {
27   std::vector<RtpExtension> extensions;
28   std::vector<RtpExtension> filtered;
29 
30   extensions.push_back(kExtension1);
31   extensions.push_back(kExtension1Encrypted);
32   filtered = RtpExtension::FilterDuplicateNonEncrypted(extensions);
33   EXPECT_EQ(1u, filtered.size());
34   EXPECT_EQ(std::vector<RtpExtension>{kExtension1Encrypted}, filtered);
35 
36   extensions.clear();
37   extensions.push_back(kExtension1Encrypted);
38   extensions.push_back(kExtension1);
39   filtered = RtpExtension::FilterDuplicateNonEncrypted(extensions);
40   EXPECT_EQ(1u, filtered.size());
41   EXPECT_EQ(std::vector<RtpExtension>{kExtension1Encrypted}, filtered);
42 
43   extensions.clear();
44   extensions.push_back(kExtension1);
45   extensions.push_back(kExtension2);
46   filtered = RtpExtension::FilterDuplicateNonEncrypted(extensions);
47   EXPECT_EQ(2u, filtered.size());
48   EXPECT_EQ(extensions, filtered);
49 }
50 }  // namespace webrtc
51