Bug 1835804 - Completely block from doing audio decoding on Content and RDD r=alwu
[gecko.git] / ipc / glue / test / browser / browser_utility_multipleAudio.js
blob7daed145a1b2ddc0c332dc916ecedd70454b6aab
1 /* Any copyright is dedicated to the Public Domain.
2  * http://creativecommons.org/publicdomain/zero/1.0/ */
4 "use strict";
6 async function runTest() {
7   info(`Running tests with decoding from Utility`);
9   const platform = Services.appinfo.OS;
11   for (let { src, expectations } of audioTestData()) {
12     if (!(platform in expectations)) {
13       info(`Skipping ${src} for ${platform}`);
14       continue;
15     }
17     const expectation = expectations[platform];
19     info(`Add media tabs: ${src}`);
20     let tabs = [await addMediaTab(src), await addMediaTab(src)];
21     let playback = [];
23     info("Play tabs");
24     for (let tab of tabs) {
25       playback.push(play(tab, expectation.process, expectation.decoder));
26     }
28     info("Wait all playback");
29     await Promise.all(playback);
31     let allstop = [];
32     info("Stop tabs");
33     for (let tab of tabs) {
34       allstop.push(stop(tab));
35     }
37     info("Wait all stop");
38     await Promise.all(allstop);
40     let remove = [];
41     info("Remove tabs");
42     for (let tab of tabs) {
43       remove.push(BrowserTestUtils.removeTab(tab));
44     }
46     info("Wait all tabs to be removed");
47     await Promise.all(remove);
48   }
51 add_task(async function testAudioDecodingInUtility() {
52   await runTest(true);
53 });
55 add_task(async function testAudioDecodingInRDD() {
56   await runTest(false);
57 });