Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Constructor: AnalyserNode</title> | 4 <title>Test Constructor: AnalyserNode</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/audio-testing.js"></script> |
| 9 <script src="audionodeoptions.js"></script> | 9 <script src="audionodeoptions.js"></script> |
| 10 </head> | 10 </head> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 "correctly threw errors", | 42 "correctly threw errors", |
| 43 "did not throw errors in all cases"); | 43 "did not throw errors in all cases"); |
| 44 | 44 |
| 45 taskDone(); | 45 taskDone(); |
| 46 }); | 46 }); |
| 47 | 47 |
| 48 audit.defineTask("default constructor", function (taskDone) { | 48 audit.defineTask("default constructor", function (taskDone) { |
| 49 var node; | 49 var node; |
| 50 var success = true; | 50 var success = true; |
| 51 | 51 |
| 52 success = Should("node = new AnalyserNode(c)", function () { | 52 success = Should("node1 = new AnalyserNode(c)", function () { |
|
hongchan
2017/03/22 22:09:42
Wrap at 80 for all changes.
| |
| 53 node = new AnalyserNode(context); | 53 node = new AnalyserNode(context); |
| 54 }).notThrow(); | 54 }).notThrow(); |
| 55 success = Should("node instanceof AnalyserNode", node instanceof Analyse rNode) | 55 success = Should("node0 instanceof AnalyserNode", node instanceof Analys erNode) |
| 56 .beEqualTo(true) && success; | 56 .beEqualTo(true) && success; |
| 57 success = Should("node.fftSize", node.fftSize).beEqualTo(2048) && succes s; | 57 success = Should("node0.fftSize", node.fftSize).beEqualTo(2048) && succe ss; |
| 58 success = Should("node.frequencyBinCount", | 58 success = Should("node0.frequencyBinCount", |
| 59 node.frequencyBinCount).beEqualTo(1024) && success; | 59 node.frequencyBinCount).beEqualTo(1024) && success; |
| 60 success = Should("node.minDecibels", node.minDecibels).beEqualTo(-100) & & success; | 60 success = Should("node0.minDecibels", node.minDecibels).beEqualTo(-100) && success; |
| 61 success = Should("node.maxDecibels", node.maxDecibels).beEqualTo(-30) && success; | 61 success = Should("node0.maxDecibels", node.maxDecibels).beEqualTo(-30) & & success; |
| 62 // All AudioParams are stored as single precision values. Compare | 62 // All AudioParams are stored as single precision values. Compare |
| 63 // against the single-precision float value. | 63 // against the single-precision float value. |
| 64 success = Should("node.smoothingTimeConstant", node.smoothingTimeConstan t) | 64 success = Should("node0.smoothingTimeConstant", node.smoothingTimeConsta nt) |
| 65 .beEqualTo(Math.fround(0.8)) && success; | 65 .beEqualTo(Math.fround(0.8)) && success; |
| 66 | 66 |
| 67 Should("new AnalyserNode(c)", success) | 67 Should("new AnalyserNode(c)", success) |
| 68 .summarize( | 68 .summarize( |
| 69 "constructed node with correct attributes", | 69 "constructed node with correct attributes", |
| 70 "did not construct correct node correctly") | 70 "did not construct correct node correctly") |
| 71 | 71 |
| 72 taskDone(); | 72 taskDone(); |
| 73 }); | 73 }); |
| 74 | 74 |
| 75 audit.defineTask("test AudioNodeOptions", function (taskDone) { | 75 audit.defineTask("test AudioNodeOptions", function (taskDone) { |
| 76 testAudioNodeOptions(context, "AnalyserNode"); | 76 testAudioNodeOptions(context, "AnalyserNode"); |
| 77 taskDone(); | 77 taskDone(); |
| 78 }); | 78 }); |
| 79 | 79 |
| 80 audit.defineTask("constructor with options", function (taskDone) { | 80 audit.defineTask("constructor with options", function (taskDone) { |
| 81 var options = { | 81 var options = { |
| 82 fftSize: 32, | 82 fftSize: 32, |
| 83 maxDecibels: 1, | 83 maxDecibels: 1, |
| 84 minDecibels: -13, | 84 minDecibels: -13, |
| 85 // Choose a value that can be represented the same as a float and as a | 85 // Choose a value that can be represented the same as a float and as a |
| 86 // double. | 86 // double. |
| 87 smoothingTimeConstant: 0.125 | 87 smoothingTimeConstant: 0.125 |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 var node; | 90 var node; |
| 91 var success = true; | 91 var success = true; |
| 92 success = Should("node = new AnalyserNode(c, " + JSON.stringify(options) + ")", function () { | 92 success = Should("node1 = new AnalyserNode(c, " + JSON.stringify(options ) + ")", function () { |
|
hongchan
2017/03/22 22:09:42
Ditto.
| |
| 93 node = new AnalyserNode(context, options); | 93 node = new AnalyserNode(context, options); |
| 94 }).notThrow(); | 94 }).notThrow(); |
| 95 | 95 |
| 96 success = Should("node instanceof AnalyserNode", node instanceof Analyse rNode) | 96 success = Should("node1 instanceof AnalyserNode", node instanceof Analys erNode) |
| 97 .beEqualTo(true) && success; | 97 .beEqualTo(true) && success; |
| 98 success = Should("node.fftSize", node.fftSize) | 98 success = Should("node1.fftSize", node.fftSize) |
| 99 .beEqualTo(options.fftSize) && success; | 99 .beEqualTo(options.fftSize) && success; |
| 100 success = Should("node.maxDecibels", node.maxDecibels) | 100 success = Should("node1.maxDecibels", node.maxDecibels) |
| 101 .beEqualTo(options.maxDecibels) && success; | 101 .beEqualTo(options.maxDecibels) && success; |
| 102 success = Should("node.minDecibels", node.minDecibels) | 102 success = Should("node1.minDecibels", node.minDecibels) |
| 103 .beEqualTo(options.minDecibels) && success; | 103 .beEqualTo(options.minDecibels) && success; |
| 104 success = Should("node.smoothingTimeConstant", node.smoothingTimeConstan t) | 104 success = Should("node1.smoothingTimeConstant", node.smoothingTimeConsta nt) |
| 105 .beEqualTo(options.smoothingTimeConstant) && success; | 105 .beEqualTo(options.smoothingTimeConstant) && success; |
| 106 | 106 |
| 107 Should("new AnalyserNode() with options", success) | 107 Should("new AnalyserNode() with options", success) |
| 108 .summarize( | 108 .summarize( |
| 109 "constructed with correct attributes", | 109 "constructed with correct attributes", |
| 110 "was not constructed correctly"); | 110 "was not constructed correctly"); |
| 111 | 111 |
| 112 taskDone(); | 112 taskDone(); |
| 113 }); | 113 }); |
| 114 | 114 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 .summarize( | 218 .summarize( |
| 219 "correctly handled", | 219 "correctly handled", |
| 220 "incorrectly handled"); | 220 "incorrectly handled"); |
| 221 | 221 |
| 222 taskDone(); | 222 taskDone(); |
| 223 }); | 223 }); |
| 224 audit.runTasks(); | 224 audit.runTasks(); |
| 225 </script> | 225 </script> |
| 226 </body> | 226 </body> |
| 227 </html> | 227 </html> |
| OLD | NEW |