test for bug 890528
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 02 Sep 2013 12:59:31 +1200
changeset 145208 132f26bd5f496ebe18dd60c2568329bcc8e48313
parent 145207 ed23ecc80370e5f81605398415ae77a4c881c5dd
child 145209 b4c42f7b488f3606988c25f8f0dbcba160892771
push id25201
push useremorley@mozilla.com
push dateMon, 02 Sep 2013 13:55:21 +0000
treeherdermozilla-central@66991961691d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs890528
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
test for bug 890528
content/media/webaudio/test/Makefile.in
content/media/webaudio/test/test_delayNodeAtMax.html
--- a/content/media/webaudio/test/Makefile.in
+++ b/content/media/webaudio/test/Makefile.in
@@ -55,16 +55,17 @@ MOCHITEST_FILES := \
   test_channelMergerNode.html \
   test_channelMergerNodeWithVolume.html \
   test_channelSplitterNode.html \
   test_channelSplitterNodeWithVolume.html \
   test_convolverNode.html \
   test_convolverNode_mono_mono.html \
   test_currentTime.html \
   test_delayNode.html \
+  test_delayNodeAtMax.html \
   test_delayNodeSmallMaxDelay.html \
   test_delayNodeWithGain.html \
   test_dynamicsCompressorNode.html \
   test_gainNode.html \
   test_gainNodeInLoop.html \
   test_maxChannelCount.html \
   test_mediaDecoding.html \
   test_decodeMultichannel.html \
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/test/test_delayNodeAtMax.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test DelayNode with maxDelayTime delay - bug 890528</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<pre id="test">
+<script src="webaudio.js" type="text/javascript"></script>
+<script class="testbody" type="text/javascript">
+
+const signalLength = 2048;
+const delayLength = 1000; // Not on a block boundary
+const outputLength = 4096 // > signalLength + 2 * delayLength;
+
+function applySignal(buffer, offset) {
+  for (var i = 0; i < signalLength; ++i) {
+    buffer.getChannelData(0)[offset + i] = Math.cos(Math.PI * i / signalLength);
+  }
+}
+
+var gTest = {
+  numberOfChannels: 1,
+  createGraph: function(context) {
+    var buffer = context.createBuffer(1, 2048, context.sampleRate);
+    applySignal(buffer, 0);
+
+    var source = context.createBufferSource();
+    source.buffer = buffer;
+
+    const delayTime = delayLength / context.sampleRate;
+    var delay = context.createDelay(delayTime);
+    delay.delayTime.value = delayTime;
+
+    source.connect(delay);
+
+    source.start(0);
+    return delay;
+  },
+  createExpectedBuffers: function(context) {
+    var expectedBuffer = context.createBuffer(1, 4096, context.sampleRate);
+    applySignal(expectedBuffer, delayLength);
+    return expectedBuffer;
+  },
+};
+
+runTest();
+
+</script>
+</pre>
+</body>
+</html>