Bug 1406350 - part3: Add fake input in mda2 and mda3 mochitests. r?pehrsons draft
authorAlex Chronopoulos <achronop@gmail.com>
Tue, 07 Nov 2017 16:08:11 +0200
changeset 694179 349130abab3689dd56d4005018b166e5b13f83f2
parent 694178 ca7fd96cbf41b3bf541c5bb1b3b6b0da517635cc
child 739281 6e77cf842453b67024ea71d187884ec65e64918e
push id88070
push userachronop@gmail.com
push dateTue, 07 Nov 2017 14:08:58 +0000
reviewerspehrsons
bugs1406350
milestone58.0a1
Bug 1406350 - part3: Add fake input in mda2 and mda3 mochitests. r?pehrsons MozReview-Commit-ID: DHvgI0mbWzi
dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_audio.html
dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html
dom/media/tests/mochitest/test_peerConnection_addAudioTrackToExistingVideoStream.html
dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html
dom/media/tests/mochitest/test_peerConnection_addSecondAudioStreamNoBundle.html
dom/media/tests/mochitest/test_peerConnection_audioRenegotiationInactiveAnswer.html
dom/media/tests/mochitest/test_peerConnection_removeAudioTrack.html
dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrack.html
dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrackNoBundle.html
dom/media/tests/mochitest/test_peerConnection_verifyAudioAfterRenegotiation.html
--- a/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_audio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_audio.html
@@ -11,17 +11,17 @@ createHTML({
   bug: "1259788",
   title: "Test CaptureStream audio content on HTMLMediaElement playing a gUM MediaStream",
   visible: true
 });
 
 var audioContext;
 var gUMAudioElement;
 var analyser;
-runTest(() => getUserMedia({audio: true})
+runTest(() => getUserMedia({fake: true, audio: true})
   .then(stream => {
     gUMAudioElement = createMediaElement("audio", "gUMAudio");
     gUMAudioElement.srcObject = stream;
 
     audioContext = new AudioContext();
     info("Capturing");
 
     analyser = new AudioStreamAnalyser(audioContext,
--- a/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html
@@ -8,17 +8,17 @@
 <pre id="test">
 <script type="application/javascript">
 createHTML({
   title: "Test getUserMedia peerIdentity Constraint",
   bug: "942367"
 });
 function theTest() {
   function testPeerIdentityConstraint(withConstraint) {
-    var config = { audio: true, video: true };
+    var config = { fake: true, audio: true, video: true };
     if (withConstraint) {
       config.peerIdentity = 'user@example.com';
     }
     info('getting media with constraints: ' + JSON.stringify(config));
     return getUserMedia(config)
       .then(stream => Promise.all([
         audioIsSilence(withConstraint, stream),
         videoIsBlack(withConstraint, stream)
--- a/dom/media/tests/mochitest/test_peerConnection_addAudioTrackToExistingVideoStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addAudioTrackToExistingVideoStream.html
@@ -11,34 +11,34 @@
     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};
+          var localConstraints = {fake: true, 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}], []);
+          test.setMediaConstraints([{fake: true, 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);
--- a/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html
@@ -11,19 +11,19 @@
     title: "Renegotiation: add second audio stream"
   });
 
   runNetworkTest(function (options) {
     const test = new PeerConnectionTest(options);
     addRenegotiation(test.chain,
       [
         function PC_LOCAL_ADD_SECOND_STREAM(test) {
-          test.setMediaConstraints([{audio: true}, {audio: true}],
-                                   [{audio: true}]);
-          return test.pcLocal.getAllUserMedia([{audio: true}]);
+          test.setMediaConstraints([{fake: true, audio: true}, {fake: true, audio: true}],
+                                   [{fake: true, audio: true}]);
+          return test.pcLocal.getAllUserMedia([{fake: true, audio: true}]);
         },
       ],
       [
         function PC_REMOTE_CHECK_ADDED_TRACK(test) {
           // We test both tracks to avoid an ordering problem
           is(test.pcRemote._pc.getReceivers().length, 2,
              "pcRemote should have two receivers");
           return Promise.all(test.pcRemote._pc.getReceivers().map(r => {
@@ -31,15 +31,15 @@
                 new AudioContext(), new MediaStream([r.track]));
             const freq = analyser.binIndexForFrequency(TEST_AUDIO_FREQ);
             return analyser.waitForAnalysisSuccess(arr => arr[freq] > 200);
           }));
         },
       ]
     );
 
-    test.setMediaConstraints([{audio: true}], [{audio: true}]);
+    test.setMediaConstraints([{fake: true, audio: true}], [{fake: true, audio: true}]);
     test.run();
   });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStreamNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStreamNoBundle.html
@@ -12,22 +12,22 @@
   });
 
   runNetworkTest(function (options = {}) {
     options.bundle = false;
     const test = new PeerConnectionTest(options);
     addRenegotiation(test.chain,
       [
         function PC_LOCAL_ADD_SECOND_STREAM(test) {
-          test.setMediaConstraints([{audio: true}, {audio: true}],
-                                   [{audio: true}]);
+          test.setMediaConstraints([{fake: true, audio: true}, {fake: true, audio: true}],
+                                   [{fake: true, audio: true}]);
           // Since this is a NoBundle variant, adding a track will cause us to
           // go back to checking.
           test.pcLocal.expectIceChecking();
-          return test.pcLocal.getAllUserMedia([{audio: true}]);
+          return test.pcLocal.getAllUserMedia([{fake: true, audio: true}]);
         },
         function PC_REMOTE_EXPECT_ICE_CHECKING(test) {
           test.pcRemote.expectIceChecking();
         },
       ],
       [
         function PC_REMOTE_CHECK_ADDED_TRACK(test) {
           // We test both tracks to avoid an ordering problem
@@ -39,15 +39,15 @@
             const freq = analyser.binIndexForFrequency(TEST_AUDIO_FREQ);
             return analyser.waitForAnalysisSuccess(arr => arr[freq] > 200);
           }));
         },
       ]
     );
 
     // TODO(bug 1093835): figure out how to verify if media flows through the new stream
-    test.setMediaConstraints([{audio: true}], [{audio: true}]);
+    test.setMediaConstraints([{fake: true, audio: true}], [{fake: true, audio: true}]);
     test.run();
   });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_audioRenegotiationInactiveAnswer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_audioRenegotiationInactiveAnswer.html
@@ -12,17 +12,17 @@
     title: "Renegotiation: answerer uses a=inactive for audio"
   });
 
   var test;
   runNetworkTest(function (options) {
     var helper = new AudioStreamHelper();
 
     test = new PeerConnectionTest(options);
-    test.setMediaConstraints([{audio: true}], []);
+    test.setMediaConstraints([{fake: true, audio: true}], []);
 
     test.chain.append([
       function PC_REMOTE_CHECK_AUDIO_FLOWING() {
         return helper.checkAudioFlowing(test.pcRemote._pc.getRemoteStreams()[0]);
       }
     ]);
 
     addRenegotiation(test.chain, []);
--- a/dom/media/tests/mochitest/test_peerConnection_removeAudioTrack.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeAudioTrack.html
@@ -42,15 +42,15 @@
           is(receivedTrack.readyState, "ended",
              "The received track should have ended");
 
           return analyser.waitForAnalysisSuccess(arr => arr[freq] < 50);
         },
       ]
     );
 
-    test.setMediaConstraints([{audio: true}], [{audio: true}]);
+    test.setMediaConstraints([{fake: true, audio: true}], [{fake: true, audio: true}]);
     test.run();
   });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrack.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrack.html
@@ -24,17 +24,17 @@
         function PC_LOCAL_REMOVE_AUDIO_TRACK(test) {
           return test.pcLocal.removeSender(0);
         },
         function PC_LOCAL_ADD_AUDIO_TRACK(test) {
           // The new track's pipeline will start with a packet count of
           // 0, but the remote side will keep its old pipeline and packet
           // count.
           test.pcLocal.disableRtpCountChecking = true;
-          return test.pcLocal.getAllUserMedia([{audio: true}]);
+          return test.pcLocal.getAllUserMedia([{fake: true, audio: true}]);
         },
       ],
       [
         function PC_REMOTE_CHECK_ADDED_TRACK(test) {
           is(test.pcRemote._pc.getReceivers().length, 1,
               "pcRemote should still have one receiver");
           const track = test.pcRemote._pc.getReceivers()[0].track;
           isnot(originalTrack.id, track.id, "Receiver should have changed");
@@ -42,15 +42,15 @@
           const analyser = new AudioStreamAnalyser(
               new AudioContext(), new MediaStream([track]));
           const freq = analyser.binIndexForFrequency(TEST_AUDIO_FREQ);
           return analyser.waitForAnalysisSuccess(arr => arr[freq] > 200);
         },
       ]
     );
 
-    test.setMediaConstraints([{audio: true}], [{audio: true}]);
+    test.setMediaConstraints([{fake: true, audio: true}], [{fake: true, audio: true}]);
     test.run();
   });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrackNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrackNoBundle.html
@@ -24,17 +24,17 @@
         function PC_LOCAL_REMOVE_AUDIO_TRACK(test) {
           // The new track's pipeline will start with a packet count of
           // 0, but the remote side will keep its old pipeline and packet
           // count.
           test.pcLocal.disableRtpCountChecking = true;
           return test.pcLocal.removeSender(0);
         },
         function PC_LOCAL_ADD_AUDIO_TRACK(test) {
-          return test.pcLocal.getAllUserMedia([{audio: true}]);
+          return test.pcLocal.getAllUserMedia([{fake:true, audio: true}]);
         },
       ],
       [
         function PC_REMOTE_CHECK_ADDED_TRACK(test) {
           is(test.pcRemote._pc.getReceivers().length, 1,
               "pcRemote should still have one receiver");
           const track = test.pcRemote._pc.getReceivers()[0].track;
           isnot(originalTrack.id, track.id, "Receiver should have changed");
@@ -45,15 +45,15 @@
           return analyser.waitForAnalysisSuccess(arr => arr[freq] > 200);
         },
       ]
     );
 
     test.chain.insertAfterEach('PC_LOCAL_CREATE_OFFER',
                                PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER);
 
-    test.setMediaConstraints([{audio: true}], [{audio: true}]);
+    test.setMediaConstraints([{fake:true, audio: true}], [{fake:true, audio: true}]);
     test.run();
   });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_verifyAudioAfterRenegotiation.html
+++ b/dom/media/tests/mochitest/test_peerConnection_verifyAudioAfterRenegotiation.html
@@ -41,19 +41,19 @@
           .then(() => info("Checking remote audio disabled"))
           .then(() => helper.checkAudioNotFlowing(test.pcRemote._pc.getRemoteStreams()[0]))
       }
     ]);
 
     addRenegotiation(test.chain,
       [
         function PC_LOCAL_ADD_SECOND_STREAM(test) {
-          test.setMediaConstraints([{audio: true}],
+          test.setMediaConstraints([{fake: true, audio: true}],
                                    []);
-          return test.pcLocal.getAllUserMedia([{audio: true}]);
+          return test.pcLocal.getAllUserMedia([{fake: true, audio: true}]);
         },
       ]
     );
 
     test.chain.append([
       function CHECK_ASSUMPTIONS2() {
         is(test.pcLocal.localMediaElements.length, 2,
            "pcLocal should have two media elements");
@@ -86,15 +86,15 @@
 
           .then(() => info("Checking local audio enabled"))
           .then(() => helper.checkAudioFlowing(test.pcLocal._pc.getLocalStreams()[0]))
           .then(() => info("Checking remote audio enabled"))
           .then(() => helper.checkAudioFlowing(test.pcRemote._pc.getRemoteStreams()[0]))
       }
     ]);
 
-    test.setMediaConstraints([{audio: true}], []);
+    test.setMediaConstraints([{fake: true, audio: true}], []);
     test.run();
   });
 </script>
 </pre>
 </body>
 </html>