Chromium Code Reviews| 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> |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 audit.define( | 29 audit.define( |
| 30 { | 30 { |
| 31 label: 'properties', | 31 label: 'properties', |
| 32 description: 'Test properties on derived nodes' | 32 description: 'Test properties on derived nodes' |
| 33 }, | 33 }, |
| 34 function(task, should) { | 34 function(task, should) { |
| 35 var expectedProperties = ['start', 'stop', 'onended']; | 35 var expectedProperties = ['start', 'stop', 'onended']; |
| 36 | 36 |
| 37 // AudioScheduledSourceNode must have these properties. | 37 // AudioScheduledSourceNode must have these properties. |
| 38 for (p in expectedProperties) { | 38 for (p in expectedProperties) { |
| 39 should( | 39 should(AudioScheduledSourceNode.prototype, |
|
Raymond Toy
2017/04/07 16:10:58
It's nicer if it were
should(AudioScheduledSource
hongchan
2017/04/07 17:22:17
What if we want to check an object not the prototy
| |
| 40 AudioScheduledSourceNode.prototype.hasOwnProperty( | 40 'AudioScheduledSourceNode.prototype') |
| 41 expectedProperties[p]), | 41 .ownProperty(expectedProperties[p]); |
| 42 'AudioScheduledSourceNode.' + expectedProperties[p]) | |
| 43 .beTrue(); | |
| 44 } | 42 } |
| 45 | 43 |
| 46 // ConstantSource and Oscillator must not | 44 // ConstantSource and Oscillator must not |
| 47 var nodes = ['ConstantSourceNode', 'OscillatorNode']; | 45 var nodes = ['ConstantSourceNode', 'OscillatorNode']; |
| 48 for (n in nodes) { | 46 for (n in nodes) { |
| 49 for (p in expectedProperties) { | 47 for (p in expectedProperties) { |
| 50 should( | 48 should(window[nodes[n]].prototype, nodes[n] + '.prototype') |
| 51 window[nodes[n]].prototype.hasOwnProperty( | 49 .notOwnProperty(expectedProperties[p]); |
| 52 expectedProperties[p]), | |
| 53 nodes[n] + '.' + expectedProperties[p]) | |
| 54 .beFalse(); | |
| 55 } | 50 } |
| 56 } | 51 } |
| 57 | 52 |
| 58 // AudioBufferSourceNode has it's own start method, but should not | 53 // AudioBufferSourceNode has it's own start method, but should not |
| 59 // have the others. | 54 // have the others. |
| 60 for (p in expectedProperties) { | 55 for (p in expectedProperties) { |
| 61 if (expectedProperties[p] !== 'start') { | 56 if (expectedProperties[p] !== 'start') { |
| 62 should( | 57 should(AudioBufferSourceNode.prototype, |
| 63 AudioBufferSourceNode.prototype.hasOwnProperty( | 58 'AudioBufferSourceNode.prototype') |
| 64 expectedProperties[p]), | 59 .notOwnProperty(expectedProperties[p]); |
| 65 'AudioBufferSourceNode.' + expectedProperties[p]) | |
| 66 .beFalse(); | |
| 67 } | 60 } |
| 68 } | 61 } |
| 69 | 62 |
| 70 should( | 63 should(AudioBufferSourceNode.prototype, |
| 71 AudioBufferSourceNode.prototype.hasOwnProperty('start'), | 64 'AudioBufferSourceNode.prototype') |
| 72 'AudioBufferSourceNode.start') | 65 .ownProperty('start'); |
| 73 .beTrue(); | |
| 74 | 66 |
| 75 task.done(); | 67 task.done(); |
| 76 }); | 68 }); |
| 77 | 69 |
| 78 audit.run(); | 70 audit.run(); |
| 79 </script> | 71 </script> |
| 80 </body> | 72 </body> |
| 81 </html> | 73 </html> |
| OLD | NEW |