Bug 1246310 - Mochitest for adding audio track to video-only PeerConnection. r=drno
authorAndreas Pehrson <pehrsons@gmail.com>
Tue, 19 Apr 2016 14:52:04 +0200
changeset 331884 cc01ccccdedcc384176c1fa3694d79d0e3213ac0
parent 331883 21fbd1600568cde426d38a5768e2eb0cc925e06f
child 331885 34d7c1009ea882388eb2b2cc62f6ac6dbbb3c9b1
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1246310
milestone48.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 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
@@ -203,16 +203,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,54 @@
+<!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);
+    test.chain.replace("PC_LOCAL_GUM",
+      [
+        function PC_LOCAL_GUM_ATTACH_VIDEO_ONLY(test) {
+          var localConstraints = {audio: true, video: true};
+          test.setMediaConstraints([{video: true}], []);
+          return getUserMedia(localConstraints)
+            .then(s => test.originalGumStream = s)
+            .then(() => is(test.originalGumStream.getAudioTracks().length, 1,
+                           "Should have 1 audio track"))
+            .then(() => is(test.originalGumStream.getVideoTracks().length, 1,
+                           "Should have 1 video track"))
+            .then(() => test.pcLocal.attachLocalTrack(
+                          test.originalGumStream.getVideoTracks()[0],
+                          test.originalGumStream));
+        },
+      ]
+    );
+    addRenegotiation(test.chain,
+      [
+        function PC_LOCAL_ATTACH_SECOND_TRACK_AUDIO(test) {
+          test.setMediaConstraints([{audio: true, video: true}], []);
+          return test.pcLocal.attachLocalTrack(
+                   test.originalGumStream.getAudioTracks()[0],
+                   test.originalGumStream);
+        },
+      ],
+      [
+        function PC_CHECK_REMOTE_AUDIO_FLOW(test) {
+          return test.pcRemote.checkReceivingToneFrom(new AudioContext(), test.pcLocal);
+        }
+      ]
+    );
+
+    test.run();
+  });
+</script>
+</pre>
+</body>
+</html>