michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Test AudioNode#getParams() michael@0: */ michael@0: michael@0: function spawnTest () { michael@0: let [target, debuggee, front] = yield initBackend(SIMPLE_NODES_URL); michael@0: let [_, nodes] = yield Promise.all([ michael@0: front.setup({ reload: true }), michael@0: getN(front, "create-node", 14) michael@0: ]); michael@0: michael@0: let allNodeParams = yield Promise.all(nodes.map(node => node.getParams())); michael@0: let nodeTypes = [ michael@0: "AudioDestinationNode", michael@0: "AudioBufferSourceNode", "ScriptProcessorNode", "AnalyserNode", "GainNode", michael@0: "DelayNode", "BiquadFilterNode", "WaveShaperNode", "PannerNode", "ConvolverNode", michael@0: "ChannelSplitterNode", "ChannelMergerNode", "DynamicsCompressorNode", "OscillatorNode" michael@0: ]; michael@0: michael@0: nodeTypes.forEach((type, i) => { michael@0: let params = allNodeParams[i]; michael@0: params.forEach(({param, value, flags}) => { michael@0: ok(~NODE_PROPERTIES[type].indexOf(param), "expected parameter for " + type); michael@0: michael@0: // Skip over some properties that are undefined by default michael@0: if (!/buffer|loop|smoothing|curve|cone/.test(param)) { michael@0: ok(value != undefined, param + " is not undefined"); michael@0: } michael@0: michael@0: ok(typeof flags === "object", type + " has a flags object"); michael@0: michael@0: if (param === "buffer") { michael@0: is(flags.Buffer, true, "`buffer` params have Buffer flag"); michael@0: } michael@0: else if (param === "bufferSize" || param === "frequencyBinCount") { michael@0: is(flags.readonly, true, param + " is readonly"); michael@0: } michael@0: else if (param === "curve") { michael@0: is(flags["Float32Array"], true, "`curve` param has Float32Array flag"); michael@0: } else { michael@0: is(Object.keys(flags), 0, type + "-" + param + " has no flags set") michael@0: } michael@0: }); michael@0: }); michael@0: michael@0: yield removeTab(target.tab); michael@0: finish(); michael@0: }