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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-multi-channels.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/AudioBufferSource/audiobuffersource-multi-channels.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-multi-channels.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-multi-channels.html
index 4139d3621b3ec194092eefb2f2038b97d42a0c0a..92e22c5b320a682e379b05a4bd09cff3d9c63d11 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-multi-channels.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-multi-channels.html
@@ -1,78 +1,80 @@
<!DOCTYPE html>
-
<!--
Test AudioBufferSourceNode supports 5.1 channel.
-->
-
<html>
-<head>
-<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="../resources/mix-testing.js"></script>
-</head>
-<body>
-
-<script>
-let audit = Audit.createTaskRunner();
-let context;
-let expectedAudio;
-
-audit.define('initialize', (task, should) => {
- // Create offline audio context
- let sampleRate = 44100.0;
- should(() => {
- context =
- new OfflineAudioContext(6, sampleRate * toneLengthSeconds, sampleRate);
- }, 'Creating context for testing').notThrow();
- should(
- Audit.loadFileFromUrl('audiobuffersource-multi-channels-expected.wav')
- .then(arrayBuffer => {
- context.decodeAudioData(arrayBuffer).then(audioBuffer => {
- expectedAudio = audioBuffer;
- });
- }),
- 'Fetching expected audio')
- .beResolved()
- .then(() => task.done());
+ <head>
+ <title>
+ audiobuffersource-multi-channels.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>
+ <script src="../resources/mix-testing.js"></script>
+ </head>
+ <body>
+ <script id="layout-test-code">
+ let audit = Audit.createTaskRunner();
+ let context;
+ let expectedAudio;
-});
+ audit.define('initialize', (task, should) => {
+ // Create offline audio context
+ let sampleRate = 44100.0;
+ should(() => {
+ context = new OfflineAudioContext(
+ 6, sampleRate * toneLengthSeconds, sampleRate);
+ }, 'Creating context for testing').notThrow();
+ should(
+ Audit
+ .loadFileFromUrl(
+ 'audiobuffersource-multi-channels-expected.wav')
+ .then(arrayBuffer => {
+ context.decodeAudioData(arrayBuffer).then(audioBuffer => {
+ expectedAudio = audioBuffer;
+ });
+ }),
+ 'Fetching expected audio')
+ .beResolved()
+ .then(() => task.done());
-audit.define(
- {label: 'test', description: 'AudioBufferSource with 5.1 buffer'},
- (task, should) => {
- let toneBuffer = createToneBuffer(context, 440, toneLengthSeconds, 6);
+ });
- let source = context.createBufferSource();
- source.buffer = toneBuffer;
+ audit.define(
+ {label: 'test', description: 'AudioBufferSource with 5.1 buffer'},
+ (task, should) => {
+ let toneBuffer =
+ createToneBuffer(context, 440, toneLengthSeconds, 6);
- source.connect(context.destination);
- source.start(0);
+ let source = context.createBufferSource();
+ source.buffer = toneBuffer;
- context.startRendering()
- .then(renderedAudio => {
- // Compute a threshold based on the maximum error, |maxUlp|, in ULP.
- // This is experimentally determined. Assuming that the reference
- // file is a 16-bit wav file, the max values in the wave file
- // are +/- 32768.
- let maxUlp = 1;
- let threshold = maxUlp / 32768;
+ source.connect(context.destination);
+ source.start(0);
- for (let k = 0; k < renderedAudio.numberOfChannels; ++k) {
- should(
- renderedAudio.getChannelData(k),
- 'Rendered audio for channel ' + k)
- .beCloseToArray(
- expectedAudio.getChannelData(k),
- {absoluteThreshold: threshold});
- }
- })
- .then(() => task.done());
- });
+ context.startRendering()
+ .then(renderedAudio => {
+ // Compute a threshold based on the maximum error, |maxUlp|,
+ // in ULP. This is experimentally determined. Assuming that
+ // the reference file is a 16-bit wav file, the max values in
+ // the wave file are +/- 32768.
+ let maxUlp = 1;
+ let threshold = maxUlp / 32768;
-audit.run();
-</script>
+ for (let k = 0; k < renderedAudio.numberOfChannels; ++k) {
+ should(
+ renderedAudio.getChannelData(k),
+ 'Rendered audio for channel ' + k)
+ .beCloseToArray(
+ expectedAudio.getChannelData(k),
+ {absoluteThreshold: threshold});
+ }
+ })
+ .then(() => task.done());
+ });
-</body>
+ audit.run();
+ </script>
+ </body>
</html>

Powered by Google App Engine
This is Rietveld 408576698