jbauch | 5869f50 | 2017-06-29 12:31:36 -0700 | [diff] [blame] | 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 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #include "api/rtp_parameters.h" |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "test/gtest.h" |
jbauch | 5869f50 | 2017-06-29 12:31:36 -0700 | [diff] [blame] | 14 | |
Stefan Holmer | 1acbd68 | 2017-09-01 15:29:28 +0200 | [diff] [blame] | 15 | namespace webrtc { |
jbauch | 5869f50 | 2017-06-29 12:31:36 -0700 | [diff] [blame] | 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 | |
| 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 | } |
Stefan Holmer | 1acbd68 | 2017-09-01 15:29:28 +0200 | [diff] [blame] | 50 | } // namespace webrtc |