Bug 1320994 - Increase retries for screensharing preview window. r?florian
MozReview-Commit-ID: IPnLWPT8SNP
--- 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.