Index: webrtc/media/engine/webrtcmediaengine_unittest.cc |
diff --git a/webrtc/media/engine/webrtcmediaengine_unittest.cc b/webrtc/media/engine/webrtcmediaengine_unittest.cc |
index be93d7ded8931bbe7c15fbe614038fd5c540fc4c..f7ae7db73d10bfa0deea19c356c3aa8605211e80 100644 |
--- a/webrtc/media/engine/webrtcmediaengine_unittest.cc |
+++ b/webrtc/media/engine/webrtcmediaengine_unittest.cc |
@@ -12,27 +12,29 @@ |
#include "webrtc/media/engine/webrtcmediaengine.h" |
+using webrtc::RtpExtension; |
+ |
namespace cricket { |
namespace { |
-std::vector<RtpHeaderExtension> MakeUniqueExtensions() { |
- std::vector<RtpHeaderExtension> result; |
+std::vector<RtpExtension> MakeUniqueExtensions() { |
+ std::vector<RtpExtension> result; |
char name[] = "a"; |
for (int i = 0; i < 7; ++i) { |
- result.push_back(RtpHeaderExtension(name, 1 + i)); |
+ result.push_back(RtpExtension(name, 1 + i)); |
name[0]++; |
- result.push_back(RtpHeaderExtension(name, 14 - i)); |
+ result.push_back(RtpExtension(name, 14 - i)); |
name[0]++; |
} |
return result; |
} |
-std::vector<RtpHeaderExtension> MakeRedundantExtensions() { |
- std::vector<RtpHeaderExtension> result; |
+std::vector<RtpExtension> MakeRedundantExtensions() { |
+ std::vector<RtpExtension> result; |
char name[] = "a"; |
for (int i = 0; i < 7; ++i) { |
- result.push_back(RtpHeaderExtension(name, 1 + i)); |
- result.push_back(RtpHeaderExtension(name, 14 - i)); |
+ result.push_back(RtpExtension(name, 1 + i)); |
+ result.push_back(RtpExtension(name, 14 - i)); |
name[0]++; |
} |
return result; |
@@ -49,67 +51,67 @@ bool SupportedExtensions2(const std::string& name) { |
bool IsSorted(const std::vector<webrtc::RtpExtension>& extensions) { |
const std::string* last = nullptr; |
for (const auto& extension : extensions) { |
- if (last && *last > extension.name) { |
+ if (last && *last > extension.uri) { |
return false; |
} |
- last = &extension.name; |
+ last = &extension.uri; |
} |
return true; |
} |
} // namespace |
TEST(WebRtcMediaEngineTest, ValidateRtpExtensions_EmptyList) { |
- std::vector<RtpHeaderExtension> extensions; |
+ std::vector<RtpExtension> extensions; |
EXPECT_TRUE(ValidateRtpExtensions(extensions)); |
} |
TEST(WebRtcMediaEngineTest, ValidateRtpExtensions_AllGood) { |
- std::vector<RtpHeaderExtension> extensions = MakeUniqueExtensions(); |
+ std::vector<RtpExtension> extensions = MakeUniqueExtensions(); |
EXPECT_TRUE(ValidateRtpExtensions(extensions)); |
} |
TEST(WebRtcMediaEngineTest, ValidateRtpExtensions_OutOfRangeId_Low) { |
- std::vector<RtpHeaderExtension> extensions = MakeUniqueExtensions(); |
- extensions.push_back(RtpHeaderExtension("foo", 0)); |
+ std::vector<RtpExtension> extensions = MakeUniqueExtensions(); |
+ extensions.push_back(RtpExtension("foo", 0)); |
EXPECT_FALSE(ValidateRtpExtensions(extensions)); |
} |
TEST(WebRtcMediaEngineTest, ValidateRtpExtensions_OutOfRangeId_High) { |
- std::vector<RtpHeaderExtension> extensions = MakeUniqueExtensions(); |
- extensions.push_back(RtpHeaderExtension("foo", 15)); |
+ std::vector<RtpExtension> extensions = MakeUniqueExtensions(); |
+ extensions.push_back(RtpExtension("foo", 15)); |
EXPECT_FALSE(ValidateRtpExtensions(extensions)); |
} |
TEST(WebRtcMediaEngineTest, ValidateRtpExtensions_OverlappingIds_StartOfSet) { |
- std::vector<RtpHeaderExtension> extensions = MakeUniqueExtensions(); |
- extensions.push_back(RtpHeaderExtension("foo", 1)); |
+ std::vector<RtpExtension> extensions = MakeUniqueExtensions(); |
+ extensions.push_back(RtpExtension("foo", 1)); |
EXPECT_FALSE(ValidateRtpExtensions(extensions)); |
} |
TEST(WebRtcMediaEngineTest, ValidateRtpExtensions_OverlappingIds_EndOfSet) { |
- std::vector<RtpHeaderExtension> extensions = MakeUniqueExtensions(); |
- extensions.push_back(RtpHeaderExtension("foo", 14)); |
+ std::vector<RtpExtension> extensions = MakeUniqueExtensions(); |
+ extensions.push_back(RtpExtension("foo", 14)); |
EXPECT_FALSE(ValidateRtpExtensions(extensions)); |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_EmptyList) { |
- std::vector<RtpHeaderExtension> extensions; |
+ std::vector<RtpExtension> extensions; |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions1, true); |
EXPECT_EQ(0, filtered.size()); |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_IncludeOnlySupported) { |
- std::vector<RtpHeaderExtension> extensions = MakeUniqueExtensions(); |
+ std::vector<RtpExtension> extensions = MakeUniqueExtensions(); |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions1, false); |
EXPECT_EQ(2, filtered.size()); |
- EXPECT_EQ("c", filtered[0].name); |
- EXPECT_EQ("i", filtered[1].name); |
+ EXPECT_EQ("c", filtered[0].uri); |
+ EXPECT_EQ("i", filtered[1].uri); |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_SortedByName_1) { |
- std::vector<RtpHeaderExtension> extensions = MakeUniqueExtensions(); |
+ std::vector<RtpExtension> extensions = MakeUniqueExtensions(); |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions2, false); |
EXPECT_EQ(12, filtered.size()); |
@@ -117,7 +119,7 @@ TEST(WebRtcMediaEngineTest, FilterRtpExtensions_SortedByName_1) { |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_SortedByName_2) { |
- std::vector<RtpHeaderExtension> extensions = MakeUniqueExtensions(); |
+ std::vector<RtpExtension> extensions = MakeUniqueExtensions(); |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions2, true); |
EXPECT_EQ(12, filtered.size()); |
@@ -125,64 +127,56 @@ TEST(WebRtcMediaEngineTest, FilterRtpExtensions_SortedByName_2) { |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_DontRemoveRedundant) { |
- std::vector<RtpHeaderExtension> extensions = MakeRedundantExtensions(); |
+ std::vector<RtpExtension> extensions = MakeRedundantExtensions(); |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions2, false); |
EXPECT_EQ(12, filtered.size()); |
EXPECT_TRUE(IsSorted(filtered)); |
- EXPECT_EQ(filtered[0].name, filtered[1].name); |
+ EXPECT_EQ(filtered[0].uri, filtered[1].uri); |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_RemoveRedundant) { |
- std::vector<RtpHeaderExtension> extensions = MakeRedundantExtensions(); |
+ std::vector<RtpExtension> extensions = MakeRedundantExtensions(); |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions2, true); |
EXPECT_EQ(6, filtered.size()); |
EXPECT_TRUE(IsSorted(filtered)); |
- EXPECT_NE(filtered[0].name, filtered[1].name); |
+ EXPECT_NE(filtered[0].uri, filtered[1].uri); |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_RemoveRedundantBwe_1) { |
- std::vector<RtpHeaderExtension> extensions; |
- extensions.push_back( |
- RtpHeaderExtension(kRtpTransportSequenceNumberHeaderExtension, 3)); |
- extensions.push_back( |
- RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, 9)); |
+ std::vector<RtpExtension> extensions; |
extensions.push_back( |
- RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension, 6)); |
+ RtpExtension(RtpExtension::kTransportSequenceNumberUri, 3)); |
+ extensions.push_back(RtpExtension(RtpExtension::kTimestampOffsetUri, 9)); |
+ extensions.push_back(RtpExtension(RtpExtension::kAbsSendTimeUri, 6)); |
extensions.push_back( |
- RtpHeaderExtension(kRtpTransportSequenceNumberHeaderExtension, 1)); |
- extensions.push_back( |
- RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, 14)); |
+ RtpExtension(RtpExtension::kTransportSequenceNumberUri, 1)); |
+ extensions.push_back(RtpExtension(RtpExtension::kTimestampOffsetUri, 14)); |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions2, true); |
EXPECT_EQ(1, filtered.size()); |
- EXPECT_EQ(kRtpTransportSequenceNumberHeaderExtension, filtered[0].name); |
+ EXPECT_EQ(RtpExtension::kTransportSequenceNumberUri, filtered[0].uri); |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_RemoveRedundantBwe_2) { |
- std::vector<RtpHeaderExtension> extensions; |
- extensions.push_back( |
- RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, 1)); |
- extensions.push_back( |
- RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension, 14)); |
- extensions.push_back( |
- RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, 7)); |
+ std::vector<RtpExtension> extensions; |
+ extensions.push_back(RtpExtension(RtpExtension::kTimestampOffsetUri, 1)); |
+ extensions.push_back(RtpExtension(RtpExtension::kAbsSendTimeUri, 14)); |
+ extensions.push_back(RtpExtension(RtpExtension::kTimestampOffsetUri, 7)); |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions2, true); |
EXPECT_EQ(1, filtered.size()); |
- EXPECT_EQ(kRtpAbsoluteSenderTimeHeaderExtension, filtered[0].name); |
+ EXPECT_EQ(RtpExtension::kAbsSendTimeUri, filtered[0].uri); |
} |
TEST(WebRtcMediaEngineTest, FilterRtpExtensions_RemoveRedundantBwe_3) { |
- std::vector<RtpHeaderExtension> extensions; |
- extensions.push_back( |
- RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, 2)); |
- extensions.push_back( |
- RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, 14)); |
+ std::vector<RtpExtension> extensions; |
+ extensions.push_back(RtpExtension(RtpExtension::kTimestampOffsetUri, 2)); |
+ extensions.push_back(RtpExtension(RtpExtension::kTimestampOffsetUri, 14)); |
std::vector<webrtc::RtpExtension> filtered = |
FilterRtpExtensions(extensions, SupportedExtensions2, true); |
EXPECT_EQ(1, filtered.size()); |
- EXPECT_EQ(kRtpTimestampOffsetHeaderExtension, filtered[0].name); |
+ EXPECT_EQ(RtpExtension::kTimestampOffsetUri, filtered[0].uri); |
} |
} // namespace cricket |