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

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

Issue 2836073002: Convert constructor/channelsplitter.html to use new Audit (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test Constructor: ChannelSplitter</title> 4 <title>Test Constructor: ChannelSplitter</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="audionodeoptions.js"></script> 9 <script src="new-audionodeoptions.js"></script>
10 </head> 10 </head>
11 11
12 <body> 12 <body>
13 <script> 13 <script>
14 var context; 14 var context;
15 15
16 var audit = Audit.createTaskRunner(); 16 var audit = Audit.createTaskRunner();
17 17
18 audit.defineTask("initialize", function (taskDone) { 18 audit.define('initialize', (task, should) => {
19 Should("context = new OfflineAudioContext(...)", function () { 19 context = initializeContext(should);
20 context = new OfflineAudioContext(1, 1, 48000); 20 task.done();
21 }).notThrow();
22
23 taskDone();
24 }); 21 });
25 22
26 audit.defineTask("invalid constructor", function (taskDone) { 23 audit.define('invalid constructor', (task, should) => {
27 var node; 24 testInvalidConstructor(should, 'ChannelSplitterNode', context);
28 var success = true; 25 task.done();
29
30 success = Should("new ChannelSplitterNode()", function () {
31 node = new ChannelSplitterNode();
32 }).throw("TypeError");
33 success = Should("new ChannelSplitterNode(1)", function () {
34 node = new ChannelSplitterNode(1) && success;
35 }).throw("TypeError");
36 success = Should("new ChannelSplitterNode(context, 42)", function () {
37 node = new ChannelSplitterNode(context, 42) && success;
38 }).throw("TypeError");
39
40 Should("Invalid constructors", success)
41 .summarize(
42 "correctly threw errors",
43 "did not throw errors in all cases");
44
45 taskDone();
46 }); 26 });
47 27
48 audit.defineTask("default constructor", function (taskDone) { 28 audit.define('default constructor', (task, should) => {
49 var node; 29 testDefaultConstructor(should, 'ChannelSplitterNode', context, {
50 var success = true; 30 prefix: 'node0',
31 numberOfInputs: 1,
32 numberOfOutputs: 6,
33 channelCount: 6,
34 channelCountMode: 'explicit',
35 channelInterpretation: 'speakers'
36 });
51 37
52 success = Should("node0 = new ChannelSplitterNode(context)", function () { 38 task.done();
53 node = new ChannelSplitterNode(context);
54 }).notThrow();
55 success = Should("node0 instanceof ChannelSplitterNode", node instanceof ChannelSplitterNode)
56 .beEqualTo(true) && success;
57
58 success = Should("node0.numberOfInputs", node.numberOfInputs)
59 .beEqualTo(1) && success;
60 success = Should("node0.numberOfOutputs", node.numberOfOutputs)
61 .beEqualTo(6) && success;
62 success = Should("node0.channelCount", node.channelCount)
63 .beEqualTo(node.numberOfOutputs) && success;
64 success = Should("node0.channelCountMode", node.channelCountMode)
65 .beEqualTo("explicit") && success;
66 success = Should("node0.channelInterpretation", node.channelInterpretati on)
67 .beEqualTo("speakers") && success;
68
69 Should("new ChannelSplitterNode(context)", success)
70 .summarize(
71 "constructed node with correct attributes",
72 "did not construct correct node correctly")
73
74 taskDone();
75 }); 39 });
76 40
77 audit.defineTask("test AudioNodeOptions", function (taskDone) { 41 audit.define('test AudioNodeOptions', (task, should) => {
78 testAudioNodeOptions(context, "ChannelSplitterNode", { 42 testAudioNodeOptions(should, context, 'ChannelSplitterNode', {
79 expectedChannelCount: { 43 channelCount:
80 value: 6, 44 {value: 6, isFixed: true, errorType: 'InvalidStateError'},
45 channelCountMode: {
46 value: 'explicit',
81 isFixed: true, 47 isFixed: true,
82 errorType: "InvalidStateError"
83 },
84 expectedChannelCountMode: {
85 value: "explicit",
86 isFixed: true
87 } 48 }
88 }); 49 });
89 taskDone(); 50 task.done();
90 }); 51 });
91 52
92 audit.defineTask("constructor options", function (taskDone) { 53 audit.define('constructor options', (task, should) => {
93 var node; 54 var node;
94 var success = true;
95 var options = { 55 var options = {
96 numberOfInputs: 3, 56 numberOfInputs: 3,
97 numberOfOutputs: 9, 57 numberOfOutputs: 9,
98 channelInterpretation: "discrete" 58 channelInterpretation: 'discrete'
99 }; 59 };
100 60
101 success = Should("node1 = new ChannelSplitterNode(context, " + JSON.stri ngify(options) + ")", function () { 61 should(
102 node = new ChannelSplitterNode(context, options); 62 () => {
103 }).notThrow(); 63 node = new ChannelSplitterNode(context, options);
64 },
65 'node1 = new ChannelSplitterNode(context, ' +
66 JSON.stringify(options) + ')')
67 .notThrow();
104 68
105 success = Should("node1.numberOfInputs", node.numberOfInputs) 69 should(node.numberOfInputs, 'node1.numberOfInputs').beEqualTo(1);
106 .beEqualTo(1) && success; 70 should(node.numberOfOutputs, 'node1.numberOfOutputs')
107 success = Should("node1.numberOfOutputs", node.numberOfOutputs) 71 .beEqualTo(options.numberOfOutputs);
108 .beEqualTo(options.numberOfOutputs) && success; 72 should(node.channelInterpretation, 'node1.channelInterpretation')
109 success = Should("node1.channelInterpretation", node.channelInterpretati on) 73 .beEqualTo(options.channelInterpretation);
110 .beEqualTo(options.channelInterpretation) && success;
111 74
112 options = { numberOfOutputs: 99 }; 75 options = {numberOfOutputs: 99};
113 success = Should("new ChannelSplitterNode(c, " + JSON.stringify(options) + ")", 76 should(
114 function () { 77 () => {
115 node = new ChannelSplitterNode(context, options); 78 node = new ChannelSplitterNode(context, options);
116 }) 79 },
117 .throw("IndexSizeError") && success; 80 'new ChannelSplitterNode(c, ' + JSON.stringify(options) + ')')
81 .throw('IndexSizeError');
118 82
119 options = { channelCount: 3 }; 83 options = {channelCount: 3};
120 success = Should("new ChannelSplitterNode(c, " + JSON.stringify(options) + ")", 84 should(
121 function () { 85 () => {
122 node = new ChannelSplitterNode(context, options); 86 node = new ChannelSplitterNode(context, options);
123 }) 87 },
124 .throw("InvalidStateError") && success; 88 'new ChannelSplitterNode(c, ' + JSON.stringify(options) + ')')
89 .throw('InvalidStateError');
125 90
126 options = { channelCountMode: "max"}; 91 options = {channelCountMode: 'max'};
127 success = Should("new ChannelSplitterNode(c, " + JSON.stringify(options) + ")", 92 should(
128 function () { 93 () => {
129 node = new ChannelSplitterNode(context, { 94 node = new ChannelSplitterNode(context, options);
130 channelCountMode: "max" 95 },
131 }); 96 'new ChannelSplitterNode(c, ' + JSON.stringify(options) + ')')
132 }) 97 .throw('InvalidStateError');
133 .throw("InvalidStateError") && success;
134 98
135 Should("new ChannelSplitterNode() with options", success) 99 task.done();
136 .summarize(
137 "constructed with correct attributes",
138 "was not constructed correctly");
139
140 taskDone();
141 }); 100 });
142 101
143 audit.runTasks(); 102 audit.run();
144 </script> 103 </script>
145 </body> 104 </body>
146 </html> 105 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698