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