Bug 1246310 - Mochitest for adding audio track to video-only PeerConnection. r?drno draft
authorAndreas Pehrson <pehrsons@gmail.com>
Tue, 19 Apr 2016 14:52:04 +0200
changeset 353692 7055db327f562961f89b9238b3484849e8fdcb62
parent 353691 f887ed052ee57eae8456432eb28a48464e8a9190
child 353693 de7f9a3a9c7d54d0e3a94c958ecdbcb0b219dc68
push id15908
push userpehrsons@gmail.com
push dateTue, 19 Apr 2016 12:54:03 +0000
reviewersdrno
bugs1246310
milestone48.0a1
Bug 1246310 - Mochitest for adding audio track to video-only PeerConnection. r?drno MozReview-Commit-ID: 2c8zfL1n4Vh
dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/test_peerConnection_addAudioTrackToExistingVideoStream.html
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -202,16 +202,19 @@ skip-if = toolkit == 'gonk' || buildapp 
 # b2g(Bug 960442, video support for WebRTC is disabled on b2g), Bug 1127828 for Linux debug e10s, android(Bug 1189784, timeouts on 4.3 emulator)
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (os == 'linux' && debug && e10s) || android_version == '18'
 [test_peerConnection_twoVideoStreams.html]
 # b2g(Bug 960442, video support for WebRTC is disabled on b2g), Bug 1180000 for Linux debug e10s, android(Bug 1189784, timeouts on 4.3 emulator)
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' || android_version == '18'
 [test_peerConnection_twoVideoTracksInOneStream.html]
 # b2g(Bug 960442, video support for WebRTC is disabled on b2g), Bug 1180000 for Linux debug e10s, android(Bug 1189784, timeouts on 4.3 emulator)
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' || os == "android"
+[test_peerConnection_addAudioTrackToExistingVideoStream.html]
+# B2G emulator is too slow to finish a renegotiation test in under 5 minutes, android(Bug 1189784, timeouts on 4.3 emulator)
+skip-if = toolkit == 'gonk' || (android_version == '18' && debug)
 [test_peerConnection_addSecondAudioStream.html]
 skip-if = toolkit == 'gonk' # B2G emulator is too slow to finish a renegotiation test in under 5 minutes
 [test_peerConnection_answererAddSecondAudioStream.html]
 skip-if = toolkit == 'gonk' # B2G emulator is too slow to finish a renegotiation test in under 5 minutes
 [test_peerConnection_removeAudioTrack.html]
 skip-if = toolkit == 'gonk' || (android_version == '18' && debug) # B2G emulator is too slow to finish a renegotiation test in under 5 minutes, android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_removeThenAddAudioTrack.html]
 skip-if = toolkit == 'gonk' || (android_version == '18' && debug) # B2G emulator is too slow to finish a renegotiation test in under 5 minutes, android(Bug 1189784, timeouts on 4.3 emulator)
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/mochitest/test_peerConnection_addAudioTrackToExistingVideoStream.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <script type="application/javascript" src="pc.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+  createHTML({
+    bug: "1246310",
+    title: "Renegotiation: add audio track to existing video-only stream",
+  });
+
+  runNetworkTest(function (options) {
+    var test = new PeerConnectionTest(options);
+    var stream;
+    test.chain.replace("PC_LOCAL_GUM",
+      [
+        function PC_LOCAL_GUM_AV(test) {
+          var localConstraints = {audio: true, video: true};
+          test.setMediaConstraints([{video: true}], []);
+          return getUserMedia(localConstraints)
+            .then(s => stream = s)
+            .then(() => is(stream.getAudioTracks().length, 1,
+                           "Should have 1 audio track"))
+            .then(() => is(stream.getVideoTracks().length, 1,
+                           "Should have 1 video track"))
+            .then(() => test.pcLocal.attachLocalTrack(stream.getVideoTracks()[0], stream));
+        },
+      ]
+    );
+    addRenegotiation(test.chain,
+      [
+        function PC_LOCAL_ADD_SECOND_TRACK(test) {
+          test.setMediaConstraints([{audio: true, video: true}], []);
+          return test.pcLocal.attachLocalTrack(stream.getAudioTracks()[0], stream);
+        },
+      ],
+      [
+        function PC_CHECK_REMOTE_AUDIO_FLOW(test) {
+          return test.pcRemote.checkReceivingToneFrom(new AudioContext(), test.pcLocal);
+        }
+      ]
+    );
+
+    test.run();
+  });
+</script>
+</pre>
+</body>
+</html>