Bug 1221855 - test Web Audio memory reporting r=erahm, a=lizzard
☠☠ backed out by e4629e309487 ☠ ☠
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 06 Nov 2015 16:16:39 +1300
changeset 296707 decfff8497ce
parent 296706 9fbc92fa9e4b
child 296708 c580b1ad0f23
push id5299
push usercbook@mozilla.com
push date2015-11-12 11:33 +0000
treeherdermozilla-beta@decfff8497ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm, lizzard
bugs1221855
milestone43.0
Bug 1221855 - test Web Audio memory reporting r=erahm, a=lizzard
dom/media/webaudio/test/mochitest.ini
dom/media/webaudio/test/test_WebAudioMemoryReporting.html
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -176,8 +176,10 @@ skip-if = (toolkit == 'gonk' && !debug) 
 skip-if = os == 'win' && debug #Bug 1202564
 [test_waveShaperGain.html]
 [test_waveShaperNoCurve.html]
 skip-if = os == 'win' && debug #Bug 1202565
 [test_waveShaperPassThrough.html]
 skip-if = os == 'win' && debug #Bug 1196084
 [test_waveShaperInvalidLengthCurve.html]
 skip-if = os == 'win' && debug #Bug 1202567 
+[test_WebAudioMemoryReporting.html]
+skip-if = debug # assertion failures: bug 1222202
new file mode 100644
--- /dev/null
+++ b/dom/media/webaudio/test/test_WebAudioMemoryReporting.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Web Audio memory reporting</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var ac = new AudioContext();
+var sp = ac.createScriptProcessor(4096, 1, 1);
+sp.connect(ac.destination);
+
+var nodeTypes = ["ScriptProcessorNode", "AudioDestinationNode"];
+var objectTypes = ["dom-nodes", "engine-objects", "stream-objects"];
+
+var usages = {};
+
+for (var i = 0; i < nodeTypes.length; ++i) {
+  for (var j = 0; j < objectTypes.length; ++j) {
+    usages["explicit/webaudio/audio-node/" +
+           nodeTypes[i] + "/" + objectTypes[j]] = 0;
+  }
+}
+
+var handleReport = function(aProcess, aPath, aKind, aUnits, aAmount, aDesc) {
+  if (aPath in usages) {
+    usages[aPath] += aAmount;
+  }
+}
+
+var finished = function () {
+  ok(true, "Yay didn't crash!");
+  for (var resource in usages) {
+    ok(usages[resource] > 0, "Non-zero usage for " + resource);
+  };
+  SimpleTest.finish();
+}
+
+SpecialPowers.Cc["@mozilla.org/memory-reporter-manager;1"].
+  getService(SpecialPowers.Ci.nsIMemoryReporterManager).
+  getReports(handleReport, null, finished, null, /* anonymized = */ false);
+
+</script>
+</html>