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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-basic.html

Issue 2673743002: Convert DynamicsCompressor tests to testharness (Closed)
Patch Set: Address review comments. Created 3 years, 10 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 | third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-basic-expected.txt » ('j') | 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 2
3 <html> 3 <html>
4 <head> 4 <head>
5 <script src="../../resources/js-test.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audit.js"></script>
8 </head> 9 </head>
9 10
10 <body> 11 <body>
11 <div id="description"></div>
12 <div id="console"></div>
13
14 <script> 12 <script>
15 description("Basic tests for DynamicsCompressorNode API."); 13 var audit = Audit.createTaskRunner();
16
17 var context; 14 var context;
18 var compressor; 15 var compressor;
19 16
20 function runTest() { 17 audit.define("test", function (task, should) {
21 if (window.testRunner) { 18 task.describe("Basic tests for DynamicsCompressorNode API");
22 testRunner.dumpAsText();
23 testRunner.waitUntilDone();
24 }
25
26 window.jsTestIsAsync = true;
27 19
28 context = new AudioContext(); 20 context = new AudioContext();
29 compressor = context.createDynamicsCompressor(); 21 compressor = context.createDynamicsCompressor();
30 22
31 try { 23 should(compressor.threshold.value, "compressor.threshold.value")
32 if (compressor.threshold.value == -24) 24 .beEqualTo(-24);
33 testPassed("threshold attribute has correct default value."); 25 should(compressor.knee.value, "compressor.knee.value")
34 else 26 .beEqualTo(30);
35 testFailed("threshold attribute has incorrect default value."); 27 should(compressor.ratio.value, "compressor.ratio.value")
28 .beEqualTo(12);
29 should(compressor.attack.value, "compressor.attack.value")
30 .beEqualTo(Math.fround(0.003));
31 should(compressor.release.value, "compressor.release.value")
32 .beEqualTo(0.25);
33 should(typeof compressor.reduction, "typeof compressor.reduction")
34 .beEqualTo("number");
35 should(compressor.reduction, "compressor.reduction")
36 .beEqualTo(0);
36 37
37 if (compressor.knee.value == 30) 38 done();
38 testPassed("knee attribute has correct default value."); 39 });
39 else
40 testFailed("knee attribute has incorrect default value.");
41
42 if (compressor.ratio.value == 12)
43 testPassed("ratio attribute has correct default value.");
44 else
45 testFailed("ratio attribute has incorrect default value.");
46
47 if (compressor.attack.value === Math.fround(0.003))
48 testPassed("attack attribute has correct default value.");
49 else
50 testFailed("attack attribute has incorrect default value.");
51 40
52 if (compressor.release.value === 0.25) 41 audit.run();
53 testPassed("release attribute has correct default value.");
54 else
55 testFailed("release attribute has incorrect default value.");
56
57 if (typeof compressor.reduction === "number") {
58 testPassed("reduction attribute is a number.")
59 if (compressor.reduction == 0)
60 testPassed("reduction attribute has correct default value.")
61 } else {
62 testFailed("reduction attribute is an " + compressor.reduction.const ructor.name + " not a number.");
63 }
64
65 } catch(e) {
66 testFailed("Exception thrown when accessing DynamicsCompressorNode attri butes.");
67 }
68
69 finishJSTest();
70 }
71
72 runTest();
73 42
74 </script> 43 </script>
75 44
76 </body> 45 </body>
77 </html> 46 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-basic-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698