Bug 1353910 - Reuse some more code to get rid of more options. r=florian draft
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 07 Apr 2017 13:29:37 -0400
changeset 558420 9b2a3ceb808f3cee80d94f194400047b1ab90fed
parent 558419 f292b8eee8ce4d6bc44709fae054daaa58fb818d
child 623209 591f6edeb7783065c9b601f7f63d9551c227ab69
push id52889
push userbmo:mrbkap@mozilla.com
push dateFri, 07 Apr 2017 17:30:02 +0000
reviewersflorian
bugs1353910
milestone55.0a1
Bug 1353910 - Reuse some more code to get rid of more options. r=florian MozReview-Commit-ID: 3NUJa17qUHy
browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
browser/base/content/test/webrtc/browser_devices_get_user_media_unprompted_access_tear_off_tab.js
browser/base/content/test/webrtc/head.js
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
@@ -208,16 +208,10 @@ var gTests = [
 
     yield reloadAndAssertClosedStreams();
   }
 }
 
 ];
 
 add_task(async function test() {
-  let rootDir = getRootDirectory(gTestPath);
-  rootDir = rootDir.replace("chrome://mochitests/content/",
-                            "https://example.com/");
-  let url = rootDir + "get_user_media.html";
-  let testUrl = `data:text/html,<iframe id="frame1" src="${url}"></iframe><iframe id="frame2" src="${url}"></iframe>`
-
-  await runTests(gTests, { absoluteURI: testUrl });
+  await runTests(gTests, { relativeURI: "get_user_media_in_frame.html" });
 });
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
@@ -58,12 +58,12 @@ var gTests = [
 
 ];
 
 add_task(async function test() {
   await SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processCount", 1]]});
 
   // An empty tab where we can load the content script without leaving it
   // behind at the end of the test.
-  let tab = gBrowser.addTab();
+  gBrowser.addTab();
 
   await runTests(gTests);
 });
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_unprompted_access_tear_off_tab.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_unprompted_access_tear_off_tab.js
@@ -52,12 +52,12 @@ var gTests = [
 
 ];
 
 add_task(async function test() {
   await SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processCount", 1]]});
 
   // An empty tab where we can load the content script without leaving it
   // behind at the end of the test.
-  let tab = gBrowser.addTab();
+  gBrowser.addTab();
 
   await runTests(gTests);
 });
--- a/browser/base/content/test/webrtc/head.js
+++ b/browser/base/content/test/webrtc/head.js
@@ -517,28 +517,23 @@ function promiseReloadFrame(aFrameId) {
            .getElementById(contentFrameId)
            .contentWindow
            .location
            .reload();
   });
 }
 
 async function runTests(tests, options = {}) {
-  let absoluteURI, cleanup;
-  if (options.absoluteURI) {
-    absoluteURI = options.absoluteURI;
-  } else {
-    let leaf = options.relativeURI || "get_user_media.html";
+  let leaf = options.relativeURI || "get_user_media.html";
 
-    let rootDir = getRootDirectory(gTestPath);
-    rootDir = rootDir.replace("chrome://mochitests/content/",
-                              "https://example.com/");
-    absoluteURI = rootDir + leaf;
-  }
-  cleanup = options.cleanup || (() => expectNoObserverCalled());
+  let rootDir = getRootDirectory(gTestPath);
+  rootDir = rootDir.replace("chrome://mochitests/content/",
+                            "https://example.com/");
+  let absoluteURI = rootDir + leaf;
+  let cleanup = options.cleanup || (() => expectNoObserverCalled());
 
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, absoluteURI);
   let browser = tab.linkedBrowser;
 
   browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
 
   is(PopupNotifications._currentNotifications.length, 0,
      "should start the test without any prior popup notification");