| Index: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html
|
| index a470df996d09ab852e158c454ae3c2b6108cdeba..4289c87385c563539d6aa3ef5663e8df2f867064 100644
|
| --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html
|
| @@ -1,47 +1,47 @@
|
| -<!doctype html>
|
| +<!DOCTYPE html>
|
| <html>
|
| <head>
|
| + <title>
|
| + Test setValueCurveAtTime Copies the Curve Data
|
| + </title>
|
| <script src="../../resources/testharness.js"></script>
|
| - <script src="../../resources/testharnessreport.js"></script>
|
| + <script src="../../resources/testharnessreport.js"></script>
|
| <script src="../resources/audit-util.js"></script>
|
| <script src="../resources/audit.js"></script>
|
| <script src="../resources/panner-formulas.js"></script>
|
| - <title>Test setValueCurveAtTime Copies the Curve Data</title>
|
| </head>
|
| -
|
| <body>
|
| - <script>
|
| -
|
| - var sampleRate = 48000;
|
| - var renderFrames = 1024;
|
| - var renderDuration = renderFrames / sampleRate;
|
| + <script id="layout-test-code">
|
| + let sampleRate = 48000;
|
| + let renderFrames = 1024;
|
| + let renderDuration = renderFrames / sampleRate;
|
|
|
| - var audit = Audit.createTaskRunner();
|
| + let audit = Audit.createTaskRunner();
|
|
|
| // Test that changing the curve array to setValueCurveAtTime doesn't
|
| // change the automation output.
|
| - audit.define("test-copy", (task, should) => {
|
| + audit.define('test-copy', (task, should) => {
|
| // Two-channel context; channel 0 is the test result, and channel 1 is
|
| // the expected result.
|
| - var context = new OfflineAudioContext(2, renderFrames, sampleRate);
|
| + let context = new OfflineAudioContext(2, renderFrames, sampleRate);
|
|
|
| - var source = context.createBufferSource();
|
| + let source = context.createBufferSource();
|
| source.buffer = createConstantBuffer(context, 1, 1);
|
| source.loop = true;
|
|
|
| // Create two gain nodes. gainRef is the reference with the expected
|
| // automation results. gainTest is the test which will have the curve
|
| // modified.
|
| - var gainTest = context.createGain();
|
| - var gainRef = context.createGain();
|
| + let gainTest = context.createGain();
|
| + let gainRef = context.createGain();
|
|
|
| - var merger = context.createChannelMerger(2);
|
| + let merger = context.createChannelMerger(2);
|
|
|
| // The actual curve data can be anything, but we use this for
|
| // simplicity.
|
| - var curveData = [1, 0];
|
| - var curveRef = Float32Array.from(curveData);
|
| - var curveTest = Float32Array.from(curveData);
|
| + let curveData = [1, 0];
|
| + let curveRef = Float32Array.from(curveData);
|
| + let curveTest = Float32Array.from(curveData);
|
|
|
| // Create the graph.
|
| source.connect(gainTest);
|
| @@ -60,24 +60,29 @@
|
| gainRef.gain.setValueCurveAtTime(curveRef, 0, renderDuration);
|
|
|
| // After rendering has started, modify curveTest.
|
| - context.suspend(128 / sampleRate).then(function () {
|
| - // Change the values of curve now. Any transformation is ok as long
|
| - // as curveTest changes. We do this to make it really obvious.
|
| - for (var k = 0; k < curveTest.length; ++k)
|
| - curveTest[k] = 100 * curveTest[k] + 1;
|
| - }).then(context.resume.bind(context));
|
| + context.suspend(128 / sampleRate)
|
| + .then(function() {
|
| + // Change the values of curve now. Any transformation is ok as
|
| + // long as curveTest changes. We do this to make it really
|
| + // obvious.
|
| + for (let k = 0; k < curveTest.length; ++k)
|
| + curveTest[k] = 100 * curveTest[k] + 1;
|
| + })
|
| + .then(context.resume.bind(context));
|
|
|
| // Start the test!
|
| source.start();
|
|
|
| - context.startRendering().then(function (resultBuffer) {
|
| - var testData = resultBuffer.getChannelData(0);
|
| - var refData = resultBuffer.getChannelData(1);
|
| + context.startRendering()
|
| + .then(function(resultBuffer) {
|
| + let testData = resultBuffer.getChannelData(0);
|
| + let refData = resultBuffer.getChannelData(1);
|
|
|
| - // The test result and the reference should be identical since
|
| - // changing the curve data should not affect the automation.
|
| - should(testData, "setValueCurve output").beEqualToArray(refData);
|
| - }).then(() => task.done());
|
| + // The test result and the reference should be identical since
|
| + // changing the curve data should not affect the automation.
|
| + should(testData, 'setValueCurve output').beEqualToArray(refData);
|
| + })
|
| + .then(() => task.done());
|
| });
|
|
|
| audit.run();
|
|
|