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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-resample.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/AudioBuffer/audiobuffer-resample.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-resample.html b/third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-resample.html
index ce6dfc4c540b09471ea47e42ac38bf156be8cae9..c1e2410f8b0dcac6fe49ce553ad0eaa3b2135d11 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-resample.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-resample.html
@@ -1,14 +1,16 @@
-<!doctype>
+<!DOCTYPE html>
<html>
<head>
+ <title>
+ audiobuffer-resample.html
+ </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>
</head>
-
<body>
- <script>
+ <script id="layout-test-code">
let audit = Audit.createTaskRunner();
// These are global to make debugging a little easier.
@@ -54,7 +56,8 @@
renderedData = buffer.getChannelData(0);
let length = renderedData.length;
// Generate a reference sine wave at the context rate
- let trueReference = createSineBuffer(context, toneFrequency, context.sampleRate);
+ let trueReference =
+ createSineBuffer(context, toneFrequency, context.sampleRate);
trueData = trueReference.getChannelData(0);
// To compare the actual output against the reference, we compute the
@@ -81,33 +84,30 @@
else
snr = 10 * Math.log10(signalEnergy / noiseEnergy);
- should(maxError, "Peak error between actual and reference data")
- .beLessThan(peakThreshold);
+ should(maxError, 'Peak error between actual and reference data')
+ .beLessThan(peakThreshold);
- should(snr, "SNR")
- .beGreaterThan(snrThreshold);
+ should(snr, 'SNR').beGreaterThan(snrThreshold);
}
- audit.define("Test resampling of an AudioBuffer",
- function(task, should) {
- context = new OfflineAudioContext(1, lengthInSeconds *
- sampleRate,
- sampleRate);
-
- // Create a sine wave in a buffer that's different from the context rate
- // to test resampling.
- buffer = createSineBuffer(context, toneFrequency, bufferRate);
- source = context.createBufferSource();
- source.buffer = buffer;
- source.connect(context.destination);
- source.start();
-
- context.startRendering()
+ audit.define('Test resampling of an AudioBuffer', function(task, should) {
+ context = new OfflineAudioContext(
+ 1, lengthInSeconds * sampleRate, sampleRate);
+
+ // Create a sine wave in a buffer that's different from the context rate
+ // to test resampling.
+ buffer = createSineBuffer(context, toneFrequency, bufferRate);
+ source = context.createBufferSource();
+ source.buffer = buffer;
+ source.connect(context.destination);
+ source.start();
+
+ context.startRendering()
.then(function(buffer) {
checkResult(buffer, should);
})
.then(task.done.bind(task));
- });
+ });
audit.run();
</script>

Powered by Google App Engine
This is Rietveld 408576698