Wed, 31 Dec 2014 06:09:35 +0100
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 | * Tests if the shader editor shows the appropriate UI when opened. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | function spawnTest() { |
michael@0 | 9 | let [target, debuggee, panel] = yield initWebAudioEditor(COMPLEX_CONTEXT_URL); |
michael@0 | 10 | let { panelWin } = panel; |
michael@0 | 11 | let { gFront, $, $$, EVENTS, WebAudioParamView } = panelWin; |
michael@0 | 12 | let gVars = WebAudioParamView._paramsView; |
michael@0 | 13 | |
michael@0 | 14 | let started = once(gFront, "start-context"); |
michael@0 | 15 | |
michael@0 | 16 | reload(target); |
michael@0 | 17 | |
michael@0 | 18 | let [[dest, osc, gain], nodeIDs ]= yield Promise.all([ |
michael@0 | 19 | getN(gFront, "create-node", 8), |
michael@0 | 20 | getNSpread(panelWin, EVENTS.UI_ADD_NODE_LIST, 8), |
michael@0 | 21 | waitForGraphRendered(panelWin, 8, 8) |
michael@0 | 22 | ]); |
michael@0 | 23 | |
michael@0 | 24 | // Map result to only have ID, since we don't need the event name |
michael@0 | 25 | nodeIDs = nodeIDs.map(eventResult => eventResult[1]); |
michael@0 | 26 | let types = ["AudioDestinationNode", "OscillatorNode", "GainNode", "ScriptProcessorNode", |
michael@0 | 27 | "OscillatorNode", "GainNode", "AudioBufferSourceNode", "BiquadFilterNode"]; |
michael@0 | 28 | |
michael@0 | 29 | |
michael@0 | 30 | types.forEach((type, i) => { |
michael@0 | 31 | ok(findGraphNode(panelWin, nodeIDs[i]).classList.contains("type-" + type), "found " + type + " with class"); |
michael@0 | 32 | }); |
michael@0 | 33 | |
michael@0 | 34 | let edges = [ |
michael@0 | 35 | [1, 2, "osc1 -> gain1"], |
michael@0 | 36 | [1, 3, "osc1 -> proc"], |
michael@0 | 37 | [2, 0, "gain1 -> dest"], |
michael@0 | 38 | [4, 5, "osc2 -> gain2"], |
michael@0 | 39 | [5, 0, "gain2 -> dest"], |
michael@0 | 40 | [6, 7, "buf -> filter"], |
michael@0 | 41 | [4, 7, "osc2 -> filter"], |
michael@0 | 42 | [7, 0, "filter -> dest"], |
michael@0 | 43 | ]; |
michael@0 | 44 | |
michael@0 | 45 | edges.forEach(([source, target, msg], i) => { |
michael@0 | 46 | is(findGraphEdge(panelWin, nodeIDs[source], nodeIDs[target]).toString(), "[object SVGGElement]", |
michael@0 | 47 | "found edge for " + msg); |
michael@0 | 48 | }); |
michael@0 | 49 | |
michael@0 | 50 | yield teardown(panel); |
michael@0 | 51 | finish(); |
michael@0 | 52 | } |
michael@0 | 53 |