mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 21:51:51 -10:00
The browser-chrome test suite now detects and reports unhandled rejections of native Promises, in addition to those created by Promise.jsm. The whitelisting mechanism is updated to use primarily the PromiseTestUtils.expectUncaughtRejection function. Tests will fail if a rejection that is not whitelisted occurs, or if a whitelisted rejection does not occur anymore. MozReview-Commit-ID: 1beGB5GG8Ty
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_webAudio.html";
|
|
|
|
// The tab closing code leaves an uncaught rejection. This test has been
|
|
// whitelisted until the issue is fixed.
|
|
if (!gMultiProcessBrowser) {
|
|
Cu.import("resource://testing-common/PromiseTestUtils.jsm", this);
|
|
PromiseTestUtils.expectUncaughtRejection(/is no longer, usable/);
|
|
}
|
|
|
|
add_task(async function setup_test_preference() {
|
|
await SpecialPowers.pushPrefEnv({"set": [
|
|
["media.useAudioChannelService.testing", true],
|
|
["media.block-autoplay-until-in-foreground", true]
|
|
]});
|
|
});
|
|
|
|
add_task(async function block_web_audio() {
|
|
info("- open new background tab -");
|
|
let tab = window.gBrowser.addTab("about:blank");
|
|
tab.linkedBrowser.loadURI(PAGE);
|
|
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
|
|
|
info("- tab should be blocked -");
|
|
await waitForTabBlockEvent(tab, true);
|
|
|
|
info("- switch tab -");
|
|
await BrowserTestUtils.switchTab(window.gBrowser, tab);
|
|
|
|
info("- tab should be resumed -");
|
|
await waitForTabBlockEvent(tab, false);
|
|
|
|
info("- tab should be audible -");
|
|
await waitForTabPlayingEvent(tab, true);
|
|
|
|
info("- remove tab -");
|
|
await BrowserTestUtils.removeTab(tab);
|
|
});
|