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