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

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

Issue 2895963003: Apply layout-test-tidy to LayoutTests/webaudio (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
OLDNEW
1 <!doctype html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test Constructor: AnalyserNode</title> 4 <title>
5 Test Constructor: AnalyserNode
6 </title>
5 <script src="../../resources/testharness.js"></script> 7 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 8 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audit-util.js"></script> 9 <script src="../resources/audit-util.js"></script>
8 <script src="../resources/audit.js"></script> 10 <script src="../resources/audit.js"></script>
9 <script src="audionodeoptions.js"></script> 11 <script src="audionodeoptions.js"></script>
10 </head> 12 </head>
13 <body>
14 <script id="layout-test-code">
15 let context;
11 16
12 <body> 17 let audit = Audit.createTaskRunner();
13 <script>
14 var context;
15
16 var audit = Audit.createTaskRunner();
17 18
18 audit.define('initialize', (task, should) => { 19 audit.define('initialize', (task, should) => {
19 context = initializeContext(should); 20 context = initializeContext(should);
20 task.done(); 21 task.done();
21 }); 22 });
22 23
23 audit.define('invalid constructor', (task, should) => { 24 audit.define('invalid constructor', (task, should) => {
24 testInvalidConstructor(should, 'AnalyserNode', context); 25 testInvalidConstructor(should, 'AnalyserNode', context);
25 task.done(); 26 task.done();
26 }); 27 });
(...skipping 23 matching lines...) Expand all
50 51
51 task.done(); 52 task.done();
52 }); 53 });
53 54
54 audit.define('test AudioNodeOptions', (task, should) => { 55 audit.define('test AudioNodeOptions', (task, should) => {
55 testAudioNodeOptions(should, context, 'AnalyserNode'); 56 testAudioNodeOptions(should, context, 'AnalyserNode');
56 task.done(); 57 task.done();
57 }); 58 });
58 59
59 audit.define('constructor with options', (task, should) => { 60 audit.define('constructor with options', (task, should) => {
60 var options = { 61 let options = {
61 fftSize: 32, 62 fftSize: 32,
62 maxDecibels: 1, 63 maxDecibels: 1,
63 minDecibels: -13, 64 minDecibels: -13,
64 // Choose a value that can be represented the same as a float and as a 65 // Choose a value that can be represented the same as a float and as a
65 // double. 66 // double.
66 smoothingTimeConstant: 0.125 67 smoothingTimeConstant: 0.125
67 }; 68 };
68 69
69 var node; 70 let node;
70 should(() => { 71 should(
72 () => {
71 node = new AnalyserNode(context, options); 73 node = new AnalyserNode(context, options);
72 }, 74 },
73 'node1 = new AnalyserNode(c, ' + JSON.stringify(options) + ')') 75 'node1 = new AnalyserNode(c, ' + JSON.stringify(options) + ')')
74 .notThrow(); 76 .notThrow();
75 77
76 should(node instanceof AnalyserNode, 'node1 instanceof AnalyserNode') 78 should(node instanceof AnalyserNode, 'node1 instanceof AnalyserNode')
77 .beEqualTo(true); 79 .beEqualTo(true);
78 should(node.fftSize, 'node1.fftSize').beEqualTo(options.fftSize); 80 should(node.fftSize, 'node1.fftSize').beEqualTo(options.fftSize);
79 should(node.maxDecibels, 'node1.maxDecibels') 81 should(node.maxDecibels, 'node1.maxDecibels')
80 .beEqualTo(options.maxDecibels); 82 .beEqualTo(options.maxDecibels);
81 should(node.minDecibels, 'node1.minDecibels') 83 should(node.minDecibels, 'node1.minDecibels')
82 .beEqualTo(options.minDecibels); 84 .beEqualTo(options.minDecibels);
83 should(node.smoothingTimeConstant, 'node1.smoothingTimeConstant') 85 should(node.smoothingTimeConstant, 'node1.smoothingTimeConstant')
84 .beEqualTo(options.smoothingTimeConstant); 86 .beEqualTo(options.smoothingTimeConstant);
85 87
86 task.done(); 88 task.done();
87 }); 89 });
88 90
89 audit.define('construct invalid options', (task, should) => { 91 audit.define('construct invalid options', (task, should) => {
90 var node; 92 let node;
91 93
92 should(() => { 94 should(
95 () => {
93 node = new AnalyserNode(context, {fftSize: 33}); 96 node = new AnalyserNode(context, {fftSize: 33});
94 }, 97 },
95 'node = new AnalyserNode(c, { fftSize: 33 })') 98 'node = new AnalyserNode(c, { fftSize: 33 })')
96 .throw('IndexSizeError'); 99 .throw('IndexSizeError');
97 should(() => { 100 should(
101 () => {
98 node = new AnalyserNode(context, {maxDecibels: -500}); 102 node = new AnalyserNode(context, {maxDecibels: -500});
99 }, 103 },
100 'node = new AnalyserNode(c, { maxDecibels: -500 })') 104 'node = new AnalyserNode(c, { maxDecibels: -500 })')
101 .throw('IndexSizeError'); 105 .throw('IndexSizeError');
102 should(() => { 106 should(
107 () => {
103 node = new AnalyserNode(context, {minDecibels: -10}); 108 node = new AnalyserNode(context, {minDecibels: -10});
104 }, 109 },
105 'node = new AnalyserNode(c, { minDecibels: -10 })') 110 'node = new AnalyserNode(c, { minDecibels: -10 })')
106 .throw('IndexSizeError'); 111 .throw('IndexSizeError');
107 should(() => { 112 should(
113 () => {
108 node = new AnalyserNode(context, {smoothingTimeConstant: 2}); 114 node = new AnalyserNode(context, {smoothingTimeConstant: 2});
109 }, 115 },
110 'node = new AnalyserNode(c, { smoothingTimeConstant: 2 })') 116 'node = new AnalyserNode(c, { smoothingTimeConstant: 2 })')
111 .throw('IndexSizeError'); 117 .throw('IndexSizeError');
112 should(function() { 118 should(function() {
113 node = new AnalyserNode(context, {frequencyBinCount: 33}); 119 node = new AnalyserNode(context, {frequencyBinCount: 33});
114 }, 'node = new AnalyserNode(c, { frequencyBinCount: 33 })').notThrow(); 120 }, 'node = new AnalyserNode(c, { frequencyBinCount: 33 })').notThrow();
115 should(node.frequencyBinCount, 'node.frequencyBinCount') 121 should(node.frequencyBinCount, 'node.frequencyBinCount')
116 .beEqualTo(1024); 122 .beEqualTo(1024);
117 123
118 task.done(); 124 task.done();
119 }); 125 });
120 126
121 audit.define('setting min/max', (task, should) => { 127 audit.define('setting min/max', (task, should) => {
122 var node; 128 let node;
123 129
124 // Recall the default values of minDecibels and maxDecibels are -100, 130 // Recall the default values of minDecibels and maxDecibels are -100,
125 // and -30, respectively. Setting both values in the constructor should 131 // and -30, respectively. Setting both values in the constructor should
126 // not signal an error in any of the following cases. 132 // not signal an error in any of the following cases.
127 var options = {minDecibels: -10, maxDecibels: 20}; 133 let options = {minDecibels: -10, maxDecibels: 20};
128 should(() => { 134 should(
135 () => {
129 node = new AnalyserNode(context, options); 136 node = new AnalyserNode(context, options);
130 }, 137 },
131 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')') 138 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')')
132 .notThrow(); 139 .notThrow();
133 140
134 options = {maxDecibels: 20, minDecibels: -10}; 141 options = {maxDecibels: 20, minDecibels: -10};
135 should(() => { 142 should(
143 () => {
136 node = new AnalyserNode(context, options); 144 node = new AnalyserNode(context, options);
137 }, 145 },
138 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')') 146 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')')
139 .notThrow(); 147 .notThrow();
140 148
141 options = {minDecibels: -200, maxDecibels: -150}; 149 options = {minDecibels: -200, maxDecibels: -150};
142 should(() => { 150 should(
151 () => {
143 node = new AnalyserNode(context, options); 152 node = new AnalyserNode(context, options);
144 }, 153 },
145 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')') 154 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')')
146 .notThrow(); 155 .notThrow();
147 156
148 options = {maxDecibels: -150, minDecibels: -200}; 157 options = {maxDecibels: -150, minDecibels: -200};
149 should(() => { 158 should(
159 () => {
150 node = new AnalyserNode(context, options); 160 node = new AnalyserNode(context, options);
151 }, 161 },
152 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')') 162 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')')
153 .notThrow(); 163 .notThrow();
154 164
155 // But these should signal because minDecibel > maxDecibel 165 // But these should signal because minDecibel > maxDecibel
156 options = {maxDecibels: -150, minDecibels: -10}; 166 options = {maxDecibels: -150, minDecibels: -10};
157 should(() => { 167 should(
168 () => {
158 node = new AnalyserNode(context, options); 169 node = new AnalyserNode(context, options);
159 }, 170 },
160 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')') 171 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')')
161 .throw('IndexSizeError'); 172 .throw('IndexSizeError');
162 173
163 options = {minDecibels: -10, maxDecibels: -150}; 174 options = {minDecibels: -10, maxDecibels: -150};
164 should(() => { 175 should(
176 () => {
165 node = new AnalyserNode(context, options); 177 node = new AnalyserNode(context, options);
166 }, 178 },
167 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')') 179 'node = new AnalyserNode(c, ' + JSON.stringify(options) + ')')
168 .throw('IndexSizeError'); 180 .throw('IndexSizeError');
169 181
170 task.done(); 182 task.done();
171 }); 183 });
172 184
173 audit.run(); 185 audit.run();
174 </script> 186 </script>
175 </body> 187 </body>
176 </html> 188 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698