Bug 1444054 - Replace promiseWaitForCondition with TestUtils.waitForCondition in browser_devices_get_user_media_screen.js. r=johannh
authorTrisha <guptatrisha97@gmail.com>
Tue, 13 Mar 2018 00:14:30 +0800
changeset 407909 b0344b00dda4
parent 407908 8c5d0d2498ea
child 407910 261fd7bc381b
push id33621
push userapavel@mozilla.com
push dateTue, 13 Mar 2018 17:12:05 +0000
treeherdermozilla-central@deb7714a7bcd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1444054
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1444054 - Replace promiseWaitForCondition with TestUtils.waitForCondition in browser_devices_get_user_media_screen.js. r=johannh
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
@@ -62,17 +62,17 @@ var gTests = [
       is(item.getAttribute("devicetype"), "Screen", "the devicetype attribute is set correctly");
       ok(item.scary, "the screen item is marked as scary");
     }
 
     // Select a screen, a preview with a scary warning should appear.
     menulist.getItemAtIndex(2).doCommand();
     ok(!document.getElementById("webRTC-all-windows-shared").hidden,
        "the 'all windows will be shared' warning should now be visible");
-    await promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden, 100);
+    await TestUtils.waitForCondition(() => !document.getElementById("webRTC-preview").hidden, 100, 100);
     ok(!document.getElementById("webRTC-preview").hidden,
        "the preview area is visible");
     ok(!document.getElementById("webRTC-previewWarning").hidden,
        "the scary warning is visible");
     ok(!notification.button.disabled, "Allow button is enabled");
 
     // Select the 'Select Screen' item again, the preview should be hidden.
     menulist.getItemAtIndex(0).doCommand();
@@ -164,34 +164,34 @@ var gTests = [
         nonScaryIndex = i;
     }
     ok(typeof scaryIndex == "number", "there's at least one scary window, as Firefox is running");
 
     // Select a scary window, a preview with a scary warning should appear.
     menulist.getItemAtIndex(scaryIndex).doCommand();
     ok(document.getElementById("webRTC-all-windows-shared").hidden,
        "the 'all windows will be shared' warning should still be hidden");
-    await promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden);
+    await TestUtils.waitForCondition(() => !document.getElementById("webRTC-preview").hidden);
     ok(!document.getElementById("webRTC-preview").hidden,
        "the preview area is visible");
     ok(!document.getElementById("webRTC-previewWarning").hidden,
        "the scary warning is visible");
 
     // Select the 'Select Window' item again, the preview should be hidden.
     menulist.getItemAtIndex(0).doCommand();
     ok(document.getElementById("webRTC-preview").hidden,
        "the preview area is hidden");
 
     // If we have a non-scary window, select it and verify the warning isn't displayed.
     // A non-scary window may not always exist on test slaves.
     if (typeof nonScaryIndex == "number") {
       menulist.getItemAtIndex(nonScaryIndex).doCommand();
       ok(document.getElementById("webRTC-all-windows-shared").hidden,
          "the 'all windows will be shared' warning should still be hidden");
-      await promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden);
+      await TestUtils.waitForCondition(() => !document.getElementById("webRTC-preview").hidden);
       ok(!document.getElementById("webRTC-preview").hidden,
          "the preview area is visible");
       ok(document.getElementById("webRTC-previewWarning").hidden,
          "the scary warning is hidden");
     } else {
       info("no non-scary window available on this test slave");
 
       // Select the first window again so that we can have a stream.
@@ -272,17 +272,17 @@ var gTests = [
     }
     ok(scaryIndex === undefined,
        "Firefox is currently excluding itself from the list of applications, " +
        "so no scary app should be listed");
 
     menulist.getItemAtIndex(2).doCommand();
     ok(document.getElementById("webRTC-all-windows-shared").hidden,
        "the 'all windows will be shared' warning should still be hidden");
-    await promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden);
+    await TestUtils.waitForCondition(() => !document.getElementById("webRTC-preview").hidden);
     ok(!document.getElementById("webRTC-preview").hidden,
        "the preview area is visible");
     ok(document.getElementById("webRTC-previewWarning").hidden,
        "the scary warning is hidden");
 
     let indicator = promiseIndicatorWindow();
     await promiseMessage("ok", () => {
       PopupNotifications.panel.firstChild.button.click();
@@ -323,17 +323,17 @@ var gTests = [
     let count = menulist.itemCount;
     ok(count >= 3,
        "There should be the 'Select Screen' item, a separator and at least one screen");
 
     // Select a screen, a preview with a scary warning should appear.
     menulist.getItemAtIndex(2).doCommand();
     ok(!document.getElementById("webRTC-all-windows-shared").hidden,
        "the 'all windows will be shared' warning should now be visible");
-    await promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden);
+    await TestUtils.waitForCondition(() => !document.getElementById("webRTC-preview").hidden);
     ok(!document.getElementById("webRTC-preview").hidden,
        "the preview area is visible");
     ok(!document.getElementById("webRTC-previewWarning").hidden,
        "the scary warning is visible");
 
     let indicator = promiseIndicatorWindow();
     await promiseMessage("ok", () => {
       PopupNotifications.panel.firstChild.button.click();
@@ -493,17 +493,17 @@ var gTests = [
     if ("nsISystemStatusBar" in Ci) {
       let activeStreams = webrtcUI.getActiveStreams(false, false, true);
       webrtcUI.showSharingDoorhanger(activeStreams[0]);
     } else {
       let win =
         Services.wm.getMostRecentWindow("Browser:WebRTCGlobalIndicator");
       let elt = win.document.getElementById("screenShareButton");
       EventUtils.synthesizeMouseAtCenter(elt, {}, win);
-      await promiseWaitForCondition(() => !gIdentityHandler._identityPopup.hidden);
+      await TestUtils.waitForCondition(() => !gIdentityHandler._identityPopup.hidden);
     }
     ok(!gIdentityHandler._identityPopup.hidden, "control center should be open");
 
     gIdentityHandler._identityPopup.hidden = true;
     await expectNoObserverCalled();
 
     await closeStream();
   }