Index: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-grain.html |
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-grain.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-grain.html |
index 0ac2da6be8fb230de80f89608b3f2de5ef81063a..a09be88b9d48aa56397a2f510faeb1c0adf0f81f 100644 |
--- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-grain.html |
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-grain.html |
@@ -1,15 +1,16 @@ |
-<!doctype html> |
+<!DOCTYPE html> |
<html> |
<head> |
- <title>Test Start Grain with Delayed Buffer Setting </title> |
+ <title> |
+ Test Start Grain with Delayed Buffer Setting |
+ </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(); |
let context; |
let source; |
@@ -22,35 +23,37 @@ |
let testDurationSamples = testDurationSec * sampleRate; |
let startTime = 0.9 * testDurationSec; |
- audit.define("Test setting the source buffer after starting the grain", |
- function (task, should) { |
- context = new OfflineAudioContext(1, testDurationSamples, |
- sampleRate); |
+ audit.define( |
+ 'Test setting the source buffer after starting the grain', |
+ function(task, should) { |
+ context = |
+ new OfflineAudioContext(1, testDurationSamples, sampleRate); |
- buffer = createConstantBuffer(context, testDurationSamples, 1); |
- source = context.createBufferSource(); |
- source.connect(context.destination); |
+ buffer = createConstantBuffer(context, testDurationSamples, 1); |
+ source = context.createBufferSource(); |
+ source.connect(context.destination); |
- // Start the source BEFORE we set the buffer. The grain offset and duration aren't |
- // important, as long as we specify some offset. |
- source.start(startTime, .1); |
- source.buffer = buffer; |
+ // Start the source BEFORE we set the buffer. The grain offset and |
+ // duration aren't important, as long as we specify some offset. |
+ source.start(startTime, .1); |
+ source.buffer = buffer; |
- // Render it! |
- context.startRendering() |
- .then(function (buffer) { |
- checkResult(buffer, should); |
- }) |
- .then(task.done.bind(task));; |
- }); |
+ // Render it! |
+ context.startRendering() |
+ .then(function(buffer) { |
+ checkResult(buffer, should); |
+ }) |
+ .then(task.done.bind(task)); |
+ ; |
+ }); |
function checkResult(buffer, should) { |
let success = false; |
renderedData = buffer.getChannelData(0); |
- // Check that the rendered data is not all zeroes. Any non-zero data means the test |
- // passed. |
+ // Check that the rendered data is not all zeroes. Any non-zero data |
+ // means the test passed. |
let startFrame = Math.round(startTime * sampleRate); |
for (k = 0; k < renderedData.length; ++k) { |
if (renderedData[k]) { |
@@ -59,7 +62,7 @@ |
} |
} |
- should(success, "Buffer was played").beTrue(); |
+ should(success, 'Buffer was played').beTrue(); |
} |
audit.run(); |