Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1067)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/constructor/mediastreamaudiosource.html

Issue 2398713002: Add constructor for MediaStreamAudioSourceNode (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698