Bug 1246310 - Mochitest for adding audio track to video-only PeerConnection. r?drno
MozReview-Commit-ID: 2c8zfL1n4Vh
--- 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>