Bug 1508685 - Part 0: Test that answers without mids don't result in an invalid reoffer. r=mjf
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 15 Feb 2019 18:07:20 +0000
changeset 459577 ddf96b931e4be1fe955bad632a1505a16962d7a4
parent 459576 40545233f9fec17e4dfdd766353f1910bb5c9030
child 459578 46cff4bcc9ee3a6c34ef5ad8279f73406fc6f0f2
push id35563
push userccoroiu@mozilla.com
push dateSat, 16 Feb 2019 09:36:04 +0000
treeherdermozilla-central@1cfd69d05aa1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjf
bugs1508685
milestone67.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 1508685 - Part 0: Test that answers without mids don't result in an invalid reoffer. r=mjf Differential Revision: https://phabricator.services.mozilla.com/D19948
testing/web-platform/tests/webrtc/RTCRtpTransceiver.https.html
--- a/testing/web-platform/tests/webrtc/RTCRtpTransceiver.https.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpTransceiver.https.html
@@ -436,16 +436,52 @@
         }
       ]);
 
     const answer = await pc2.createAnswer();
     await pc2.setLocalDescription(answer);
     await pc1.setRemoteDescription(answer);
   };
 
+  const checkNoMidAnswer = async t => {
+    const pc1 = new RTCPeerConnection();
+    const pc2 = new RTCPeerConnection();
+    t.add_cleanup(() => pc1.close());
+    t.add_cleanup(() => pc2.close());
+
+    const stream = await navigator.mediaDevices.getUserMedia({audio: true});
+    t.add_cleanup(() => stopTracks(stream));
+    const track = stream.getAudioTracks()[0];
+    pc1.addTrack(track, stream);
+
+    const offer = await pc1.createOffer();
+    await pc1.setLocalDescription(offer);
+    await pc2.setRemoteDescription(offer);
+    let answer = await pc2.createAnswer();
+    // Remove mid attr
+    answer.sdp = answer.sdp.replace("a=mid:", "a=unknownattr:");
+    // Remove group attr also
+    answer.sdp = answer.sdp.replace("a=group:", "a=unknownattr:");
+    await pc1.setRemoteDescription(answer);
+
+    hasPropsAndUniqueMids(pc1.getTransceivers(),
+      [
+        {
+          receiver: {track: {kind: "audio"}},
+          sender: {track: {kind: "audio"}},
+          direction: "sendrecv",
+          currentDirection: "sendonly",
+          stopped: false
+        }
+      ]);
+
+    const reoffer = await pc1.createOffer();
+    await pc1.setLocalDescription(reoffer);
+  };
+
   const checkAddTransceiverNoTrackDoesntPair = async t => {
     const pc1 = new RTCPeerConnection();
     const pc2 = new RTCPeerConnection();
     t.add_cleanup(() => pc1.close());
     t.add_cleanup(() => pc2.close());
 
     pc1.addTransceiver("audio");
     pc2.addTransceiver("audio");
@@ -2150,16 +2186,17 @@ const tests = [
   checkAddTransceiverNoTrack,
   checkAddTransceiverWithTrack,
   checkAddTransceiverWithAddTrack,
   checkAddTransceiverWithDirection,
   checkAddTransceiverWithSetRemoteOfferSending,
   checkAddTransceiverWithSetRemoteOfferNoSend,
   checkAddTransceiverBadKind,
   checkNoMidOffer,
+  checkNoMidAnswer,
   checkSetDirection,
   checkCurrentDirection,
   checkSendrecvWithNoSendTrack,
   checkSendrecvWithTracklessStream,
   checkAddTransceiverNoTrackDoesntPair,
   checkAddTransceiverWithTrackDoesntPair,
   checkAddTransceiverThenReplaceTrackDoesntPair,
   checkAddTransceiverThenAddTrackPairs,