blob: 8758cf26297181731222de59ff85f056c761a44c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
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");
BrowserTestUtils.loadURI(tab.linkedBrowser, 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);
});
|