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

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

Issue 2102133002: Add constructors for WebAudio nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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: ChannelSplitter</title>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audio-testing.js"></script>
8 <script src="audionodeoptions.js"></script>
9 </head>
10
11 <body>
12 <script>
13 var context;
14
15 var audit = Audit.createTaskRunner();
16
17 audit.defineTask("initialize", function (taskDone) {
18 Should("context = new OfflineAudioContext(...)", function () {
19 context = new OfflineAudioContext(1, 1, 48000);
20 }).notThrow();
21
22 taskDone();
23 });
24
25 audit.defineTask("invalid constructor", function (taskDone) {
26 var node;
27 var success = true;
28
29 success = Should("new ChannelSplitterNode()", function () {
30 node = new ChannelSplitterNode();
31 }).throw("TypeError");
32 success = Should("new ChannelSplitterNode(1)", function () {
33 node = new ChannelSplitterNode(1) && success;
34 }).throw("TypeError");
35 success = Should("new ChannelSplitterNode(context, 42)", function () {
36 node = new ChannelSplitterNode(context, 42) && success;
37 }).throw("TypeError");
38
39 Should("Invalid constructors", success)
40 .summarize(
41 "correctly threw errors",
42 "did not throw errors in all cases");
43
44 taskDone();
45 });
46
47 audit.defineTask("default constructor", function (taskDone) {
48 var node;
49 var success = true;
50
51 success = Should("node = new ChannelSplitterNode(context)", function () {
52 node = new ChannelSplitterNode(context);
53 }).notThrow();
54 success = Should("node instanceof ChannelSplitterNode", node instanceof ChannelSplitterNode)
55 .beEqualTo(true) && success;
56
57 success = Should("node.numberOfInputs", node.numberOfInputs)
58 .beEqualTo(1) && success;
59 success = Should("node.numberOfOutputs", node.numberOfOutputs)
60 .beEqualTo(6) && success;
61 success = Should("node.channelCount", node.channelCount)
62 .beEqualTo(2) && success;
63 success = Should("node.channelCountMode", node.channelCountMode)
64 .beEqualTo("max") && success;
65 success = Should("node.channelInterpretation", node.channelInterpretatio n)
66 .beEqualTo("speakers") && success;
67
68 Should("new ChannelSplitterNode(context)", success)
69 .summarize(
70 "constructed node with correct attributes",
71 "did not construct correct node correctly")
72
73 taskDone();
74 });
75
76 audit.defineTask("test AudioNodeOptions", function (taskDone) {
77 testAudioNodeOptions(context, "ChannelSplitterNode");
78 taskDone();
79 });
80
81 audit.defineTask("constructor options", function (taskDone) {
82 var node;
83 var success = true;
84 var options = {
85 numberOfInputs: 3,
86 numberOfOutputs: 9,
87 channelInterpretation: "discrete"
88 };
89
90 success = Should("node = new ChannelSplitterNode(context, <options>)", f unction () {
91 node = new ChannelSplitterNode(context, options);
92 }).notThrow();
93
94 success = Should("node.numberOfInputs", node.numberOfInputs)
95 .beEqualTo(1) && success;
96 success = Should("node.numberOfOutputs", node.numberOfOutputs)
97 .beEqualTo(options.numberOfOutputs) && success;
98 success = Should("node.channelInterpretation", node.channelInterpretatio n)
99 .beEqualTo(options.channelInterpretation) && success;
100
101 success = Should("new ChannelSplitterNode(..., { numberOfOutputs: 99 }",
102 function () {
103 node = new ChannelSplitterNode(context, {
104 numberOfOutputs: 99
105 });
106 })
107 .throw("IndexSizeError") && success;
108 success = Should("new ChannelSplitterNode(..., { channelCount: 3 }",
109 function () {
110 node = new ChannelSplitterNode(context, {
111 channelCount: 3
112 });
113 })
114 .notThrow() && success;
115 success = Should('new ChannelSplitterNode(..., { channelCountMode: "max "}',
116 function () {
117 node = new ChannelSplitterNode(context, {
118 channelCountMode: "max"
119 });
120 })
121 .notThrow() && success;
122
123 Should("new ChannelSplitterNode() with options", success)
124 .summarize(
125 "constructed with correct attributes",
126 "was not constructed correctly");
127
128 taskDone();
129 });
130
131 audit.runTasks();
132 </script>
133 </body>
134 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698