2017-03-24 09:35:01 +00:00
|
|
|
const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_plugIn.html";
|
|
|
|
|
2017-05-12 12:42:39 +00:00
|
|
|
add_task(async function setup_test_preference() {
|
2017-03-24 09:35:01 +00:00
|
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
|
2017-05-12 12:42:39 +00:00
|
|
|
await SpecialPowers.pushPrefEnv({"set": [
|
2017-03-24 09:35:01 +00:00
|
|
|
["media.useAudioChannelService.testing", true],
|
2018-08-31 05:59:17 +00:00
|
|
|
["media.block-autoplay-until-in-foreground", true],
|
2017-03-24 09:35:01 +00:00
|
|
|
]});
|
|
|
|
});
|
|
|
|
|
2017-05-12 12:42:39 +00:00
|
|
|
add_task(async function block_plug_in() {
|
2017-03-24 09:35:01 +00:00
|
|
|
info("- open new background tab -");
|
2018-07-06 20:16:29 +00:00
|
|
|
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
2018-08-29 14:49:12 +00:00
|
|
|
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
2017-05-12 12:42:39 +00:00
|
|
|
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
2017-03-24 09:35:01 +00:00
|
|
|
|
|
|
|
info("- tab should be blocked -");
|
2017-05-12 12:42:39 +00:00
|
|
|
await waitForTabBlockEvent(tab, true);
|
2017-03-24 09:35:01 +00:00
|
|
|
|
|
|
|
info("- switch tab -");
|
2017-05-12 12:42:39 +00:00
|
|
|
await BrowserTestUtils.switchTab(window.gBrowser, tab);
|
2017-03-24 09:35:01 +00:00
|
|
|
|
|
|
|
info("- tab should be resumed -");
|
2017-05-12 12:42:39 +00:00
|
|
|
await waitForTabBlockEvent(tab, false);
|
2017-03-24 09:35:01 +00:00
|
|
|
|
|
|
|
info("- tab should be audible -");
|
2017-05-12 12:42:39 +00:00
|
|
|
await waitForTabPlayingEvent(tab, true);
|
2017-03-24 09:35:01 +00:00
|
|
|
|
|
|
|
info("- remove tab -");
|
2018-03-19 02:16:45 +00:00
|
|
|
BrowserTestUtils.removeTab(tab);
|
2017-03-24 09:35:01 +00:00
|
|
|
});
|