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/audit.js"></script> |
| 8 </head> |
| 9 |
| 10 <body> |
| 11 <script> |
| 12 var context = new AudioContext(); |
| 13 |
| 14 var audit = Audit.createTaskRunner(); |
| 15 |
| 16 audit.define("construction", function (task, should) { |
| 17 task.describe("Construct AudioScheduledSourceNode"); |
| 18 should(function () { |
| 19 return new AudioScheduledSourceNode(context); |
| 20 }, "new AudioScheduledSourceNode(c)").throw("TypeError"); |
| 21 |
| 22 task.done(); |
| 23 }); |
| 24 |
| 25 audit.define("properties", function (task, should) { |
| 26 task.describe("Test properties on derived nodes"); |
| 27 var expectedProperties = ["start", "stop", "onended"]; |
| 28 |
| 29 // AudioScheduledSourceNode must have these properties. |
| 30 for (p in expectedProperties) { |
| 31 should(AudioScheduledSourceNode.prototype.hasOwnProperty( |
| 32 expectedProperties[p]), |
| 33 "AudioScheduledSourceNode." + expectedProperties[p]) |
| 34 .beTrue(); |
| 35 } |
| 36 |
| 37 // ConstantSource and Oscillator must not |
| 38 var nodes = ["ConstantSourceNode", "OscillatorNode"]; |
| 39 for (n in nodes) { |
| 40 for (p in expectedProperties) { |
| 41 should(window[nodes[n]].prototype.hasOwnProperty( |
| 42 expectedProperties[p]), |
| 43 nodes[n] + "." + expectedProperties[p]) |
| 44 .beFalse(); |
| 45 } |
| 46 } |
| 47 |
| 48 // AudioBufferSourceNode has it's own start method, but should not have |
| 49 // the others. |
| 50 for (p in expectedProperties) { |
| 51 if (expectedProperties[p] !== "start") { |
| 52 should(AudioBufferSourceNode.prototype.hasOwnProperty( |
| 53 expectedProperties[p]), |
| 54 "AudioBufferSourceNode." + expectedProperties[p]) |
| 55 .beFalse(); |
| 56 } |
| 57 } |
| 58 |
| 59 should(AudioBufferSourceNode.prototype.hasOwnProperty("start"), |
| 60 "AudioBufferSourceNode.start") |
| 61 .beTrue(); |
| 62 |
| 63 task.done(); |
| 64 }); |
| 65 |
| 66 audit.run(); |
| 67 </script> |
| 68 </body> |
| 69 </html> |
OLD | NEW |