Bug 1315737 - Test that allowed_domains is no longer needed for screensharing. r=jesup
authorJan-Ivar Bruaroey <jib@mozilla.com>
Mon, 07 Nov 2016 13:51:58 -0500
changeset 351544 3d0b7a58598b324fd0e72a72aa6e800d69e5521f
parent 351543 56dfef4b382a41fbbefcec7a9d159cd32835bf9c
child 351545 5d5799848acf017b982b8febf15a9ca154a09473
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1315737
milestone52.0a1
Bug 1315737 - Test that allowed_domains is no longer needed for screensharing. r=jesup MozReview-Commit-ID: FNMuqq9fzKu
dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
--- a/dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
@@ -6,20 +6,16 @@
 <body>
 <pre id="test">
 <script type="application/javascript">
   createHTML({
     title: "getUserMedia Basic Screenshare Test",
     bug: "1211656"
   });
 
-  var mustFailWith = (msg, reason, f) =>
-    f().then(() => ok(false, msg + " must fail"),
-             e => is(e.name, reason, msg + " must fail: " + e.message));
-
   var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
 
   /**
    * Run a test to verify that we can complete a start and stop media playback
    * cycle for a screenshare LocalMediaStream on a video HTMLMediaElement.
    */
   runTest(function () {
     const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
@@ -58,25 +54,19 @@
         height: 200,
         frameRate: {
           min: '5',
           max: '10'
         }
       }
     ];
     return Promise.resolve()
+      // Screensharing must work even without "mochi.test," in allowed_domains
       .then(() => pushPrefs(["media.getusermedia.screensharing.allowed_domains",
                              "mozilla.github.io,*.bugzilla.mozilla.org"]))
-      .then(() => mustFailWith("Screensharing if absent in allowed_domains",
-                               "NotAllowedError",
-                               () => navigator.mediaDevices.getUserMedia({
-                                 video: videoConstraints[0], fake: false
-                               })))
-      .then(() => pushPrefs(["media.getusermedia.screensharing.allowed_domains",
-                             "mozilla.github.io,mochi.test,*.bugzilla.mozilla.org"]))
       .then(() => getUserMedia(constraints).then(stream => {
         var playback = new LocalMediaStreamPlayback(testVideo, stream);
         return playback.playMediaWithDeprecatedStreamStop(false);
       }))
       .then(() => getUserMedia({video: videoConstraints[0], fake: false}))
       .then(stream => {
         var playback = new LocalMediaStreamPlayback(testVideo, stream);
         playback.startMedia(false);