test for bug 890528 a=webaudio
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 02 Sep 2013 12:59:31 +1200
changeset 153934 9e9f4ff8bd5caa1240f21548197a1a8835630d38
parent 153933 2058e98598737c4fecf03b2605d2708893c2aff4
child 153935 917e9180f309615424cb31c892500c274596821c
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswebaudio
bugs890528
milestone25.0a2
test for bug 890528 a=webaudio
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>