Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / webaudio / audiobuffersource-negative-playbackrate.html
index dbd9e9a..7dcf81d 100644 (file)
@@ -2,36 +2,37 @@
 <html>
 <head>
     <title>audiobuffersource-negative-playbackrate</title>
-    <script type="text/javascript" src="resources/audio-testing.js"></script>
-    <script type="text/javascript" src="resources/buffer-loader.js"></script>
+    <script src="../resources/js-test.js"></script>
+    <script src="resources/audio-testing.js"></script>
+    <script src="resources/audiobuffersource-testing.js"></script>
 
     <script>
+
     var sampleRate = 44100.0;
-    var lengthInSeconds = 2;
+    var sourceFrames = 128;
+    var renderFrames = 10;
+    var testSpacingFrames = 0;
 
-    var context = 0;
-    var bufferLoader = 0;
+    var tests = [{ 
+        description:"Test playback at -1 playbackRate",
+        offsetFrame:0,
+        renderFrames:renderFrames,
+        expected:[127, 126, 125, 124, 123, 122, 121, 120, 119, 118],
+    }];
 
     function go() {
-        if (!window.testRunner)
-            return;
-
-        context = new webkitOfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);
+        jsTestIsAsync = true;
 
-        bufferLoader = new BufferLoader(context, ["resources/hyper-reality/br-jam-loop.wav"], finishedLoading);
-        bufferLoader.load();
-        testRunner.waitUntilDone();
-    }
+        context = new webkitOfflineAudioContext(1, renderFrames, sampleRate);
 
-    function finishedLoading(bufferList) {
         var bufferSource = context.createBufferSource();
-        bufferSource.buffer = bufferList[0];
+        bufferSource.buffer = createRamp(context, 0, 127, sourceFrames);
 
         bufferSource.connect(context.destination);
         bufferSource.playbackRate.value = -1;
         bufferSource.start(0);
 
-        context.oncomplete = finishAudioTest;
+        context.oncomplete = checkAllTests;
         context.startRendering();
     }