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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// The purpose of that test is to reproduce edge case behaviors that one can
// have while running whole ipc/glue/test/browser/ suite but that could this
// way be intermittent and hard to diagnose. By having such a test we make sure
// it is cleanly reproduced and wont regress somewhat silently.
"use strict";
async function runTest(src, process, decoder) {
info(`Add media tabs: ${src}`);
let tab = await addMediaTab(src);
info("Play tab");
await play(tab, process, decoder);
info("Stop tab");
await stop(tab);
info("Remove tab");
await BrowserTestUtils.removeTab(tab);
}
async function findGenericAudioDecoder() {
const audioDecoders = (await ChromeUtils.requestProcInfo()).children.filter(
p => {
return (
p.type === "utility" &&
p.utilityActors.find(a => a.actorName === "audioDecoder_Generic")
);
}
);
ok(audioDecoders.length === 1, "Only one audio decoder present");
return audioDecoders[0].pid;
}
add_setup(async function setup() {
await SpecialPowers.pushPrefEnv({
set: [["media.utility-process.enabled", true]],
});
});
add_task(async function testKill() {
await runTest("small-shot.ogg", "Utility Generic", "vorbis audio decoder");
await cleanUtilityProcessShutdown(
"audioDecoder_Generic",
true /* preferKill */
);
info("Waiting 15s to trigger mShutdownBlockers assertions");
await new Promise((resolve, reject) => {
/* eslint-disable mozilla/no-arbitrary-setTimeout */
setTimeout(resolve, 15 * 1000);
});
ok(true, "Waited 15s to trigger mShutdownBlockers assertions: over");
});
add_task(async function testShutdown() {
await runTest("small-shot.ogg", "Utility Generic", "vorbis audio decoder");
const audioDecoderPid = await findGenericAudioDecoder();
ok(audioDecoderPid > 0, `Valid PID found: ${audioDecoderPid}`);
await cleanUtilityProcessShutdown("audioDecoder_Generic");
info("Waiting 15s to trigger mShutdownBlockers assertions");
await new Promise((resolve, reject) => {
/* eslint-disable mozilla/no-arbitrary-setTimeout */
setTimeout(resolve, 15 * 1000);
});
ok(true, "Waited 15s to trigger mShutdownBlockers assertions: over");
});
|