Bug 1320994 - Increase retries for screensharing preview window. r?florian draft
authorAndreas Pehrson <pehrsons@gmail.com>
Wed, 03 May 2017 22:58:40 +0200
changeset 572753 2df96d53e78d064aa4a8a8540ae52eef49a6881a
parent 572752 d75e8a06f467d347492b0c0de86568d3160567f7
child 627120 2ead167f1dd37a1bc6fb2c55994761c956c72500
push id57178
push userbmo:pehrson@telenordigital.com
push dateThu, 04 May 2017 17:44:26 +0000
reviewersflorian
bugs1320994
milestone55.0a1
Bug 1320994 - Increase retries for screensharing preview window. r?florian MozReview-Commit-ID: IPnLWPT8SNP
browser/base/content/test/webrtc/browser_devices_get_user_media_screen.js
browser/base/content/test/webrtc/head.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
@@ -50,17 +50,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");
-    yield promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden);
+    yield promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden, 100);
     ok(!document.getElementById("webRTC-preview").hidden,
        "the preview area is visible");
     ok(!document.getElementById("webRTC-previewWarning").hidden,
        "the scary warning is visible");
 
     // Select the 'No Screen' item again, the preview should be hidden.
     menulist.getItemAtIndex(0).doCommand();
     ok(document.getElementById("webRTC-all-windows-shared").hidden,
--- a/browser/base/content/test/webrtc/head.js
+++ b/browser/base/content/test/webrtc/head.js
@@ -25,19 +25,19 @@ function waitForCondition(condition, nex
     if (conditionPassed) {
       moveOn();
     }
     tries++;
   }, 100);
   var moveOn = function() { clearInterval(interval); nextTest(); };
 }
 
-function promiseWaitForCondition(aConditionFn) {
+function promiseWaitForCondition(aConditionFn, retryTimes) {
   let deferred = Promise.defer();
-  waitForCondition(aConditionFn, deferred.resolve, "Condition didn't pass.");
+  waitForCondition(aConditionFn, deferred.resolve, "Condition didn't pass.", retryTimes);
   return deferred.promise;
 }
 
 /**
  * Waits for a window with the given URL to exist.
  *
  * @param url
  *        The url of the window.