| Index: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-start.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-start.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-start.html
|
| index f30c9a209c2a340c404d7906d6012bca89850214..e369af1f71f17f6bab2b5e607eb710ed3db55611 100644
|
| --- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-start.html
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-start.html
|
| @@ -2,23 +2,21 @@
|
|
|
| <html>
|
| <head>
|
| -<script src="../../resources/js-test.js"></script>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| <script src="../resources/audit-util.js"></script>
|
| -<script src="../resources/audio-testing.js"></script>
|
| +<script src="../resources/audit.js"></script>
|
| <script src="../resources/audiobuffersource-testing.js"></script>
|
| </head>
|
|
|
| <body>
|
|
|
| -<div id="description"></div>
|
| -<div id="console"></div>
|
| -
|
| <script>
|
| -description("Tests AudioBufferSourceNode start() with a variety of offsets and durations.");
|
| +let audit = Audit.createTaskRunner();
|
|
|
| // The following test cases assume an AudioBuffer of length 8 whose PCM data is a linear ramp, 0, 1, 2, 3,...
|
|
|
| -var tests = [
|
| +let tests = [
|
|
|
| { description: "start(when): implicitly play whole buffer from beginning to end",
|
| offsetFrame: "none", durationFrames: "none", renderFrames: 16, playbackRate: 1, expected: [0,1,2,3,4,5,6,7,0,0,0,0,0,0,0,0] },
|
| @@ -55,15 +53,15 @@ var tests = [
|
|
|
| ];
|
|
|
| -var sampleRate = 44100;
|
| -var buffer;
|
| -var bufferFrameLength = 8;
|
| -var testSpacingFrames = 32;
|
| -var testSpacingSeconds = testSpacingFrames / sampleRate;
|
| -var totalRenderLengthFrames = tests.length * testSpacingFrames;
|
| +let sampleRate = 44100;
|
| +let buffer;
|
| +let bufferFrameLength = 8;
|
| +let testSpacingFrames = 32;
|
| +let testSpacingSeconds = testSpacingFrames / sampleRate;
|
| +let totalRenderLengthFrames = tests.length * testSpacingFrames;
|
|
|
| function runLoopTest(context, testNumber, test) {
|
| - var source = context.createBufferSource();
|
| + let source = context.createBufferSource();
|
|
|
| source.buffer = buffer;
|
| source.playbackRate.value = test.playbackRate;
|
| @@ -71,42 +69,36 @@ function runLoopTest(context, testNumber, test) {
|
| source.connect(context.destination);
|
|
|
| // Render each test one after the other, spaced apart by testSpacingSeconds.
|
| - var startTime = testNumber * testSpacingSeconds;
|
| + let startTime = testNumber * testSpacingSeconds;
|
|
|
| if (test.offsetFrame == "none" && test.durationFrames == "none") {
|
| source.start(startTime);
|
| } else if (test.durationFrames == "none") {
|
| - var offset = test.offsetFrame / context.sampleRate;
|
| + let offset = test.offsetFrame / context.sampleRate;
|
| source.start(startTime, offset);
|
| } else {
|
| - var offset = test.offsetFrame / context.sampleRate;
|
| - var duration = test.durationFrames / context.sampleRate;
|
| + let offset = test.offsetFrame / context.sampleRate;
|
| + let duration = test.durationFrames / context.sampleRate;
|
| source.start(startTime, offset, duration);
|
| }
|
| }
|
|
|
| -function runTest() {
|
| - if (window.testRunner) {
|
| - testRunner.dumpAsText();
|
| - testRunner.waitUntilDone();
|
| - }
|
| -
|
| - window.jsTestIsAsync = true;
|
| -
|
| +audit.define("Tests AudioBufferSourceNode start()", function (task, should) {
|
| // Create offline audio context.
|
| - var context = new OfflineAudioContext(1, totalRenderLengthFrames, sampleRate);
|
| + let context = new OfflineAudioContext(1, totalRenderLengthFrames, sampleRate);
|
| buffer = createTestBuffer(context, bufferFrameLength);
|
|
|
| - for (var i = 0; i < tests.length; ++i)
|
| + for (let i = 0; i < tests.length; ++i)
|
| runLoopTest(context, i, tests[i]);
|
|
|
| - context.oncomplete = checkAllTests;
|
| - context.startRendering();
|
| -}
|
| -
|
| -runTest();
|
| -successfullyParsed = true;
|
| + context.startRendering()
|
| + .then(function (audioBuffer) {
|
| + checkAllTests(audioBuffer, should);
|
| + task.done();
|
| + });
|
| +});
|
|
|
| +audit.run();
|
| </script>
|
|
|
| </body>
|
|
|