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