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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/constructor/periodicwave.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/constructor/periodicwave.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/constructor/periodicwave.html b/third_party/WebKit/LayoutTests/webaudio/constructor/periodicwave.html
index a28017ea4f675139f30f1cbb8b04435ed8212f3f..6347242d046c8bd3b3504fa4f8f61aca29c1aa71 100644
--- a/third_party/WebKit/LayoutTests/webaudio/constructor/periodicwave.html
+++ b/third_party/WebKit/LayoutTests/webaudio/constructor/periodicwave.html
@@ -1,19 +1,20 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
<head>
- <title>Test Constructor: PeriodicWave</title>
+ <title>
+ Test Constructor: PeriodicWave
+ </title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script>
<script src="../resources/audit.js"></script>
<script src="audionodeoptions.js"></script>
</head>
-
<body>
- <script>
- var context;
+ <script id="layout-test-code">
+ let context;
- var audit = Audit.createTaskRunner();
+ let audit = Audit.createTaskRunner();
audit.define('initialize', (task, should) => {
context = initializeContext(should);
@@ -34,8 +35,8 @@
});
audit.define('constructor with options', (task, should) => {
- var node1;
- var options = {real: [1, 1]};
+ let node1;
+ let options = {real: [1, 1]};
should(
() => {
node1 = new PeriodicWave(context, options);
@@ -45,7 +46,7 @@
should(node1 instanceof PeriodicWave, 'node1 instanceof PeriodicWave')
.beEqualTo(true);
- var node2;
+ let node2;
options = {imag: [1, 1]};
should(
() => {
@@ -57,7 +58,7 @@
should(node2 instanceof PeriodicWave, 'node2 instanceof PeriodicWave')
.beEqualTo(true);
- var node3;
+ let node3;
options = {real: [1, 2], imag: [1, 1]};
should(
() => {
@@ -148,9 +149,9 @@
// the samples are generated by the function |gen|.
function generateReference(gen) {
return (length, freq, sampleRate) => {
- var expected = new Float32Array(length);
- var omega = 2 * Math.PI * freq / sampleRate;
- for (var k = 0; k < length; ++k) {
+ let expected = new Float32Array(length);
+ let omega = 2 * Math.PI * freq / sampleRate;
+ for (let k = 0; k < length; ++k) {
expected[k] = gen(omega * k);
}
return expected;
@@ -161,15 +162,15 @@
// produces the expected result.
function verifyPeriodicWaveOutput(
should, waveOptions, expectedFunction, threshold) {
- var node;
+ let node;
// Rather arbitrary sample rate and render length. Length doesn't have
// to be very long.
- var sampleRate = 48000;
- var renderLength = 0.25;
- var testContext =
+ let sampleRate = 48000;
+ let renderLength = 0.25;
+ let testContext =
new OfflineAudioContext(1, renderLength * sampleRate, sampleRate);
- var options = {
+ let options = {
periodicWave: new PeriodicWave(testContext, waveOptions)
};
node = new OscillatorNode(testContext, options);
@@ -179,12 +180,12 @@
node.start();
return testContext.startRendering().then(function(resultBuffer) {
- var actual = resultBuffer.getChannelData(0);
- var expected = expectedFunction(
+ let actual = resultBuffer.getChannelData(0);
+ let expected = expectedFunction(
actual.length, node.frequency.value, testContext.sampleRate);
// Actual must match expected to within the (experimentally)
// determined threshold.
- var message = '';
+ let message = '';
if (waveOptions.disableNormalization != undefined)
message =
'disableNormalization: ' + waveOptions.disableNormalization;

Powered by Google App Engine
This is Rietveld 408576698