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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html

Issue 2895963003: Apply layout-test-tidy to LayoutTests/webaudio (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html
index 4b3fb70ddd358c62b843cf1f02260d607a97f9c4..036b556bfa73ef6e35434e32ab68281704f4fa81 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html
@@ -1,214 +1,217 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
<head>
- <title>Test Processing Of AudioParams of Disconnected AudioNodes</title>
+ <title>
+ Test Processing Of AudioParams of Disconnected AudioNodes
+ </title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit.js"></script>
</head>
-
<body>
- <script>
+ <script id="layout-test-code">
// Arbitrary sample rate.
- var sampleRate = 8000;
+ let sampleRate = 8000;
// Arbitrary number of frames for the test, except it must be greater than
// |automationEndFrame|.
- var renderFrames = 1024;
+ let renderFrames = 1024;
// The linear ramp automation ends at this frame. Arbitrary, except it
// must be strictly less than the render length.
- var automationEndFrame = 128;
+ let automationEndFrame = 128;
- var audit = Audit.createTaskRunner();
+ let audit = Audit.createTaskRunner();
// There should be a test for every single node which has an AudioParam.
// Source nodes are not included in this because the AudioParams for the
// source nodes only process when the node has been started.
- audit.define("BiquadFilterNode", (task, should) => {
- var nodeName = "BiquadFilterNode"
- Promise.all([
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "Q",
- initialValue: 2,
- rampFinalValue: 5
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "detune",
- initialValue: 1,
- rampFinalValue: 0.5
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "frequency",
- initialValue: 1000,
- rampFinalValue: 100
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "gain",
- initialValue: -3,
- rampFinalValue: 3
- }),
- ]).then(() => task.done());
+ audit.define('BiquadFilterNode', (task, should) => {
+ let nodeName = 'BiquadFilterNode'
+ Promise
+ .all([
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'Q',
+ initialValue: 2,
+ rampFinalValue: 5
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'detune',
+ initialValue: 1,
+ rampFinalValue: 0.5
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'frequency',
+ initialValue: 1000,
+ rampFinalValue: 100
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'gain',
+ initialValue: -3,
+ rampFinalValue: 3
+ }),
+ ])
+ .then(() => task.done());
});
- audit.define("DelayNode", (task, should) => {
+ audit.define('DelayNode', (task, should) => {
testParamAutomation(should, {
- nodeName: "DelayNode",
- paramName: "delayTime",
+ nodeName: 'DelayNode',
+ paramName: 'delayTime',
initialValue: 0.25,
rampFinalValue: 0.5
}).then(() => task.done());
});
- audit.define("DynamicsCompressorNode", (task, should) => {
- var nodeName = "DynamicsCompressorNode";
- Promise.all([
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "attack",
- initialValue: 0.1,
- rampFinalValue: 0.5
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "knee",
- initialValue: 0,
- rampFinalValue: 25
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "ratio",
- initialValue: 1,
- rampFinalValue: 15
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "release",
- initialValue: 0,
- rampFinalValue: 0.75
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "threshold",
- initialValue: -50,
- rampFinalValue: -10
- })
- ]).then(() => task.done());
+ audit.define('DynamicsCompressorNode', (task, should) => {
+ let nodeName = 'DynamicsCompressorNode';
+ Promise
+ .all([
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'attack',
+ initialValue: 0.1,
+ rampFinalValue: 0.5
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'knee',
+ initialValue: 0,
+ rampFinalValue: 25
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'ratio',
+ initialValue: 1,
+ rampFinalValue: 15
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'release',
+ initialValue: 0,
+ rampFinalValue: 0.75
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'threshold',
+ initialValue: -50,
+ rampFinalValue: -10
+ })
+ ])
+ .then(() => task.done());
});
- audit.define("GainNode", (task, should) => {
+ audit.define('GainNode', (task, should) => {
testParamAutomation(should, {
- nodeName: "GainNode",
- paramName: "gain",
+ nodeName: 'GainNode',
+ paramName: 'gain',
initialValue: 1,
rampFinalValue: 0.5
}).then(() => task.done());
});
- audit.define("PannerNode", (task, should) => {
- var nodeName = "PannerNode";
- Promise.all([
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "positionX",
- initialValue: 0.1,
- rampFinalValue: 0.5
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "positionY",
- initialValue: 2,
- rampFinalValue: 30
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "positionZ",
- initialValue: 1,
- rampFinalValue: 15
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "orientationX",
- initialValue: 0.1,
- rampFinalValue: 0.5
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "orientationY",
- initialValue: 2,
- rampFinalValue: 30
- }),
- testParamAutomation(should, {
- nodeName: nodeName,
- paramName: "orientationZ",
- initialValue: 1,
- rampFinalValue: 15
- }),
- ]).then(() => task.done());
+ audit.define('PannerNode', (task, should) => {
+ let nodeName = 'PannerNode';
+ Promise
+ .all([
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'positionX',
+ initialValue: 0.1,
+ rampFinalValue: 0.5
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'positionY',
+ initialValue: 2,
+ rampFinalValue: 30
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'positionZ',
+ initialValue: 1,
+ rampFinalValue: 15
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'orientationX',
+ initialValue: 0.1,
+ rampFinalValue: 0.5
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'orientationY',
+ initialValue: 2,
+ rampFinalValue: 30
+ }),
+ testParamAutomation(should, {
+ nodeName: nodeName,
+ paramName: 'orientationZ',
+ initialValue: 1,
+ rampFinalValue: 15
+ }),
+ ])
+ .then(() => task.done());
});
- audit.define("StereoPannerNode", (task, should) => {
+ audit.define('StereoPannerNode', (task, should) => {
testParamAutomation(should, {
- nodeName: "StereoPannerNode",
- paramName: "pan",
+ nodeName: 'StereoPannerNode',
+ paramName: 'pan',
initialValue: 1,
rampFinalValue: 0.5
}).then(() => task.done());
});
- audit.define("AudioListener", (task, should) => {
- Promise.all([
- testAudioListener(should, {
- paramName: "positionX",
- initialValue: 1,
- rampFinalValue: 100
- }),
- testAudioListener(should, {
- paramName: "positionY",
- initialValue: 1,
- rampFinalValue: 200
- }),
- testAudioListener(should, {
- paramName: "positionZ",
- initialValue: 1,
- rampFinalValue: 300
- }),
- testAudioListener(should, {
- paramName: "forwardX",
- initialValue: 1,
- rampFinalValue: -100
- }),
- testAudioListener(should, {
- paramName: "forwardY",
- initialValue: 1,
- rampFinalValue: -200
- }),
- testAudioListener(should, {
- paramName: "forwardZ",
- initialValue: 1,
- rampFinalValue: -300
- }),
- testAudioListener(should, {
- paramName: "upX",
- initialValue: 1,
- rampFinalValue: 99
- }),
- testAudioListener(should, {
- paramName: "upY",
- initialValue: 1,
- rampFinalValue: 42
- }),
- testAudioListener(should, {
- paramName: "upZ",
- initialValue: 1,
- rampFinalValue: 137
- }),
- ]).then(() => task.done());
+ audit.define('AudioListener', (task, should) => {
+ Promise
+ .all([
+ testAudioListener(should, {
+ paramName: 'positionX',
+ initialValue: 1,
+ rampFinalValue: 100
+ }),
+ testAudioListener(should, {
+ paramName: 'positionY',
+ initialValue: 1,
+ rampFinalValue: 200
+ }),
+ testAudioListener(should, {
+ paramName: 'positionZ',
+ initialValue: 1,
+ rampFinalValue: 300
+ }),
+ testAudioListener(should, {
+ paramName: 'forwardX',
+ initialValue: 1,
+ rampFinalValue: -100
+ }),
+ testAudioListener(should, {
+ paramName: 'forwardY',
+ initialValue: 1,
+ rampFinalValue: -200
+ }),
+ testAudioListener(should, {
+ paramName: 'forwardZ',
+ initialValue: 1,
+ rampFinalValue: -300
+ }),
+ testAudioListener(
+ should,
+ {paramName: 'upX', initialValue: 1, rampFinalValue: 99}),
+ testAudioListener(
+ should,
+ {paramName: 'upY', initialValue: 1, rampFinalValue: 42}),
+ testAudioListener(
+ should,
+ {paramName: 'upZ', initialValue: 1, rampFinalValue: 137}),
+ ])
+ .then(() => task.done());
});
// Run test of automation processing. |options| is a dictionary that
@@ -220,8 +223,8 @@
// initialValue - starting value for linear ramp
// rampFinalValue - finale value for linear ramp
//
- // The test is considered to have succeeded if the |.value| of the AudioParam
- // is the final value.
+ // The test is considered to have succeeded if the |.value| of the
+ // AudioParam is the final value.
//
// A simple graph is created containing the node to be tested, connected
// to the destination. A linear ramp automation is scheduled for the
@@ -231,10 +234,10 @@
// the AudioParam is obtained and compared against the final value. These
// should match exactly.
function testParamAutomation(should, options) {
- var context = new OfflineAudioContext(1, renderFrames, sampleRate);
+ let context = new OfflineAudioContext(1, renderFrames, sampleRate);
// Create the node to be tested
- var node = new window[options.nodeName](context);
+ let node = new window[options.nodeName](context);
node.connect(context.destination);
// A linear ramp starting at frame 0 to frame |automationEndFrame| is
@@ -242,54 +245,57 @@
// less than the total render frames.
node[options.paramName].setValueAtTime(options.initialValue, 0);
- node[options.paramName].linearRampToValueAtTime(options.rampFinalValue,
- automationEndFrame / context.sampleRate);
+ node[options.paramName].linearRampToValueAtTime(
+ options.rampFinalValue, automationEndFrame / context.sampleRate);
- return context.startRendering()
- .then(function (resultBuffer) {
- // Sanity check: the given ramp final value must not be the default
- // value, otherwise we can't easily tell if the automation was
- // actually run.
- should(options.rampFinalValue,
- options.nodeName + "." + options.paramName + " ramp final value")
+ return context.startRendering().then(function(resultBuffer) {
+ // Sanity check: the given ramp final value must not be the default
+ // value, otherwise we can't easily tell if the automation was
+ // actually run.
+ should(
+ options.rampFinalValue,
+ options.nodeName + '.' + options.paramName + ' ramp final value')
.notBeEqualTo(node[options.paramName].defaultValue);
- // The actual AudioParam value should be the rampe final value.
- should(node[options.paramName].value,
- options.nodeName + "." + options.paramName + ".value")
+ // The actual AudioParam value should be the rampe final value.
+ should(
+ node[options.paramName].value,
+ options.nodeName + '.' + options.paramName + '.value')
.beEqualTo(options.rampFinalValue);
- });
+ });
}
function testAudioListener(should, options) {
- var context = new OfflineAudioContext(1, renderFrames, sampleRate);
+ let context = new OfflineAudioContext(1, renderFrames, sampleRate);
// Create the node to be tested
- var node = new PannerNode(context);
+ let node = new PannerNode(context);
node.connect(context.destination);
// A linear ramp starting at frame 0 to frame |automationEndFrame| is
// used for the test. This value is fairly arbitrary, but it should be
// less than the total render frames.
- context.listener[options.paramName].setValueAtTime(options.initialValue, 0);
- context.listener[options.paramName].linearRampToValueAtTime(options.rampFinalValue,
- automationEndFrame / context.sampleRate);
+ context.listener[options.paramName].setValueAtTime(
+ options.initialValue, 0);
+ context.listener[options.paramName].linearRampToValueAtTime(
+ options.rampFinalValue, automationEndFrame / context.sampleRate);
- return context.startRendering()
- .then(function (resultBuffer) {
- // Sanity check: the given ramp final value must not be the default
- // value, otherwise we can't easily tell if the automation was
- // actually run.
- should(options.rampFinalValue,
- "AudioListener." + options.paramName + " ramp final value")
+ return context.startRendering().then(function(resultBuffer) {
+ // Sanity check: the given ramp final value must not be the default
+ // value, otherwise we can't easily tell if the automation was
+ // actually run.
+ should(
+ options.rampFinalValue,
+ 'AudioListener.' + options.paramName + ' ramp final value')
.notBeEqualTo(context.listener[options.paramName].defaultValue);
- // The actual AudioParam value should be the rampe final value.
- should(context.listener[options.paramName].value,
- "AudioListener." + options.paramName + ".value")
+ // The actual AudioParam value should be the rampe final value.
+ should(
+ context.listener[options.paramName].value,
+ 'AudioListener.' + options.paramName + '.value')
.beEqualTo(options.rampFinalValue);
- });
+ });
}
audit.run();

Powered by Google App Engine
This is Rietveld 408576698