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