Bug 1353910 - Fix browser_devices_get_user_media_screen.js. r=florian draft
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 06 Apr 2017 12:07:09 -0700
changeset 557430 a2a50cfec47990d6aafb900a7a6e5db597217ef5
parent 557429 e31b4742f1760d7a02c17e0bc937aa5d97fa09d8
child 557431 79318cee049846e71b3c60e650c5cad272eb7ef0
push id52720
push userbmo:mrbkap@mozilla.com
push dateThu, 06 Apr 2017 20:12:02 +0000
reviewersflorian
bugs1353910
milestone55.0a1
Bug 1353910 - Fix browser_devices_get_user_media_screen.js. r=florian MozReview-Commit-ID: HSdNJE4FJ7O
browser/base/content/test/webrtc/browser_devices_get_user_media_screen.js
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_screen.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_screen.js
@@ -1,16 +1,12 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-registerCleanupFunction(function() {
-  gBrowser.removeCurrentTab();
-});
-
 const permissionError = "error: NotAllowedError: The request is not allowed " +
     "by the user agent or the platform in the current context.";
 
 const notFoundError =
     "error: NotFoundError: The object can not be found here.";
 
 var gTests = [
 
@@ -572,44 +568,14 @@ var gTests = [
     yield expectObserverCalled("getUserMedia:response:deny");
     yield expectObserverCalled("recording-window-ended");
     SitePermissions.remove(uri, "screen", browser);
   }
 }
 
 ];
 
-function test() {
-  waitForExplicitFinish();
-
-  let tab = gBrowser.addTab();
-  gBrowser.selectedTab = tab;
-  let browser = tab.linkedBrowser;
-
-  browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
-
-  browser.addEventListener("load", function() {
-    is(PopupNotifications._currentNotifications.length, 0,
-       "should start the test without any prior popup notification");
-    ok(gIdentityHandler._identityPopup.hidden,
-       "should start the test with the control center hidden");
-
-    Task.spawn(function* () {
-      yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
-
-      for (let testCase of gTests) {
-        info(testCase.desc);
-        yield testCase.run();
-
-        // Cleanup before the next test
-        yield expectNoObserverCalled();
-      }
-    }).then(finish, ex => {
-     Cu.reportError(ex);
-     ok(false, "Unexpected Exception: " + ex);
-     finish();
-    });
-  }, {capture: true, once: true});
+add_task(async function test() {
   let rootDir = getRootDirectory(gTestPath);
   rootDir = rootDir.replace("chrome://mochitests/content/",
                             "https://example.com/");
-  content.location = rootDir + "get_user_media.html";
-}
+  await runTests(gTests, rootDir + "get_user_media.html", () => expectNoObserverCalled());
+});