Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / webaudio / delaynode-maxdelaylimit.html
index 8fe06d5..39aa8be 100644 (file)
@@ -2,7 +2,7 @@
 
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
+<script src="../resources/js-test.js"></script>
 <script src="resources/audio-testing.js"></script>
 <script src="resources/delay-testing.js"></script>
 </head>
 description("Tests attribute and maximum allowed delay of DelayNode.");
 
 function runTest() {
-    if (window.testRunner) {
-        testRunner.dumpAsText();
-        testRunner.waitUntilDone();
-    }
-    
     window.jsTestIsAsync = true;
         
     // Create offline audio context.
-    var context = new webkitAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
+    var context = new webkitOfflineAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
     var toneBuffer = createToneBuffer(context, 20, 20 * toneLengthSeconds, sampleRate); // 20Hz tone
     
     var bufferSource = context.createBufferSource();
     bufferSource.buffer = toneBuffer;
 
-    // The delay node clips the maximum delay.  Create a node with a delay larger than the maximum
-    // allowed delay.
-    var delay = context.createDelayNode(1000);
-    
-    window.delay = delay;
-    shouldBeTrue("delay.delayTime.maxValue === 300");
-    shouldBeTrue("delay.delayTime.value === 0.0");
+    window.context = context;
+    shouldThrow("context.createDelay(180)");
+    shouldThrow("context.createDelay(0)");
+    shouldThrow("context.createDelay(-1)");
 
+    var delay = context.createDelay(179);
     delay.delayTime.value = delayTimeSeconds;
+    window.delay = delay;
     shouldBeTrue("delay.delayTime.value === 0.5");
 
     bufferSource.connect(delay);
     delay.connect(context.destination);
-    bufferSource.noteOn(0);
+    bufferSource.start(0);
     
     context.oncomplete = checkDelayedResult(toneBuffer);
     context.startRendering();
@@ -52,7 +46,5 @@ function runTest() {
 runTest();
 
 </script>
-
-<script src="../fast/js/resources/js-test-post.js"></script>
 </body>
 </html>