| Index: webrtc/pc/webrtcsdp_unittest.cc
|
| diff --git a/webrtc/pc/webrtcsdp_unittest.cc b/webrtc/pc/webrtcsdp_unittest.cc
|
| index f5cac8921f3a3fddadf0672f372ce9f2c4713d1d..6e5802727fbc21b42de502691667db26856c53d8 100644
|
| --- a/webrtc/pc/webrtcsdp_unittest.cc
|
| +++ b/webrtc/pc/webrtcsdp_unittest.cc
|
| @@ -94,6 +94,9 @@ static const char kExtmap[] =
|
| "a=extmap:1 http://example.com/082005/ext.htm#ttime\r\n";
|
| static const char kExtmapWithDirectionAndAttribute[] =
|
| "a=extmap:1/sendrecv http://example.com/082005/ext.htm#ttime a1 a2\r\n";
|
| +static const char kExtmapWithDirectionAndAttributeEncrypted[] =
|
| + "a=extmap:1/sendrecv urn:ietf:params:rtp-hdrext:encrypt "
|
| + "http://example.com/082005/ext.htm#ttime a1 a2\r\n";
|
|
|
| static const uint8_t kIdentityDigest[] = {
|
| 0x4A, 0xAD, 0xB9, 0xB1, 0x3F, 0x82, 0x18, 0x3B, 0x54, 0x02,
|
| @@ -1210,6 +1213,7 @@ class WebRtcSdpTest : public testing::Test {
|
| const RtpExtension ext2 = cd2->rtp_header_extensions().at(i);
|
| EXPECT_EQ(ext1.uri, ext2.uri);
|
| EXPECT_EQ(ext1.id, ext2.id);
|
| + EXPECT_EQ(ext1.encrypt, ext2.encrypt);
|
| }
|
| }
|
|
|
| @@ -1431,13 +1435,15 @@ class WebRtcSdpTest : public testing::Test {
|
| cricket::CONNECTIONROLE_NONE, &fingerprint))));
|
| }
|
|
|
| - void AddExtmap() {
|
| + void AddExtmap(bool encrypted) {
|
| audio_desc_ = static_cast<AudioContentDescription*>(
|
| audio_desc_->Copy());
|
| video_desc_ = static_cast<VideoContentDescription*>(
|
| video_desc_->Copy());
|
| - audio_desc_->AddRtpHeaderExtension(RtpExtension(kExtmapUri, kExtmapId));
|
| - video_desc_->AddRtpHeaderExtension(RtpExtension(kExtmapUri, kExtmapId));
|
| + audio_desc_->AddRtpHeaderExtension(
|
| + RtpExtension(kExtmapUri, kExtmapId, encrypted));
|
| + video_desc_->AddRtpHeaderExtension(
|
| + RtpExtension(kExtmapUri, kExtmapId, encrypted));
|
| desc_.RemoveContentByName(kAudioContentName);
|
| desc_.RemoveContentByName(kVideoContentName);
|
| desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_);
|
| @@ -1575,8 +1581,9 @@ class WebRtcSdpTest : public testing::Test {
|
| return true;
|
| }
|
|
|
| - void TestDeserializeExtmap(bool session_level, bool media_level) {
|
| - AddExtmap();
|
| + void TestDeserializeExtmap(bool session_level, bool media_level,
|
| + bool encrypted) {
|
| + AddExtmap(encrypted);
|
| JsepSessionDescription new_jdesc("dummy");
|
| ASSERT_TRUE(new_jdesc.Initialize(desc_.Copy(),
|
| jdesc_.session_id(),
|
| @@ -1584,13 +1591,19 @@ class WebRtcSdpTest : public testing::Test {
|
| JsepSessionDescription jdesc_with_extmap("dummy");
|
| std::string sdp_with_extmap = kSdpString;
|
| if (session_level) {
|
| - InjectAfter(kSessionTime, kExtmapWithDirectionAndAttribute,
|
| + InjectAfter(kSessionTime,
|
| + encrypted ? kExtmapWithDirectionAndAttributeEncrypted
|
| + : kExtmapWithDirectionAndAttribute,
|
| &sdp_with_extmap);
|
| }
|
| if (media_level) {
|
| - InjectAfter(kAttributeIcePwdVoice, kExtmapWithDirectionAndAttribute,
|
| + InjectAfter(kAttributeIcePwdVoice,
|
| + encrypted ? kExtmapWithDirectionAndAttributeEncrypted
|
| + : kExtmapWithDirectionAndAttribute,
|
| &sdp_with_extmap);
|
| - InjectAfter(kAttributeIcePwdVideo, kExtmapWithDirectionAndAttribute,
|
| + InjectAfter(kAttributeIcePwdVideo,
|
| + encrypted ? kExtmapWithDirectionAndAttributeEncrypted
|
| + : kExtmapWithDirectionAndAttribute,
|
| &sdp_with_extmap);
|
| }
|
| // The extmap can't be present at the same time in both session level and
|
| @@ -2129,7 +2142,8 @@ TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithDataChannelAndBandwidth) {
|
| }
|
|
|
| TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithExtmap) {
|
| - AddExtmap();
|
| + bool encrypted = false;
|
| + AddExtmap(encrypted);
|
| JsepSessionDescription desc_with_extmap("dummy");
|
| ASSERT_TRUE(desc_with_extmap.Initialize(desc_.Copy(),
|
| kSessionId, kSessionVersion));
|
| @@ -2144,6 +2158,15 @@ TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithExtmap) {
|
| EXPECT_EQ(sdp_with_extmap, message);
|
| }
|
|
|
| +TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithExtmapEncrypted) {
|
| + bool encrypted = true;
|
| + AddExtmap(encrypted);
|
| + JsepSessionDescription desc_with_extmap("dummy");
|
| + ASSERT_TRUE(desc_with_extmap.Initialize(desc_.Copy(),
|
| + kSessionId, kSessionVersion));
|
| + TestSerialize(desc_with_extmap, false);
|
| +}
|
| +
|
| TEST_F(WebRtcSdpTest, SerializeCandidates) {
|
| std::string message = webrtc::SdpSerializeCandidate(*jcandidate_);
|
| EXPECT_EQ(std::string(kRawCandidate), message);
|
| @@ -2789,18 +2812,32 @@ TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelsAndBandwidth) {
|
| EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_with_bandwidth));
|
| }
|
|
|
| -TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithSessionLevelExtmap) {
|
| - TestDeserializeExtmap(true, false);
|
| +class WebRtcSdpExtmapTest
|
| + : public WebRtcSdpTest, public testing::WithParamInterface<bool> {
|
| +};
|
| +
|
| +TEST_P(WebRtcSdpExtmapTest,
|
| + DeserializeSessionDescriptionWithSessionLevelExtmap) {
|
| + bool encrypted = GetParam();
|
| + TestDeserializeExtmap(true, false, encrypted);
|
| }
|
|
|
| -TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithMediaLevelExtmap) {
|
| - TestDeserializeExtmap(false, true);
|
| +TEST_P(WebRtcSdpExtmapTest,
|
| + DeserializeSessionDescriptionWithMediaLevelExtmap) {
|
| + bool encrypted = GetParam();
|
| + TestDeserializeExtmap(false, true, encrypted);
|
| }
|
|
|
| -TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithInvalidExtmap) {
|
| - TestDeserializeExtmap(true, true);
|
| +TEST_P(WebRtcSdpExtmapTest,
|
| + DeserializeSessionDescriptionWithInvalidExtmap) {
|
| + bool encrypted = GetParam();
|
| + TestDeserializeExtmap(true, true, encrypted);
|
| }
|
|
|
| +INSTANTIATE_TEST_CASE_P(Encrypted,
|
| + WebRtcSdpExtmapTest,
|
| + ::testing::Values(false, true));
|
| +
|
| TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutEndLineBreak) {
|
| JsepSessionDescription jdesc(kDummyString);
|
| std::string sdp = kSdpFullString;
|
|
|