|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Test basic communication of Web Audio actor |
|
6 */ |
|
7 |
|
8 function spawnTest () { |
|
9 let [target, debuggee, front] = yield initBackend(SIMPLE_CONTEXT_URL); |
|
10 let [_, __, [destNode, oscNode, gainNode], [connect1, connect2]] = yield Promise.all([ |
|
11 front.setup({ reload: true }), |
|
12 once(front, "start-context"), |
|
13 get3(front, "create-node"), |
|
14 get2(front, "connect-node") |
|
15 ]); |
|
16 |
|
17 let destType = yield destNode.getType(); |
|
18 let oscType = yield oscNode.getType(); |
|
19 let gainType = yield gainNode.getType(); |
|
20 |
|
21 is(destType, "AudioDestinationNode", "WebAudioActor:create-node returns AudioNodeActor for AudioDestination"); |
|
22 is(oscType, "OscillatorNode", "WebAudioActor:create-node returns AudioNodeActor"); |
|
23 is(gainType, "GainNode", "WebAudioActor:create-node returns AudioNodeActor"); |
|
24 |
|
25 let { source, dest } = connect1; |
|
26 is(source.actorID, oscNode.actorID, "WebAudioActor:connect-node returns correct actor with ID on source (osc->gain)"); |
|
27 is(dest.actorID, gainNode.actorID, "WebAudioActor:connect-node returns correct actor with ID on dest (osc->gain)"); |
|
28 |
|
29 let { source, dest } = connect2; |
|
30 is(source.actorID, gainNode.actorID, "WebAudioActor:connect-node returns correct actor with ID on source (gain->dest)"); |
|
31 is(dest.actorID, destNode.actorID, "WebAudioActor:connect-node returns correct actor with ID on dest (gain->dest)"); |
|
32 |
|
33 yield removeTab(target.tab); |
|
34 finish(); |
|
35 } |