summaryrefslogtreecommitdiffstats
path: root/toolkit/components/aboutmemory/tests/xpcshell
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /toolkit/components/aboutmemory/tests/xpcshell
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/aboutmemory/tests/xpcshell')
-rw-r--r--toolkit/components/aboutmemory/tests/xpcshell/test_gpuprocess.js39
-rw-r--r--toolkit/components/aboutmemory/tests/xpcshell/xpcshell.ini5
2 files changed, 44 insertions, 0 deletions
diff --git a/toolkit/components/aboutmemory/tests/xpcshell/test_gpuprocess.js b/toolkit/components/aboutmemory/tests/xpcshell/test_gpuprocess.js
new file mode 100644
index 0000000000..4a77752b17
--- /dev/null
+++ b/toolkit/components/aboutmemory/tests/xpcshell/test_gpuprocess.js
@@ -0,0 +1,39 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+function run_test() {
+ let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
+ let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].getService(
+ Ci.nsIMemoryReporterManager
+ );
+
+ let ok = gfxInfo.controlGPUProcessForXPCShell(true);
+ Assert.equal(ok, true);
+
+ let endTesting = function () {
+ gfxInfo.controlGPUProcessForXPCShell(false);
+ do_test_finished();
+ };
+
+ let foundGPUProcess = false;
+ let onHandleReport = function (
+ aProcess,
+ aPath,
+ aKind,
+ aUnits,
+ aAmount,
+ aDescription
+ ) {
+ if (/GPU \(pid \d+\)/.test(aProcess)) {
+ foundGPUProcess = true;
+ }
+ };
+ let onFinishReporting = function () {
+ Assert.equal(foundGPUProcess, true);
+ endTesting();
+ };
+
+ mgr.getReports(onHandleReport, null, onFinishReporting, null, false);
+ do_test_pending();
+}
diff --git a/toolkit/components/aboutmemory/tests/xpcshell/xpcshell.ini b/toolkit/components/aboutmemory/tests/xpcshell/xpcshell.ini
new file mode 100644
index 0000000000..3a0598bf49
--- /dev/null
+++ b/toolkit/components/aboutmemory/tests/xpcshell/xpcshell.ini
@@ -0,0 +1,5 @@
+[DEFAULT]
+head =
+skip-if = toolkit != 'windows'
+
+[test_gpuprocess.js]