fune/toolkit/content/tests/browser/browser_autoplay_audibleMediaOccurred.js
alwu eb9569d512 Bug 1485160 - part2 : add test. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D3931

--HG--
extra : moz-landing-system : lando
2018-08-23 21:50:14 +00:00

25 lines
936 B
JavaScript

/**
* This test is used to test whether the topic 'AudibleAutoplayMediaOccurred'
* is sent correctly when the autoplay audible media tries to start.
*/
"use strict";
const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback.html";
add_task(async function testAudibleAutoplayMedia() {
info("- open new tab -");
let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
"about:blank");
let browser = tab.linkedBrowser;
// start observing the topic before loading the page to ensure we can get it.
let audibleAutoplayOccurred = TestUtils.topicObserved("AudibleAutoplayMediaOccurred");
browser.loadURI(PAGE);
await BrowserTestUtils.browserLoaded(browser);
await audibleAutoplayOccurred;
ok(true, "Got the topic 'AudibleAutoplayMediaOccurred'.");
info("- remove tab -");
BrowserTestUtils.removeTab(tab);
});