Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / dynamicscompressor-clear-internal-state.html
blobf327cdabfe1eea4be750f1a49290cbb83e2c4b49
1 <!doctype html>
2 <html>
3 <head>
4 <title>Validate Reduction Value of DynamicsComporessor after Disabling</title>
5 <script src="resources/compatibility.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 <script src="../resources/js-test.js"></script>
8 </head>
10 <body>
11 <script>
12 description("Validate Reduction Value of DynamicsComporessor after Disabling");
14 var context;
15 var buffer;
16 var source;
17 var compressor;
18 var renderedData;
20 var sampleRate = 44100;
21 var testDurationSamples = 44100;
23 function checkResult (event) {
25 renderedData = event.renderedBuffer.getChannelData(0);
27 // Check that the reduction value is 0.0.
28 if (compressor.reduction.value !== 0.0) {
29 testFailed("Expected reduction of 0.0, but the value is " + compressor.reduction.value);
31 else {
32 testPassed("Reduction is 0.0");
35 finishJSTest();
38 function runTest() {
39 window.jsTestIsAsync = true;
41 // Create the offline context for the test.
42 context = new OfflineAudioContext(1, testDurationSamples, sampleRate);
43 context.oncomplete = checkResult;
45 // Create the constant sample buffer of 0.5 sec.
46 buffer = createConstantBuffer(context, testDurationSamples / 2, 1);
48 // Create compressor and use default parameters for the compression.
49 compressor = context.createDynamicsCompressor();
51 // Create the source and connect it to the destination
52 source = context.createBufferSource();
53 source.buffer = buffer;
54 source.connect(compressor);
55 compressor.connect(context.destination);
56 source.start(0.0);
58 // Render it!
59 context.startRendering();
62 runTest();
63 succesfullyParsed = true;
64 </script>
65 </body>
66 </html>