Chromium Code Reviews| 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; | |
| 13 | |
| 14 var audit = Audit.createTaskRunner(); | |
| 15 | |
| 16 audit.defineTask("initialize", function (taskDone) { | |
|
hongchan
2016/10/06 17:51:43
I don't think creating a context as a task is nece
Raymond Toy
2016/10/07 15:18:00
We could, but I kind of like it as an initializati
Raymond Toy
2016/10/10 15:38:33
Misunderstood the comment. Simplified as requeste
| |
| 17 Should("context = new AudioContext()", function () { | |
| 18 context = new AudioContext(); | |
| 19 }).notThrow(); | |
| 20 | |
| 21 taskDone(); | |
| 22 }); | |
| 23 | |
| 24 audit.defineTask("invalid constructor", function (taskDone) { | |
| 25 var node; | |
| 26 var success = true; | |
| 27 | |
| 28 success = Should("new MediaStreamAudioSourceNode()", function () { | |
| 29 node = new MediaStreamAudioSourceNode(); | |
| 30 }).throw("TypeError"); | |
| 31 success = Should("new MediaStreamAudioSourceNode(1)", function () { | |
| 32 node = new MediaStreamAudioSourceNode(1) && success; | |
| 33 }).throw("TypeError"); | |
| 34 success = Should("new MediaStreamAudioSourceNode(context, 42)", function () { | |
| 35 node = new MediaStreamAudioSourceNode(context, 42) && success; | |
| 36 }).throw("TypeError"); | |
| 37 | |
| 38 Should("Invalid constructors", success) | |
| 39 .summarize( | |
| 40 "correctly threw errors", | |
| 41 "did not throw errors in all cases"); | |
| 42 | |
| 43 taskDone(); | |
| 44 }); | |
| 45 | |
| 46 audit.defineTask("constructor options", function (taskDone) { | |
| 47 var node; | |
| 48 var success = true; | |
| 49 | |
| 50 var options = { | |
| 51 mediaStream: new MediaStream() | |
| 52 }; | |
| 53 | |
| 54 // We throw because the mediaStream has no tracks. But otherwise the | |
| 55 // constructor worked. | |
| 56 success = Should("node = new MediaStreamAudioSourceNode(, " + JSON.strin gify(options) + ")", | |
| 57 function () { | |
| 58 node = new MediaStreamAudioSourceNode(context, options); | |
| 59 }).throw("InvalidStateError") && success; | |
| 60 | |
| 61 Should("new MediaStreamAudioSourceNode(c, options)", success) | |
| 62 .summarize( | |
| 63 "constructed with correct attributes", | |
| 64 "was not constructed correctly"); | |
| 65 | |
| 66 taskDone(); | |
| 67 }); | |
| 68 | |
| 69 audit.runTasks(); | |
| 70 </script> | |
| 71 </body> | |
| 72 </html> | |
| OLD | NEW |