| OLD | NEW |
| 1 <!doctype html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Basic ConstantSourceNode Tests</title> | 4 <title> |
| 5 Basic ConstantSourceNode Tests |
| 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-util.js"></script> | 9 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audit.js"></script> | 10 <script src="../resources/audit.js"></script> |
| 9 </head> | 11 </head> |
| 12 <body> |
| 13 <script id="layout-test-code"> |
| 14 let context = new AudioContext(); |
| 10 | 15 |
| 11 <body> | 16 let audit = Audit.createTaskRunner(); |
| 12 <script> | |
| 13 var context = new AudioContext(); | |
| 14 | 17 |
| 15 var audit = Audit.createTaskRunner(); | 18 audit.define('createConstantSource()', (task, should) => { |
| 16 | 19 let node; |
| 17 audit.define("createConstantSource()", (task, should) => { | 20 let prefix = 'Factory method: '; |
| 18 var node; | |
| 19 var prefix = "Factory method: "; | |
| 20 | 21 |
| 21 should(() => { | 22 should(() => { |
| 22 node = context.createConstantSource(); | 23 node = context.createConstantSource(); |
| 23 }, prefix + "node = context.createConstantSource()").notThrow(); | 24 }, prefix + 'node = context.createConstantSource()').notThrow(); |
| 24 should(node instanceof ConstantSourceNode, | 25 should( |
| 25 prefix + "node instance of ConstantSourceNode") | 26 node instanceof ConstantSourceNode, |
| 26 .beEqualTo(true); | 27 prefix + 'node instance of ConstantSourceNode') |
| 27 | 28 .beEqualTo(true); |
| 29 |
| 28 verifyNodeDefaults(should, node, prefix); | 30 verifyNodeDefaults(should, node, prefix); |
| 29 | 31 |
| 30 task.done(); | 32 task.done(); |
| 31 }); | 33 }); |
| 32 | 34 |
| 33 audit.define("new ConstantSourceNode()", (task, should) => { | 35 audit.define('new ConstantSourceNode()', (task, should) => { |
| 34 var node; | 36 let node; |
| 35 var prefix = "Constructor: "; | 37 let prefix = 'Constructor: '; |
| 36 | 38 |
| 37 should(() => { | 39 should(() => { |
| 38 node = new ConstantSourceNode(context); | 40 node = new ConstantSourceNode(context); |
| 39 }, prefix + "node = new ConstantSourceNode()").notThrow(); | 41 }, prefix + 'node = new ConstantSourceNode()').notThrow(); |
| 40 should(node instanceof ConstantSourceNode, | 42 should( |
| 41 prefix + "node instance of ConstantSourceNode") | 43 node instanceof ConstantSourceNode, |
| 42 .beEqualTo(true); | 44 prefix + 'node instance of ConstantSourceNode') |
| 45 .beEqualTo(true); |
| 43 | 46 |
| 44 | 47 |
| 45 verifyNodeDefaults(should, node, prefix); | 48 verifyNodeDefaults(should, node, prefix); |
| 46 | 49 |
| 47 task.done(); | 50 task.done(); |
| 48 }); | 51 }); |
| 49 | 52 |
| 50 function verifyNodeDefaults(should, node, prefix) { | 53 function verifyNodeDefaults(should, node, prefix) { |
| 51 should(node.numberOfInputs, prefix + "node.numberOfInputs") | 54 should(node.numberOfInputs, prefix + 'node.numberOfInputs') |
| 52 .beEqualTo(0); | 55 .beEqualTo(0); |
| 53 should(node.numberOfOutputs, prefix + "node.numberOfOutputs") | 56 should(node.numberOfOutputs, prefix + 'node.numberOfOutputs') |
| 54 .beEqualTo(1); | 57 .beEqualTo(1); |
| 55 should(node.channelCount, prefix + "node.channelCount") | 58 should(node.channelCount, prefix + 'node.channelCount').beEqualTo(2); |
| 56 .beEqualTo(2); | 59 should(node.channelCountMode, prefix + 'node.channelCountMode') |
| 57 should(node.channelCountMode, prefix + "node.channelCountMode") | 60 .beEqualTo('max'); |
| 58 .beEqualTo("max"); | 61 should( |
| 59 should(node.channelInterpretation, | 62 node.channelInterpretation, prefix + 'node.channelInterpretation') |
| 60 prefix + "node.channelInterpretation") | 63 .beEqualTo('speakers'); |
| 61 .beEqualTo("speakers"); | |
| 62 | 64 |
| 63 should(node.offset.value, prefix + "node.offset.value") | 65 should(node.offset.value, prefix + 'node.offset.value').beEqualTo(1); |
| 64 .beEqualTo(1); | 66 should(node.offset.defaultValue, prefix + 'node.offset.defaultValue') |
| 65 should(node.offset.defaultValue, prefix + "node.offset.defaultValue") | 67 .beEqualTo(1); |
| 66 .beEqualTo(1); | 68 should(node.offset.minValue, prefix + 'node.offset.minValue') |
| 67 should(node.offset.minValue, prefix + "node.offset.minValue") | 69 .beEqualTo(Math.fround(-3.4028235e38)); |
| 68 .beEqualTo(Math.fround(-3.4028235e38)); | 70 should(node.offset.maxValue, prefix + 'node.offset.maxValue') |
| 69 should(node.offset.maxValue, prefix + "node.offset.maxValue") | 71 .beEqualTo(Math.fround(3.4028235e38)); |
| 70 .beEqualTo(Math.fround(3.4028235e38)); | |
| 71 } | 72 } |
| 72 | 73 |
| 73 audit.run(); | 74 audit.run(); |
| 74 </script> | 75 </script> |
| 75 </body> | 76 </body> |
| 76 </html> | 77 </html> |
| OLD | NEW |