browser/devtools/webaudioeditor/test/browser_audionode-actor-get-param-flags.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Test AudioNode#getParamFlags()
michael@0 6 */
michael@0 7
michael@0 8 function spawnTest () {
michael@0 9 let [target, debuggee, front] = yield initBackend(SIMPLE_NODES_URL);
michael@0 10 let [_, nodes] = yield Promise.all([
michael@0 11 front.setup({ reload: true }),
michael@0 12 getN(front, "create-node", 14)
michael@0 13 ]);
michael@0 14
michael@0 15 let allNodeParams = yield Promise.all(nodes.map(node => node.getParams()));
michael@0 16 let nodeTypes = [
michael@0 17 "AudioDestinationNode",
michael@0 18 "AudioBufferSourceNode", "ScriptProcessorNode", "AnalyserNode", "GainNode",
michael@0 19 "DelayNode", "BiquadFilterNode", "WaveShaperNode", "PannerNode", "ConvolverNode",
michael@0 20 "ChannelSplitterNode", "ChannelMergerNode", "DynamicsCompressorNode", "OscillatorNode"
michael@0 21 ];
michael@0 22
michael@0 23 nodeTypes.forEach(function (type, i) {
michael@0 24 let params = allNodeParams[i];
michael@0 25 params.forEach(function ({param, value, flags}) {
michael@0 26
michael@0 27 let testFlags = yield nodes[i].getParamFlag(param);
michael@0 28 ok(typeof testFlags === "object", type + " has flags from #getParamFlag(" + param + ")");
michael@0 29
michael@0 30 if (param === "buffer") {
michael@0 31 is(flags.Buffer, true, "`buffer` params have Buffer flag");
michael@0 32 }
michael@0 33 else if (param === "bufferSize" || param === "frequencyBinCount") {
michael@0 34 is(flags.readonly, true, param + " is readonly");
michael@0 35 }
michael@0 36 else if (param === "curve") {
michael@0 37 is(flags["Float32Array"], true, "`curve` param has Float32Array flag");
michael@0 38 } else {
michael@0 39 is(Object.keys(flags), 0, type + "-" + param + " has no flags set")
michael@0 40 }
michael@0 41 });
michael@0 42 });
michael@0 43
michael@0 44 yield removeTab(target.tab);
michael@0 45 finish();
michael@0 46 }

mercurial