aboutsummaryrefslogtreecommitdiff
path: root/pc/webrtcsdp_unittest.cc
diff options
context:
space:
mode:
authorJohannes Kron <kron@webrtc.org>2018-09-06 12:12:28 +0200
committerCommit Bot <commit-bot@chromium.org>2018-09-10 08:43:52 +0000
commit211856b956d8099ef99b9dbe16ce77dcf78d0bb4 (patch)
tree077824ed8192112b174f15c5704d10c6107ff0b5 /pc/webrtcsdp_unittest.cc
parent2903888cdef80d5b1a4ce26b30379121a9f17f7b (diff)
downloadwebrtc-211856b956d8099ef99b9dbe16ce77dcf78d0bb4.tar.gz
Make HasAttribute handle partial matching of attribute names.
Improve HasAttribute to handle the case where the beginning of an attribute name is also an attribute name in it self. Two attributes that have this relation are extmap-allow-mixed and extmap. Bug: webrtc:9712 Change-Id: Iee660cc6e3dc7f2e7c56664a4f0ffb298eca9208 Reviewed-on: https://webrtc-review.googlesource.com/97422 Commit-Queue: Johannes Kron <kron@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24640}
Diffstat (limited to 'pc/webrtcsdp_unittest.cc')
-rw-r--r--pc/webrtcsdp_unittest.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/pc/webrtcsdp_unittest.cc b/pc/webrtcsdp_unittest.cc
index bfae1b9a12..9c10554631 100644
--- a/pc/webrtcsdp_unittest.cc
+++ b/pc/webrtcsdp_unittest.cc
@@ -3566,6 +3566,35 @@ TEST_F(WebRtcSdpTest, IceCredentialsInCandidateStringIgnored) {
EXPECT_EQ("pwd_voice", c.password());
}
+// Test that attribute lines "a=ice-ufrag-something"/"a=ice-pwd-something" are
+// ignored, and only the "a=ice-ufrag"/"a=ice-pwd" attributes are used.
+// Regression test for:
+// https://bugs.chromium.org/p/webrtc/issues/detail?id=9712
+TEST_F(WebRtcSdpTest, AttributeWithPartialMatchingNameIsIgnored) {
+ static const char kSdpWithFooIceCredentials[] =
+ "v=0\r\n"
+ "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "t=0 0\r\n"
+ "m=audio 9 RTP/SAVPF 111\r\n"
+ "c=IN IP4 0.0.0.0\r\n"
+ "a=rtcp:9 IN IP4 0.0.0.0\r\n"
+ "a=ice-ufrag-something:foo\r\na=ice-pwd-something:bar\r\n"
+ "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n"
+ "a=rtpmap:111 opus/48000/2\r\n"
+ "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host "
+ "generation 2\r\n";
+
+ JsepSessionDescription jdesc_output(kDummyType);
+ EXPECT_TRUE(SdpDeserialize(kSdpWithFooIceCredentials, &jdesc_output));
+ const IceCandidateCollection* candidates = jdesc_output.candidates(0);
+ ASSERT_NE(nullptr, candidates);
+ ASSERT_EQ(1U, candidates->count());
+ cricket::Candidate c = candidates->at(0)->candidate();
+ EXPECT_EQ("ufrag_voice", c.username());
+ EXPECT_EQ("pwd_voice", c.password());
+}
+
// Test that SDP with an invalid port number in "a=candidate" lines is
// rejected, without crashing.
// Regression test for: