summaryrefslogtreecommitdiffstats
path: root/ipc/glue/test
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/glue/test')
-rw-r--r--ipc/glue/test/browser/browser_audio_fallback.toml7
-rw-r--r--ipc/glue/test/browser/browser_audio_fallback_content.toml3
-rw-r--r--ipc/glue/test/browser/browser_audio_locked.toml3
-rw-r--r--ipc/glue/test/browser/browser_audio_shutdown.toml3
-rw-r--r--ipc/glue/test/browser/browser_child_hang.js2
-rw-r--r--ipc/glue/test/browser/browser_utility_audioDecodeCrash.js2
-rw-r--r--ipc/glue/test/browser/browser_utility_audio_shutdown.js8
-rw-r--r--ipc/glue/test/browser/browser_utility_filepicker_crashed.js13
-rw-r--r--ipc/glue/test/browser/browser_utility_memoryReport.js19
-rw-r--r--ipc/glue/test/browser/head.js32
-rw-r--r--ipc/glue/test/browser/mochitest_audio_off.toml7
-rw-r--r--ipc/glue/test/browser/mochitest_audio_on.toml7
-rw-r--r--ipc/glue/test/gtest/TestUtilityProcessSandboxing.cpp6
-rw-r--r--ipc/glue/test/utility_process_xpcom/UtilityProcessTest.cpp27
14 files changed, 90 insertions, 49 deletions
diff --git a/ipc/glue/test/browser/browser_audio_fallback.toml b/ipc/glue/test/browser/browser_audio_fallback.toml
index 0de2a1c9e7..ab2b783e9a 100644
--- a/ipc/glue/test/browser/browser_audio_fallback.toml
+++ b/ipc/glue/test/browser/browser_audio_fallback.toml
@@ -1,9 +1,14 @@
[DEFAULT]
+subsuite = "media-bc"
+tags = "media-engine-compatible"
support-files = [
"head.js",
"head-multiple.js",
]
-prefs = ["media.allow-audio-non-utility=true"]
+prefs = [
+ "media.allow-audio-non-utility=true",
+ "media.wmf.media-engine.channel-decoder.enabled=false"
+]
# Set this since we want to continue monitoring the disabling of pref since we
# still allow it a little bit.
environment = "MOZ_DONT_LOCK_UTILITY_PLZ_FILE_A_BUG=1"
diff --git a/ipc/glue/test/browser/browser_audio_fallback_content.toml b/ipc/glue/test/browser/browser_audio_fallback_content.toml
index 3efc6409ac..f074ac743d 100644
--- a/ipc/glue/test/browser/browser_audio_fallback_content.toml
+++ b/ipc/glue/test/browser/browser_audio_fallback_content.toml
@@ -1,4 +1,6 @@
[DEFAULT]
+subsuite = "media-bc"
+tags = "media-engine-compatible"
support-files = [
"head.js",
"head-multiple.js",
@@ -6,6 +8,7 @@ support-files = [
prefs = [
"media.allow-audio-non-utility=true",
"media.rdd-process.enabled=false",
+ "media.wmf.media-engine.channel-decoder.enabled=false"
]
["browser_utility_multipleAudio_fallback_content.js"]
diff --git a/ipc/glue/test/browser/browser_audio_locked.toml b/ipc/glue/test/browser/browser_audio_locked.toml
index 9f0607bf5f..82a42ff935 100644
--- a/ipc/glue/test/browser/browser_audio_locked.toml
+++ b/ipc/glue/test/browser/browser_audio_locked.toml
@@ -1,3 +1,6 @@
[DEFAULT]
+subsuite = "media-bc"
+tags = "media-engine-compatible"
+prefs = ["media.wmf.media-engine.channel-decoder.enabled=false"]
["browser_utility_audio_locked.js"]
diff --git a/ipc/glue/test/browser/browser_audio_shutdown.toml b/ipc/glue/test/browser/browser_audio_shutdown.toml
index f99fff7830..6dbb8cdf49 100644
--- a/ipc/glue/test/browser/browser_audio_shutdown.toml
+++ b/ipc/glue/test/browser/browser_audio_shutdown.toml
@@ -1,5 +1,8 @@
[DEFAULT]
+subsuite = "media-bc"
+tags = "media-engine-compatible"
support-files = ["head.js"]
+prefs = ["media.wmf.media-engine.channel-decoder.enabled=false"]
["browser_utility_audio_shutdown.js"]
support-files = ["../../../../dom/media/test/small-shot.ogg"]
diff --git a/ipc/glue/test/browser/browser_child_hang.js b/ipc/glue/test/browser/browser_child_hang.js
index cf890a6c61..e74517fbdd 100644
--- a/ipc/glue/test/browser/browser_child_hang.js
+++ b/ipc/glue/test/browser/browser_child_hang.js
@@ -24,7 +24,7 @@ add_task(async function () {
url: "https://example.com/",
forceNewProcess: true,
},
- async function (browser) {
+ async function () {
// browser.frameLoader.remoteTab.osPid is the child pid; once we
// have a way to get notifications about child process termination
// events, that could be useful.
diff --git a/ipc/glue/test/browser/browser_utility_audioDecodeCrash.js b/ipc/glue/test/browser/browser_utility_audioDecodeCrash.js
index 1c7551c623..1662ba06f3 100644
--- a/ipc/glue/test/browser/browser_utility_audioDecodeCrash.js
+++ b/ipc/glue/test/browser/browser_utility_audioDecodeCrash.js
@@ -22,7 +22,7 @@ async function getAudioDecoderPid(expectation) {
async function crashDecoder(expectation) {
const audioPid = await getAudioDecoderPid(expectation);
- ok(audioPid > 0, `Found an audio decoder ${audioPid}`);
+ Assert.greater(audioPid, 0, `Found an audio decoder ${audioPid}`);
const actorIsAudioDecoder = actorNames => {
return actorNames
.split(",")
diff --git a/ipc/glue/test/browser/browser_utility_audio_shutdown.js b/ipc/glue/test/browser/browser_utility_audio_shutdown.js
index a0a4be63f6..046b6914a8 100644
--- a/ipc/glue/test/browser/browser_utility_audio_shutdown.js
+++ b/ipc/glue/test/browser/browser_utility_audio_shutdown.js
@@ -31,7 +31,7 @@ async function findGenericAudioDecoder() {
);
}
);
- ok(audioDecoders.length === 1, "Only one audio decoder present");
+ Assert.strictEqual(audioDecoders.length, 1, "Only one audio decoder present");
return audioDecoders[0].pid;
}
@@ -50,7 +50,7 @@ add_task(async function testKill() {
);
info("Waiting 15s to trigger mShutdownBlockers assertions");
- await new Promise((resolve, reject) => {
+ await new Promise(resolve => {
/* eslint-disable mozilla/no-arbitrary-setTimeout */
setTimeout(resolve, 15 * 1000);
});
@@ -62,12 +62,12 @@ add_task(async function testShutdown() {
await runTest("small-shot.ogg", "Utility Generic", "ffvpx audio decoder");
const audioDecoderPid = await findGenericAudioDecoder();
- ok(audioDecoderPid > 0, `Valid PID found: ${audioDecoderPid}`);
+ Assert.greater(audioDecoderPid, 0, `Valid PID found: ${audioDecoderPid}`);
await cleanUtilityProcessShutdown("audioDecoder_Generic");
info("Waiting 15s to trigger mShutdownBlockers assertions");
- await new Promise((resolve, reject) => {
+ await new Promise(resolve => {
/* eslint-disable mozilla/no-arbitrary-setTimeout */
setTimeout(resolve, 15 * 1000);
});
diff --git a/ipc/glue/test/browser/browser_utility_filepicker_crashed.js b/ipc/glue/test/browser/browser_utility_filepicker_crashed.js
index e8eb83cf30..1cfbb9e591 100644
--- a/ipc/glue/test/browser/browser_utility_filepicker_crashed.js
+++ b/ipc/glue/test/browser/browser_utility_filepicker_crashed.js
@@ -57,13 +57,18 @@ function openFileDialog() {
return pid;
})();
- const file = new Promise((resolve, reject) => {
+ const file = new Promise(resolve => {
info("Opening Windows file dialog");
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
- fp.init(window, "Test: browser_utility_filepicker_crashed.js", fp.modeOpen);
+ fp.init(
+ window.browsingContext,
+ "Test: browser_utility_filepicker_crashed.js",
+ fp.modeOpen
+ );
fp.open(result => {
- ok(
- result == fp.returnCancel,
+ Assert.equal(
+ result,
+ fp.returnCancel,
"filepicker should resolve to cancellation"
);
resolve();
diff --git a/ipc/glue/test/browser/browser_utility_memoryReport.js b/ipc/glue/test/browser/browser_utility_memoryReport.js
index 8cec61b8be..55bc8fbffe 100644
--- a/ipc/glue/test/browser/browser_utility_memoryReport.js
+++ b/ipc/glue/test/browser/browser_utility_memoryReport.js
@@ -15,11 +15,15 @@ add_task(async () => {
const gMgr = Cc["@mozilla.org/memory-reporter-manager;1"].getService(
Ci.nsIMemoryReporterManager
);
- ok(utilityPid !== undefined, `Utility process is running as ${utilityPid}`);
+ Assert.notStrictEqual(
+ utilityPid,
+ undefined,
+ `Utility process is running as ${utilityPid}`
+ );
var utilityReports = [];
- const performCollection = new Promise((resolve, reject) => {
+ const performCollection = new Promise(resolve => {
// Record the reports from the live memory reporters then process them.
let handleReport = function (
aProcess,
@@ -56,13 +60,14 @@ add_task(async () => {
`Collected ${utilityReports.length} reports from utility process ${utilityPid}`
);
ok(!!utilityReports.length, "Collected some reports");
- ok(
- utilityReports.filter(r => r.path === "vsize" && r.amount > 0).length === 1,
+ Assert.strictEqual(
+ utilityReports.filter(r => r.path === "vsize" && r.amount > 0).length,
+ 1,
"Collected vsize report"
);
- ok(
- utilityReports.filter(r => r.path === "resident" && r.amount > 0).length ===
- 1,
+ Assert.strictEqual(
+ utilityReports.filter(r => r.path === "resident" && r.amount > 0).length,
+ 1,
"Collected resident report"
);
ok(
diff --git a/ipc/glue/test/browser/head.js b/ipc/glue/test/browser/head.js
index 8acff88273..7520049cd0 100644
--- a/ipc/glue/test/browser/head.js
+++ b/ipc/glue/test/browser/head.js
@@ -39,7 +39,11 @@ async function getUtilityProcesses(actor = undefined, options = {}) {
async function tryGetUtilityPid(actor, options = {}) {
let process = await getUtilityProcesses(actor, options);
if (!options?.quiet) {
- ok(process.length <= 1, `at most one ${actor} process exists`);
+ Assert.lessOrEqual(
+ process.length,
+ 1,
+ `at most one ${actor} process exists`
+ );
}
return process[0]?.pid;
}
@@ -47,7 +51,7 @@ async function tryGetUtilityPid(actor, options = {}) {
async function checkUtilityExists(actor) {
info(`Looking for a running ${actor} utility process`);
const utilityPid = await tryGetUtilityPid(actor);
- ok(utilityPid > 0, `Found ${actor} utility process ${utilityPid}`);
+ Assert.greater(utilityPid, 0, `Found ${actor} utility process ${utilityPid}`);
return utilityPid;
}
@@ -60,7 +64,11 @@ async function cleanUtilityProcessShutdown(actor, preferKill = false) {
info(`${preferKill ? "Kill" : "Clean shutdown"} Utility Process ${actor}`);
const utilityPid = await tryGetUtilityPid(actor);
- ok(utilityPid !== undefined, `Must have PID for ${actor} utility process`);
+ Assert.notStrictEqual(
+ utilityPid,
+ undefined,
+ `Must have PID for ${actor} utility process`
+ );
const utilityProcessGone = TestUtils.topicObserved(
"ipc:utility-shutdown",
@@ -332,7 +340,7 @@ async function checkAudioDecoder(
const doc = typeof content !== "undefined" ? content.document : document;
let audio = doc.querySelector("audio");
const checkPromise = new Promise((resolve, reject) => {
- const timeUpdateHandler = async ev => {
+ const timeUpdateHandler = async () => {
const debugInfo = await SpecialPowers.wrap(audio).mozRequestDebugInfo();
const audioDecoderName = debugInfo.decoder.reader.audioDecoderName;
@@ -363,7 +371,7 @@ async function checkAudioDecoder(
}
};
- const startPlaybackHandler = async ev => {
+ const startPlaybackHandler = async () => {
ok(
await audio.play().then(
_ => true,
@@ -375,7 +383,7 @@ async function checkAudioDecoder(
audio.addEventListener("timeupdate", timeUpdateHandler, { once: true });
};
- audio.addEventListener("error", async err => {
+ audio.addEventListener("error", async () => {
info(
`Received HTML media error: ${audio.error.code}: ${audio.error.message}`
);
@@ -483,8 +491,9 @@ async function crashSomeUtility(utilityPid, actorsCheck) {
info(`Waiting for utility process ${utilityPid} to go away.`);
let [subject, data] = await utilityProcessGone;
- ok(
- parseInt(data, 10) === utilityPid,
+ Assert.strictEqual(
+ parseInt(data, 10),
+ utilityPid,
`Should match the crashed PID ${utilityPid} with ${data}`
);
ok(
@@ -510,7 +519,7 @@ async function crashSomeUtility(utilityPid, actorsCheck) {
),
"Record should be a utility process crash"
);
- ok(crash.id === dumpID, "Record should have an ID");
+ Assert.strictEqual(crash.id, dumpID, "Record should have an ID");
ok(
actorsCheck(crash.metadata.UtilityActorsName),
`Record should have the correct actors name for: ${crash.metadata.UtilityActorsName}`
@@ -546,8 +555,9 @@ async function crashSomeUtilityActor(
) {
// Get PID for utility type
const procInfos = await getUtilityProcesses(actor);
- ok(
- procInfos.length == 1,
+ Assert.equal(
+ procInfos.length,
+ 1,
`exactly one ${actor} utility process should be found`
);
const utilityPid = procInfos[0].pid;
diff --git a/ipc/glue/test/browser/mochitest_audio_off.toml b/ipc/glue/test/browser/mochitest_audio_off.toml
index d174ea3939..767be0a4b3 100644
--- a/ipc/glue/test/browser/mochitest_audio_off.toml
+++ b/ipc/glue/test/browser/mochitest_audio_off.toml
@@ -1,4 +1,6 @@
[DEFAULT]
+subsuite = "media"
+tags = "media-engine-compatible"
run-if = ["os == 'android' && !isolated_process"] # Bug 1771452
support-files = [
"head.js",
@@ -7,6 +9,9 @@ support-files = [
"../../../../dom/media/test/small-shot.m4a",
"../../../../dom/media/test/small-shot.flac",
]
-prefs = ["media.utility-process.enabled=false"]
+prefs = [
+ "media.utility-process.enabled=false",
+ "media.wmf.media-engine.channel-decoder.enabled=false"
+]
["test_utility_audio_off.html"]
diff --git a/ipc/glue/test/browser/mochitest_audio_on.toml b/ipc/glue/test/browser/mochitest_audio_on.toml
index 908f4005f1..a06930401e 100644
--- a/ipc/glue/test/browser/mochitest_audio_on.toml
+++ b/ipc/glue/test/browser/mochitest_audio_on.toml
@@ -1,4 +1,6 @@
[DEFAULT]
+subsuite = "media"
+tags = "media-engine-compatible"
run-if = ["os == 'android' && !isolated_process"] # Bug 1771452
support-files = [
"head.js",
@@ -7,6 +9,9 @@ support-files = [
"../../../../dom/media/test/small-shot.m4a",
"../../../../dom/media/test/small-shot.flac",
]
-prefs = ["media.utility-process.enabled=true"]
+prefs = [
+ "media.utility-process.enabled=true",
+ "media.wmf.media-engine.channel-decoder.enabled=false"
+]
["test_utility_audio_on.html"]
diff --git a/ipc/glue/test/gtest/TestUtilityProcessSandboxing.cpp b/ipc/glue/test/gtest/TestUtilityProcessSandboxing.cpp
index fff17d63ef..cbb8d30b03 100644
--- a/ipc/glue/test/gtest/TestUtilityProcessSandboxing.cpp
+++ b/ipc/glue/test/gtest/TestUtilityProcessSandboxing.cpp
@@ -30,8 +30,10 @@ TEST(UtilityProcessSandboxing, ParseEnvVar_DisableGenericOnly)
#if defined(XP_DARWIN)
TEST(UtilityProcessSandboxing, ParseEnvVar_DisableAppleAudioOnly)
{
+# if defined(MOZ_APPLEMEDIA)
EXPECT_FALSE(IsUtilitySandboxEnabled(
"utility:1", SandboxingKind::UTILITY_AUDIO_DECODING_APPLE_MEDIA));
+# endif
EXPECT_TRUE(
IsUtilitySandboxEnabled("utility:1", SandboxingKind::GENERIC_UTILITY));
}
@@ -51,11 +53,11 @@ TEST(UtilityProcessSandboxing, ParseEnvVar_DisableGenericOnly_Multiples)
{
EXPECT_FALSE(IsUtilitySandboxEnabled("utility:1,utility:0,utility:2",
SandboxingKind::GENERIC_UTILITY));
-#if defined(XP_DARWIN)
+#if defined(MOZ_APPLEMEDIA)
EXPECT_FALSE(IsUtilitySandboxEnabled(
"utility:1,utility:0,utility:2",
SandboxingKind::UTILITY_AUDIO_DECODING_APPLE_MEDIA));
-#endif // XP_DARWIN
+#endif // MOZ_APPLEMEDIA
#if defined(XP_WIN)
EXPECT_FALSE(
IsUtilitySandboxEnabled("utility:1,utility:0,utility:2",
diff --git a/ipc/glue/test/utility_process_xpcom/UtilityProcessTest.cpp b/ipc/glue/test/utility_process_xpcom/UtilityProcessTest.cpp
index 6c084a3153..9d22d60d0f 100644
--- a/ipc/glue/test/utility_process_xpcom/UtilityProcessTest.cpp
+++ b/ipc/glue/test/utility_process_xpcom/UtilityProcessTest.cpp
@@ -7,6 +7,7 @@
#if defined(ENABLE_TESTS)
# include "mozilla/ipc/UtilityProcessManager.h"
# include "mozilla/ipc/UtilityProcessTest.h"
+# include "mozilla/dom/ChromeUtilsBinding.h"
# include "mozilla/dom/Promise.h"
# include "mozilla/ProcInfo.h"
# include "mozilla/IntentionalCrash.h"
@@ -26,23 +27,17 @@ namespace mozilla::ipc {
static UtilityActorName UtilityActorNameFromString(
const nsACString& aStringName) {
using namespace mozilla::dom;
-
- // We use WebIDLUtilityActorNames because UtilityActorNames is not designed
- // for iteration.
- for (size_t i = 0; i < WebIDLUtilityActorNameValues::Count; ++i) {
- auto idlName = static_cast<UtilityActorName>(i);
- const nsDependentCSubstring idlNameString(
- WebIDLUtilityActorNameValues::GetString(idlName));
- if (idlNameString.Equals(aStringName)) {
- return idlName;
- }
+ auto idlName = StringToEnum<UtilityActorName>(aStringName);
+ if (idlName.isSome()) {
+ return idlName.value();
}
MOZ_CRASH("Unknown utility actor name");
}
// Find the utility process with the given actor or any utility process if
-// the actor is UtilityActorName::EndGuard_.
-static SandboxingKind FindUtilityProcessWithActor(UtilityActorName aActorName) {
+// aActorName is Nothing().
+static SandboxingKind FindUtilityProcessWithActor(
+ const Maybe<UtilityActorName>& aActorName) {
RefPtr<UtilityProcessManager> utilityProc =
UtilityProcessManager::GetSingleton();
MOZ_ASSERT(utilityProc, "No UtilityprocessManager?");
@@ -52,11 +47,11 @@ static SandboxingKind FindUtilityProcessWithActor(UtilityActorName aActorName) {
if (!utilityProc->Process(sbKind)) {
continue;
}
- if (aActorName == UtilityActorName::EndGuard_) {
+ if (aActorName.isNothing()) {
return sbKind;
}
for (auto actor : utilityProc->GetActors(sbKind)) {
- if (actor == aActorName) {
+ if (actor == aActorName.ref()) {
return sbKind;
}
}
@@ -236,9 +231,9 @@ UtilityProcessTest::StopProcess(const char* aActorName) {
if (aActorName) {
const nsDependentCString actorStringName(aActorName);
UtilityActorName actorName = UtilityActorNameFromString(actorStringName);
- sbKind = FindUtilityProcessWithActor(actorName);
+ sbKind = FindUtilityProcessWithActor(Some(actorName));
} else {
- sbKind = FindUtilityProcessWithActor(UtilityActorName::EndGuard_);
+ sbKind = FindUtilityProcessWithActor(Nothing());
}
if (sbKind == SandboxingKind::COUNT) {