mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-11-20 10:33:36 +00:00
55 lines
1.7 KiB
HTML
55 lines
1.7 KiB
HTML
|
<!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);
|
||
|
|
||
|
// Not started so as to test
|
||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1225003#c2
|
||
|
var oac = new OfflineAudioContext(1, 1, 48000);
|
||
|
|
||
|
var nodeTypes = ["ScriptProcessorNode", "AudioDestinationNode"];
|
||
|
var objectTypes = ["dom-nodes", "engine-objects", "stream-objects"];
|
||
|
|
||
|
var usages = { "explicit/webaudio/audiocontext": 0 };
|
||
|
|
||
|
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);
|
||
|
|
||
|
// To test bug 1225003, run a failing decodeAudioData() job over a time when
|
||
|
// the tasks from getReports() are expected to run.
|
||
|
ac.decodeAudioData(new ArrayBuffer(4), function(){}, function(){});
|
||
|
</script>
|
||
|
</html>
|