fune/toolkit/content/tests/browser/browser_block_webAudio.js
dvarga 12f19b94e9 Backed out 2 changesets (bug 1362034) for failure at browser/tools/mozscreenshots/primaryUI/browser_primaryUI.js on a CLOSED TREE
Backed out changeset 1c3329958b8a (bug 1362034)
Backed out changeset f68b1b76af36 (bug 1362034)

--HG--
extra : histedit_source : 6169c5ffe856266d3bc8b2ca32f4b67054c71bbe
2018-08-08 22:11:56 +03:00

37 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) {
ChromeUtils.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 = BrowserTestUtils.addTab(window.gBrowser, "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 -");
BrowserTestUtils.removeTab(tab);
});