Bug 1534673 - Part 0: Add some test-cases for sdp without msid-semantics. r=jib
authorByron Campen [:bwc] <docfaraday@gmail.com>
Tue, 19 Mar 2019 16:03:10 +0000
changeset 465100 05f0176414e72fea9214d49b5ff443bba1bb0d8b
parent 465099 05ae948300ea8fd0b963bbd35828ed52bfee2a6e
child 465101 99269d93d2bfcfad806581779a104057e6e266ed
push id35732
push useropoprus@mozilla.com
push dateWed, 20 Mar 2019 10:52:37 +0000
treeherdermozilla-central@708979f9c3f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1534673
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534673 - Part 0: Add some test-cases for sdp without msid-semantics. r=jib Differential Revision: https://phabricator.services.mozilla.com/D23203
testing/web-platform/tests/webrtc/RTCTrackEvent-fire.html
--- a/testing/web-platform/tests/webrtc/RTCTrackEvent-fire.html
+++ b/testing/web-platform/tests/webrtc/RTCTrackEvent-fire.html
@@ -42,29 +42,43 @@ a=ssrc:3 msid:1 2
 `;
 
 const sdp3 = sdpBase + `
 a=msid:1 2
 a=ssrc:3 cname:4
 a=ssrc:3 msid:3 2
 `;
 
+const sdp4 = sdp1.replace('msid-semantic', 'unknownattr');
+
+const sdp5 = sdpBase + `
+a=msid:-
+`;
+
 async function applyRemoteDescriptionAndReturnRemoteTrackAndStreams(pc, sdp)
 {
     const testTrackPromise = new Promise(resolve  => {
         pc.ontrack = (event) => { resolve([event.track, event.streams]); };
     });
     await pc.setRemoteDescription({type: 'offer', sdp: sdp});
     return testTrackPromise;
 }
 
 promise_test(async test => {
     const pc = new RTCPeerConnection();
     test.add_cleanup(() => pc.close());
 
+    const [track, streams] = await applyRemoteDescriptionAndReturnRemoteTrackAndStreams(pc, sdp0);
+    assert_equals(streams.length, 1, "track event has a stream");
+}, "When a=msid is absent, the track should still be associated with a stream");
+
+promise_test(async test => {
+    const pc = new RTCPeerConnection();
+    test.add_cleanup(() => pc.close());
+
     const [track, streams] = await applyRemoteDescriptionAndReturnRemoteTrackAndStreams(pc, sdp1);
     assert_equals(streams.length, 1, "track event has a stream");
     assert_equals(streams[0].id, "1", "msid should match");
 }, "Source-level msid should be ignored if media-level msid is present");
 
 promise_test(async test => {
     const pc = new RTCPeerConnection();
     test.add_cleanup(() => pc.close());
@@ -88,16 +102,33 @@ promise_test(async test => {
     assert_equals(streams.length, 1, "track event has a stream");
     assert_equals(streams[0].id, "1", "msid should match");
 }, "Source-level msid should be ignored, or an error should be thrown, if a different media-level msid is present");
 
 promise_test(async test => {
     const pc = new RTCPeerConnection();
     test.add_cleanup(() => pc.close());
 
+    const [track, streams] = await applyRemoteDescriptionAndReturnRemoteTrackAndStreams(pc, sdp4);
+    assert_equals(streams.length, 1, "track event has a stream");
+    assert_equals(streams[0].id, "1", "msid should match");
+}, "stream ids should be found even if msid-semantic is absent");
+
+promise_test(async test => {
+    const pc = new RTCPeerConnection();
+    test.add_cleanup(() => pc.close());
+
+    const [track, streams] = await applyRemoteDescriptionAndReturnRemoteTrackAndStreams(pc, sdp5);
+    assert_equals(streams.length, 0, "track event has no stream");
+}, "a=msid:- should result in a track event with no streams");
+
+promise_test(async test => {
+    const pc = new RTCPeerConnection();
+    test.add_cleanup(() => pc.close());
+
     const [track, streams] = await applyRemoteDescriptionAndReturnRemoteTrackAndStreams(pc, sdp1);
     assert_equals(streams.length, 1, "track event has a stream");
     assert_equals(streams[0].id, "1", "msid should match");
     const stream = streams[0];
 
     await pc.setLocalDescription(await pc.createAnswer());
 
     const testTrackPromise = new Promise((resolve) => { stream.onremovetrack = resolve; });