зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1647425 - part2 : add test. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D81765
This commit is contained in:
Родитель
c3bc9434ee
Коммит
d25afcdf01
|
@ -20,6 +20,12 @@ const MUTED_AUTOPLAY_PAGE =
|
|||
"https://example.com"
|
||||
) + "browser_autoplay_muted.html";
|
||||
|
||||
const EMPTY_PAGE =
|
||||
getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
"https://example.com"
|
||||
) + "empty.html";
|
||||
|
||||
const AUTOPLAY_PREF = "media.autoplay.default";
|
||||
const AUTOPLAY_PERM = "autoplay-media";
|
||||
|
||||
|
@ -220,6 +226,30 @@ add_task(async function testBFCache() {
|
|||
Services.perms.removeAll();
|
||||
});
|
||||
|
||||
add_task(async function testBlockedIconFromCORSIframe() {
|
||||
Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.BLOCKED);
|
||||
|
||||
await BrowserTestUtils.withNewTab(EMPTY_PAGE, async browser => {
|
||||
const blockedIconShownPromise = blockedIconShown();
|
||||
const CORS_AUTOPLAY_PAGE = AUTOPLAY_PAGE.replace(
|
||||
"example.com",
|
||||
"example.org"
|
||||
);
|
||||
info(`Load CORS autoplay on an iframe`);
|
||||
await SpecialPowers.spawn(browser, [CORS_AUTOPLAY_PAGE], async url => {
|
||||
const iframe = content.document.createElement("iframe");
|
||||
iframe.src = url;
|
||||
content.document.body.appendChild(iframe);
|
||||
info("Wait until iframe finishes loading");
|
||||
await new Promise(r => (iframe.onload = r));
|
||||
});
|
||||
await blockedIconShownPromise;
|
||||
ok(true, "Blocked icon shown for the CORS autoplay iframe");
|
||||
});
|
||||
|
||||
Services.perms.removeAll();
|
||||
});
|
||||
|
||||
add_task(async function testChangingBlockingSettingDuringNavigation() {
|
||||
Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.BLOCKED);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче