OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <title>Test AudioScheduledSourceNode</title> | |
5 <script src="../resources/testharness.js"></script> | |
6 <script src="../resources/testharnessreport.js"></script> | |
7 <script src="resources/audio-testing.js"></script> | |
hongchan
2016/12/01 00:11:22
I know this might be too late - but can I ask you
Raymond Toy
2016/12/01 00:13:36
Maybe. The test file is short enough to be conver
Raymond Toy
2016/12/01 18:48:32
Done.
| |
8 </head> | |
9 | |
10 <body> | |
11 <script> | |
12 var context = new AudioContext(); | |
13 | |
14 var audit = Audit.createTaskRunner(); | |
15 | |
16 audit.defineTask("construction", function (taskDone) { | |
17 var success = true; | |
18 | |
19 success = Should("new AudioScheduledSourceNode(c)", function () { | |
20 return new AudioScheduledSourceNode(context); | |
21 }).throw("TypeError") && success; | |
22 | |
23 taskDone(); | |
24 }); | |
25 | |
26 audit.defineTask("properties", function (taskDone) { | |
27 var success = true; | |
28 var expectedProperties = ["start", "stop", "onended"]; | |
29 | |
30 // AudioScheduledSourceNode must have these properties. | |
31 for (p in expectedProperties) { | |
32 success = Should("AudioScheduledSourceNode." + expectedProperties[ | |
33 p], | |
34 AudioScheduledSourceNode.prototype.hasOwnProperty( | |
35 expectedProperties[p])) | |
36 .beEqualTo(true) && success; | |
37 } | |
38 | |
39 // ConstantSource and Oscillator must not | |
40 var nodes = ["ConstantSourceNode", "OscillatorNode"]; | |
41 for (n in nodes) { | |
42 for (p in expectedProperties) { | |
43 success = Should(nodes[n] + "." + expectedProperties[p], | |
44 window[nodes[n]].prototype.hasOwnProperty( | |
45 expectedProperties[p])) | |
46 .beEqualTo(false) && success; | |
47 } | |
48 } | |
49 | |
50 // AudioBufferSourceNode has it's own start method, but should not have | |
51 // the others. | |
52 for (p in expectedProperties) { | |
53 if (expectedProperties[p] !== "start") { | |
54 success = Should("AudioBufferSourceNode." + expectedProperties[ | |
55 p], | |
56 AudioBufferSourceNode.prototype.hasOwnProperty( | |
57 expectedProperties[p])) | |
58 .beEqualTo(false) && success; | |
59 } | |
60 } | |
61 | |
62 success = Should("AudioBufferSourceNode.start", | |
63 AudioBufferSourceNode.prototype.hasOwnProperty("start")) | |
64 .beEqualTo(true) && success; | |
65 | |
66 Should("Properties were defined", success) | |
67 .summarize("correctly", "incorrectly"); | |
68 | |
69 taskDone(); | |
70 }); | |
71 | |
72 audit.runTasks(); | |
73 </script> | |
74 </body> | |
75 </html> | |
OLD | NEW |