OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test Constructor: MediaStreamAudioDestinationNode</title> | 4 <title>Test Constructor: MediaStreamAudioDestinationNode</title> |
5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
8 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audit.js"></script> |
9 <script src="audionodeoptions.js"></script> | 9 <script src="new-audionodeoptions.js"></script> |
10 </head> | 10 </head> |
11 | 11 |
12 <body> | 12 <body> |
13 <script> | 13 <script> |
14 var context = new AudioContext(); | 14 let context = new AudioContext(); |
15 | 15 |
16 var audit = Audit.createTaskRunner(); | 16 let audit = Audit.createTaskRunner(); |
17 | 17 |
18 audit.defineTask("invalid constructor", function (taskDone) { | 18 audit.define('initialize', (task, should) => { |
19 var node; | 19 context = initializeContext(should); |
20 var success = true; | 20 task.done(); |
21 | |
22 success = Should("new MediaStreamAudioDestinationNode()", | |
23 function () { | |
24 node = new MediaStreamAudioDestinationNode(); | |
25 }) | |
26 .throw("TypeError"); | |
27 success = Should("new MediaStreamAudioDestinationNode(1)", | |
28 function () { | |
29 node = new MediaStreamAudioDestinationNode(1) | |
30 }) | |
31 .throw("TypeError") && success;; | |
32 success = Should("new MediaStreamAudioDestinationNode(context, 42)", | |
33 function () { | |
34 node = new MediaStreamAudioDestinationNode(context, 42) | |
35 }) | |
36 .throw("TypeError") && success;; | |
37 | |
38 taskDone(); | |
39 }); | 21 }); |
40 | 22 |
41 audit.defineTask("default constructor", function (taskDone) { | 23 audit.define('invalid constructor', (task, should) => { |
42 var node; | 24 testInvalidConstructor( |
43 var success; | 25 should, 'MediaStreamAudioDestinationNode', context); |
44 | 26 task.done(); |
45 success = Should("new MediaStreamAudioDestinationNode(context)", | |
46 function () { | |
47 node = new MediaStreamAudioDestinationNode(context); | |
48 }).notThrow() && success; | |
49 | |
50 success = Should("node instanceof MediaStreamAudioDestinationNode", | |
51 node instanceof MediaStreamAudioDestinationNode) | |
52 .beEqualTo(true) && success; | |
53 success = Should("node.channelCount", node.channelCount) | |
54 .beEqualTo(2) && success; | |
55 | |
56 taskDone(); | |
57 }); | 27 }); |
58 | 28 |
59 audit.defineTask("test AudioNodeOptions", function (taskDone) { | 29 audit.define('default constructor', (task, should) => { |
60 testAudioNodeOptions(context, "MediaStreamAudioDestinationNode", { | 30 let prefix = 'node0'; |
61 expectedChannelCount: { | 31 let node = testDefaultConstructor( |
62 // An arbitrary but valid, non-default count for this node. | 32 should, 'MediaStreamAudioDestinationNode', context, { |
63 value: 7 | 33 prefix: prefix, |
64 } | 34 numberOfInputs: 1, |
65 }); | 35 numberOfOutputs: 1, |
66 taskDone(); | 36 channelCount: 2, |
| 37 channelCountMode: 'max', |
| 38 channelInterpretation: 'speakers' |
| 39 }); |
| 40 |
| 41 testDefaultAttributes(should, node, prefix, []); |
| 42 |
| 43 task.done(); |
67 }); | 44 }); |
68 | 45 |
69 audit.runTasks(); | 46 audit.define('test AudioNodeOptions', (task, should) => { |
| 47 testAudioNodeOptions( |
| 48 should, context, 'MediaStreamAudioDestinationNode', { |
| 49 channelCount: { |
| 50 // An arbitrary but valid, non-default count for this node. |
| 51 value: 7 |
| 52 } |
| 53 }); |
| 54 task.done(); |
| 55 }); |
| 56 |
| 57 audit.run(); |
70 </script> | 58 </script> |
71 </body> | 59 </body> |
72 </html> | 60 </html> |
OLD | NEW |