browser/devtools/webaudioeditor/test/browser_audionode-actor-is-source.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webaudioeditor/test/browser_audionode-actor-is-source.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Test AudioNode#isSource()
     1.9 + */
    1.10 +
    1.11 +function spawnTest () {
    1.12 +  let [target, debuggee, front] = yield initBackend(SIMPLE_NODES_URL);
    1.13 +  let [_, nodes] = yield Promise.all([
    1.14 +    front.setup({ reload: true }),
    1.15 +    getN(front, "create-node", 14)
    1.16 +  ]);
    1.17 +
    1.18 +  let actualTypes = yield Promise.all(nodes.map(node => node.getType()));
    1.19 +  let isSourceResult = yield Promise.all(nodes.map(node => node.isSource()));
    1.20 +
    1.21 +  actualTypes.forEach((type, i) => {
    1.22 +    let shouldBeSource = type === "AudioBufferSourceNode" || type === "OscillatorNode";
    1.23 +    if (shouldBeSource)
    1.24 +      is(isSourceResult[i], true, type + "'s isSource() yields into `true`");
    1.25 +    else
    1.26 +      is(isSourceResult[i], false, type + "'s isSource() yields into `false`");
    1.27 +  });
    1.28 +
    1.29 +  yield removeTab(target.tab);
    1.30 +  finish();
    1.31 +}

mercurial