Index: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html |
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html |
index 0cead29f0d14ab49ba74803dbe82e0df0626286b..1903c1ea565fd1a4cbee727bfae7d43aaea9f329 100644 |
--- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html |
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html |
@@ -1,38 +1,39 @@ |
-<!doctype html> |
+<!DOCTYPE html> |
<html> |
<head> |
- <title>Test linearRampToValue Updates the Param Value</title> |
+ <title> |
+ Test linearRampToValue Updates the Param Value |
+ </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> |
</head> |
- |
<body> |
- <script> |
- |
- var renderQuantumSize = 128; |
- // Should be a power of two to get rid of rounding errors when converting between time and |
- // frame. |
- var sampleRate = 4096; |
- var renderDuration = 1; |
+ <script id="layout-test-code"> |
+ let renderQuantumSize = 128; |
+ // Should be a power of two to get rid of rounding errors when converting |
+ // between time and frame. |
+ let sampleRate = 4096; |
+ let renderDuration = 1; |
// End time of the linear ramp automation |
- var rampEndTime = renderDuration / 2; |
+ let rampEndTime = renderDuration / 2; |
- var audit = Audit.createTaskRunner(); |
+ let audit = Audit.createTaskRunner(); |
- // Test that linearRampToValue properly sets the AudioParam .value attribute when the |
- // linearRamp automation is running. |
- audit.define("propagate", (task, should) => { |
- var context = new OfflineAudioContext(1, renderDuration * sampleRate, sampleRate); |
+ // Test that linearRampToValue properly sets the AudioParam .value |
+ // attribute when the linearRamp automation is running. |
+ audit.define('propagate', (task, should) => { |
+ let context = |
+ new OfflineAudioContext(1, renderDuration * sampleRate, sampleRate); |
// Create a constant source. |
- var source = context.createBufferSource(); |
+ let source = context.createBufferSource(); |
source.buffer = createConstantBuffer(context, 1, 1); |
source.loop = true; |
// The gain node to be automated for testing. |
- var gain = context.createGain(); |
+ let gain = context.createGain(); |
gain.gain.setValueAtTime(0, 0); |
gain.gain.linearRampToValueAtTime(1, rampEndTime); |
@@ -41,39 +42,47 @@ |
source.connect(gain); |
gain.connect(context.destination); |
- var success = true; |
+ let success = true; |
- // The number of rendering quanta that will be processed in the context. At the beginning |
- // of each rendering quantum (except the first), we will check that gain.gain.value has the |
- // expected value. |
- var renderLoops = Math.floor(renderDuration * sampleRate / renderQuantumSize); |
+ // The number of rendering quanta that will be processed in the context. |
+ // At the beginning of each rendering quantum (except the first), we |
+ // will check that gain.gain.value has the expected value. |
+ let renderLoops = |
+ Math.floor(renderDuration * sampleRate / renderQuantumSize); |
- for (var k = 1; k < renderLoops; ++k) { |
- var time = k * renderQuantumSize / sampleRate; |
- context.suspend(time).then(function () { |
- var expected = 1; |
+ for (let k = 1; k < renderLoops; ++k) { |
+ let time = k * renderQuantumSize / sampleRate; |
+ context.suspend(time) |
+ .then(function() { |
+ let expected = 1; |
- if (context.currentTime <= rampEndTime) { |
- // The expected value of the gain is the last computed value from the previous |
- // rendering quantum because suspend() stops at the beginning of a rendering quantum, |
- // so we haven't computed the new value yet. |
- expected = (context.currentTime - 1 / sampleRate) / rampEndTime; |
- } |
+ if (context.currentTime <= rampEndTime) { |
+ // The expected value of the gain is the last computed value |
+ // from the previous rendering quantum because suspend() stops |
+ // at the beginning of a rendering quantum, so we haven't |
+ // computed the new value yet. |
+ expected = |
+ (context.currentTime - 1 / sampleRate) / rampEndTime; |
+ } |
- var frame = context.currentTime * sampleRate - 1; |
- success = should(gain.gain.value, |
- "gain.gain.value at frame " + frame) |
- .beEqualTo(expected); |
- }).then(context.resume.bind(context)); |
+ let frame = context.currentTime * sampleRate - 1; |
+ success = |
+ should(gain.gain.value, 'gain.gain.value at frame ' + frame) |
+ .beEqualTo(expected); |
+ }) |
+ .then(context.resume.bind(context)); |
} |
// Rock and roll! |
source.start(); |
- context.startRendering().then(function (result) { |
- should(success, "linearRampToValue") |
- .message("properly set the AudioParam value", |
- "did not properly set the AudioParam value"); |
- }).then(() => task.done()); |
+ context.startRendering() |
+ .then(function(result) { |
+ should(success, 'linearRampToValue') |
+ .message( |
+ 'properly set the AudioParam value', |
+ 'did not properly set the AudioParam value'); |
+ }) |
+ .then(() => task.done()); |
}); |
audit.run(); |