Add an xpcshell test for memory reporting in the GPU process. (bug 1321492 part 9, r=erahm)
authorDavid Anderson <danderson@mozilla.com>
Thu, 26 Jan 2017 16:35:55 -0800
changeset 331356 6f89d6e49794d19952487a8a841edc1353e384de
parent 331355 51fe2c86f610aaf312c946e3c2a401c326a4fc8a
child 331357 45009ef6d27f9cf24859ace8f2d8e00ba08843ba
push id31266
push usercbook@mozilla.com
push dateFri, 27 Jan 2017 09:44:04 +0000
treeherdermozilla-central@8dbe89935366 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1321492
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Add an xpcshell test for memory reporting in the GPU process. (bug 1321492 part 9, r=erahm)
toolkit/components/aboutmemory/moz.build
toolkit/components/aboutmemory/tests/xpcshell/test_gpuprocess.js
toolkit/components/aboutmemory/tests/xpcshell/xpcshell.ini
--- a/toolkit/components/aboutmemory/moz.build
+++ b/toolkit/components/aboutmemory/moz.build
@@ -1,12 +1,15 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
+XPCSHELL_TESTS_MANIFESTS += [
+    'tests/xpcshell/xpcshell.ini',
+]
 
 JAR_MANIFESTS += ['jar.mn']
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'about:memory')
new file mode 100644
--- /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";
+
+let { classes: Cc, interfaces: Ci } = Components;
+
+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);
+  do_check_eq(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() {
+    do_check_eq(foundGPUProcess, true);
+    endTesting();
+  };
+
+  mgr.getReports(
+    onHandleReport,
+    null,
+    onFinishReporting,
+    null,
+    false);
+  do_test_pending();
+}
new file mode 100644
--- /dev/null
+++ b/toolkit/components/aboutmemory/tests/xpcshell/xpcshell.ini
@@ -0,0 +1,5 @@
+[DEFAULT]
+head =
+skip-if = toolkit != 'windows'
+
+[test_gpuprocess.js]