| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Constructor: MediaStreamAudioSource</title> | 4 <title>Test Constructor: MediaStreamAudioSource</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-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audit.js"></script> |
| 9 <script src="new-audionodeoptions.js"></script> |
| 9 </head> | 10 </head> |
| 10 | 11 |
| 11 <body> | 12 <body> |
| 12 <script> | 13 <script> |
| 13 var context = new AudioContext(); | 14 let context = new AudioContext(); |
| 14 | 15 |
| 15 var audit = Audit.createTaskRunner(); | 16 let audit = Audit.createTaskRunner(); |
| 16 | 17 |
| 17 audit.defineTask("invalid constructor", function (taskDone) { | 18 audit.define('initialize', (task, should) => { |
| 18 var node; | 19 context = initializeContext(should); |
| 19 var success = true; | 20 task.done(); |
| 20 | |
| 21 success = Should("new MediaStreamAudioSourceNode()", function () { | |
| 22 node = new MediaStreamAudioSourceNode(); | |
| 23 }).throw("TypeError"); | |
| 24 success = Should("new MediaStreamAudioSourceNode(1)", function () { | |
| 25 node = new MediaStreamAudioSourceNode(1) && success; | |
| 26 }).throw("TypeError"); | |
| 27 success = Should("new MediaStreamAudioSourceNode(context, 42)", | |
| 28 function () { | |
| 29 node = new MediaStreamAudioSourceNode(context, 42) && success; | |
| 30 }).throw("TypeError"); | |
| 31 | |
| 32 Should("Invalid constructors", success) | |
| 33 .summarize( | |
| 34 "correctly threw errors", | |
| 35 "did not throw errors in all cases"); | |
| 36 | |
| 37 taskDone(); | |
| 38 }); | 21 }); |
| 39 | 22 |
| 40 audit.defineTask("constructor options", function (taskDone) { | 23 audit.define('invalid constructor', (task, should) => { |
| 41 var node; | 24 testInvalidConstructor(should, 'MediaStreamAudioSourceNode', context); |
| 42 var success = true; | 25 task.done(); |
| 26 }); |
| 43 | 27 |
| 44 var options = { | 28 audit.define('constructor options', (task, should) => { |
| 45 mediaStream: new MediaStream() | 29 let node; |
| 46 }; | 30 |
| 31 let options = {mediaStream: new MediaStream()}; |
| 47 | 32 |
| 48 // We throw because the mediaStream has no tracks. But otherwise the | 33 // We throw because the mediaStream has no tracks. But otherwise the |
| 49 // constructor worked. | 34 // constructor worked. |
| 50 success = Should("node = new MediaStreamAudioSourceNode(, " + JSON.strin
gify( | 35 should( |
| 51 options) + ")", | 36 () => { |
| 52 function () { | 37 node = new MediaStreamAudioSourceNode(context, options); |
| 53 node = new MediaStreamAudioSourceNode(context, options); | 38 }, |
| 54 }).throw("InvalidStateError") && success; | 39 'node = new MediaStreamAudioSourceNode(context, ' + |
| 40 JSON.stringify(options) + ')') |
| 41 .throw('InvalidStateError'); |
| 55 | 42 |
| 56 Should("new MediaStreamAudioSourceNode(c, options)", success) | 43 task.done(); |
| 57 .summarize( | |
| 58 "constructed with correct attributes", | |
| 59 "was not constructed correctly"); | |
| 60 | |
| 61 taskDone(); | |
| 62 }); | 44 }); |
| 63 | 45 |
| 64 audit.runTasks(); | 46 audit.run(); |
| 65 </script> | 47 </script> |
| 66 </body> | 48 </body> |
| 67 </html> | 49 </html> |
| OLD | NEW |