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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.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/WaveShaper/waveshaper-limits.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html b/third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html
index 26003618cd96325eb90a727e5ab8ce6371c74c24..6bce49244b97a496c30d965b67108736d404a472 100644
--- a/third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html
+++ b/third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html
@@ -1,64 +1,67 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!DOCTYPE html>
<html>
<head>
+ <title>
+ waveshaper-limits.html
+ </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 audit = Audit.createTaskRunner();
+ <script id="layout-test-code">
+ let audit = Audit.createTaskRunner();
- var context;
- var bufferData;
- var outputData;
- var reference;
+ let context;
+ let bufferData;
+ let outputData;
+ let reference;
- var sampleRate = 48000;
+ let sampleRate = 48000;
// Must be odd so we have an exact middle point.
- var testFrames = 23;
- var scale = 1 / ((testFrames - 1) / 2 - 1);
+ let testFrames = 23;
+ let scale = 1 / ((testFrames - 1) / 2 - 1);
// Number of decimal digits to print
- var decimals = 6;
+ let decimals = 6;
// Required accuracy
- var diffThreshold = Math.pow(10, -decimals);
+ let diffThreshold = Math.pow(10, -decimals);
// Generate reference data
function generateReference() {
- // The curve data is 0, 1, 0, and the input data is a ramp from -1+eps to 1+eps. Then the
- // output is a ramp from 0 to 1 back to 0.
- var ref = new Float32Array(testFrames);
- var midPoint = (testFrames - 1) / 2;
+ // The curve data is 0, 1, 0, and the input data is a ramp from -1+eps
+ // to 1+eps. Then the output is a ramp from 0 to 1 back to 0.
+ let ref = new Float32Array(testFrames);
+ let midPoint = (testFrames - 1) / 2;
// First sample is below -1 at -1-scale.
ref[0] = 0;
// Generate ramp up to the mid-point
- for (var k = 0; k < midPoint; ++k) {
+ for (let k = 0; k < midPoint; ++k) {
ref[k + 1] = k * scale;
}
// The value at the mid-point must be 1, from the curve
ref[midPoint] = 1;
// Generate a ramp from 1 down to 0
- for (var k = midPoint; k < testFrames - 1; ++k) {
- ref[k + 1] = 2 - k * scale;
+ for (let k = midPoint; k < testFrames - 1; ++k) {
+ ref[k + 1] = 2 - k * scale;
}
// The last sample is out of range at 1+scale
ref[testFrames - 1] = 0;
return ref;
}
- function checkResult (renderedBuffer, should) {
+ function checkResult(renderedBuffer, should) {
outputData = renderedBuffer.getChannelData(0);
reference = generateReference();
- var success = true;
+ let success = true;
// Verify that every output value matches our expected reference value.
- for (var k = 0; k < outputData.length; ++k) {
- var diff = outputData[k] - reference[k];
- should(Math.abs(diff),
- "Max error mapping " + bufferData[k].toFixed(decimals) + " to " +
- outputData[k].toFixed(decimals))
- .beLessThanOrEqualTo(diffThreshold);
+ for (let k = 0; k < outputData.length; ++k) {
+ let diff = outputData[k] - reference[k];
+ should(
+ Math.abs(diff),
+ 'Max error mapping ' + bufferData[k].toFixed(decimals) + ' to ' +
+ outputData[k].toFixed(decimals))
+ .beLessThanOrEqualTo(diffThreshold);
}
}
@@ -71,22 +74,22 @@
function(task, should) {
context = new OfflineAudioContext(1, testFrames, sampleRate);
// Create input values between -1.1 and 1.1
- var buffer =
+ let buffer =
context.createBuffer(1, testFrames, context.sampleRate);
bufferData = buffer.getChannelData(0);
- var start = -1 - scale;
- for (var k = 0; k < testFrames; ++k) {
+ let start = -1 - scale;
+ for (let k = 0; k < testFrames; ++k) {
bufferData[k] = k * scale + start;
}
- var source = context.createBufferSource();
+ let source = context.createBufferSource();
source.buffer = buffer;
// Create simple waveshaper. It should map -1 to 0, 0 to 1, and +1
// to 0 and interpolate all points in between using a simple linear
// interpolator.
- var shaper = context.createWaveShaper();
- var curve = new Float32Array(3);
+ let shaper = context.createWaveShaper();
+ let curve = new Float32Array(3);
curve[0] = 0;
curve[1] = 1;
curve[2] = 0;

Powered by Google App Engine
This is Rietveld 408576698