Bug 1428844 - Use BrowserTestUtils.waitForEvent in preferences tests; r?johannh
In preferences tests, all calls to waitForEvent function defined in
browser/components/preferences/in-content/tests/head.js has been replaced with
calls to BrowserTestUtils.waitForEvent.
MozReview-Commit-ID: IrtGJFtWPPj
--- a/browser/components/preferences/in-content/tests/browser_connection.js
+++ b/browser/components/preferences/in-content/tests/browser_connection.js
@@ -22,17 +22,17 @@ function test() {
/*
The connection dialog alone won't save onaccept since it uses type="child",
so it has to be opened as a sub dialog of the main pref tab.
Open the main tab here.
*/
open_preferences(async function tabOpened(aContentWindow) {
is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
let dialog = await openAndLoadSubDialog(connectionURL);
- let dialogClosingPromise = waitForEvent(dialog.document.documentElement, "dialogclosing");
+ let dialogClosingPromise = BrowserTestUtils.waitForEvent(dialog.document.documentElement, "dialogclosing");
ok(dialog, "connection window opened");
runConnectionTests(dialog);
dialog.document.documentElement.acceptDialog();
let dialogClosingEvent = await dialogClosingPromise;
ok(dialogClosingEvent, "connection window closed");
// runConnectionTests will have changed this pref - make sure it was
--- a/browser/components/preferences/in-content/tests/browser_connection_bug388287.js
+++ b/browser/components/preferences/in-content/tests/browser_connection_bug388287.js
@@ -45,17 +45,17 @@ function test() {
if (finalTest) {
gBrowser.removeCurrentTab();
finish();
return;
}
dialog = await openAndLoadSubDialog(connectionURL);
- dialogClosingPromise = waitForEvent(dialog.document.documentElement, "dialogclosing");
+ dialogClosingPromise = BrowserTestUtils.waitForEvent(dialog.document.documentElement, "dialogclosing");
doc = dialog.document;
proxyTypePref = dialog.Preferences.get("network.proxy.type");
sharePref = dialog.Preferences.get("network.proxy.share_proxy_settings");
httpPref = dialog.Preferences.get("network.proxy.http");
httpPortPref = dialog.Preferences.get("network.proxy.http_port");
ftpPref = dialog.Preferences.get("network.proxy.ftp");
ftpPortPref = dialog.Preferences.get("network.proxy.ftp_port");
--- a/browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js
+++ b/browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js
@@ -28,18 +28,18 @@ add_task(async function() {
ok(true, "Do not disturb is not available on this platform: " + ex.message);
return;
}
let checkbox = doc.getElementById("notificationsDoNotDisturb");
ok(!checkbox.checked, "Checkbox should not be checked by default");
ok(!alertService.manualDoNotDisturb, "Do not disturb should be off by default");
- let checkboxChanged = waitForEvent(checkbox, "command");
+ let checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "command");
checkbox.click();
await checkboxChanged;
ok(alertService.manualDoNotDisturb, "Do not disturb should be enabled when checked");
- checkboxChanged = waitForEvent(checkbox, "command");
+ checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "command");
checkbox.click();
await checkboxChanged;
ok(!alertService.manualDoNotDisturb, "Do not disturb should be disabled when unchecked");
});
--- a/browser/components/preferences/in-content/tests/browser_proxy_backup.js
+++ b/browser/components/preferences/in-content/tests/browser_proxy_backup.js
@@ -41,17 +41,17 @@ function test() {
/*
The connection dialog alone won't save onaccept since it uses type="child",
so it has to be opened as a sub dialog of the main pref tab.
Open the main tab here.
*/
open_preferences(async function tabOpened(aContentWindow) {
is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
let dialog = await openAndLoadSubDialog(connectionURL);
- let dialogClosingPromise = waitForEvent(dialog.document.documentElement, "dialogclosing");
+ let dialogClosingPromise = BrowserTestUtils.waitForEvent(dialog.document.documentElement, "dialogclosing");
ok(dialog, "connection window opened");
dialog.document.documentElement.acceptDialog();
let dialogClosingEvent = await dialogClosingPromise;
ok(dialogClosingEvent, "connection window closed");
// The SOCKS backup should not be replaced by the shared value