Bug 815643 - Part 9: Port Blink's LayoutTest for ConvolverNode to mochitest-plain; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 10 Jun 2013 16:10:07 -0400
changeset 134593 63386b71d1b5
parent 134592 c78350f78192
child 134594 b7637656cc54
push id29285
push usereakhgari@mozilla.com
push dateTue, 11 Jun 2013 00:10:14 +0000
treeherdermozilla-inbound@63386b71d1b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs815643
milestone24.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
Bug 815643 - Part 9: Port Blink's LayoutTest for ConvolverNode to mochitest-plain; r=roc
content/media/webaudio/test/Makefile.in
content/media/webaudio/test/blink/Makefile.in
content/media/webaudio/test/blink/convolution-testing.js
content/media/webaudio/test/layouttest-glue.js
content/media/webaudio/test/test_convolverNode_mono_mono.html
--- a/content/media/webaudio/test/Makefile.in
+++ b/content/media/webaudio/test/Makefile.in
@@ -47,16 +47,17 @@ MOCHITEST_FILES := \
   test_audioBufferSourceNodeNullBuffer.html \
   test_badConnect.html \
   test_biquadFilterNode.html \
   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_delayNodeSmallMaxDelay.html \
   test_delayNodeWithGain.html \
   test_dynamicsCompressorNode.html \
   test_gainNode.html \
   test_gainNodeInLoop.html \
   test_maxChannelCount.html \
--- a/content/media/webaudio/test/blink/Makefile.in
+++ b/content/media/webaudio/test/blink/Makefile.in
@@ -6,14 +6,15 @@ DEPTH          := @DEPTH@
 topsrcdir      := @top_srcdir@
 srcdir         := @srcdir@
 VPATH          := @srcdir@
 relativesrcdir := @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_FILES := \
+  audio-testing.js \
+  convolution-testing.js \
   panner-model-testing.js \
-  audio-testing.js \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
--- a/content/media/webaudio/test/blink/convolution-testing.js
+++ b/content/media/webaudio/test/blink/convolution-testing.js
@@ -61,17 +61,17 @@ function checkTriangularPulse(rendered, 
             maxDeltaIndex = i;
         }
     }
 
     // allowedDeviationFraction was determined experimentally.  It
     // is the threshold of the relative error at the maximum
     // difference between the true triangular pulse and the
     // rendered pulse.
-    var allowedDeviationDecibels = -133.5;
+    var allowedDeviationDecibels = -129.4;
     var maxDeviationDecibels = linearToDecibel(maxDelta / valueAtMaxDelta);
 
     if (maxDeviationDecibels <= allowedDeviationDecibels) {
         testPassed("Triangular portion of convolution is correct.");
     } else {
         testFailed("Triangular portion of convolution is not correct.  Max deviation = " + maxDeviationDecibels + " dB at " + maxDeltaIndex);
         match = false;
     }
--- a/content/media/webaudio/test/layouttest-glue.js
+++ b/content/media/webaudio/test/layouttest-glue.js
@@ -8,8 +8,12 @@ function testFailed(msg) {
 function testPassed(msg) {
   ok(true, msg);
 }
 
 function finishJSTest() {
   SimpleTest.finish();
 }
 
+function description(str) {
+  info(str);
+}
+
--- a/content/media/webaudio/test/test_convolverNode_mono_mono.html
+++ b/content/media/webaudio/test/test_convolverNode_mono_mono.html
@@ -1,66 +1,76 @@
 <!DOCTYPE html>
 
 <html>
 <head>
-<link rel="stylesheet" href="../fast/js/resources/js-test-style.css"/>
-<script type="text/javascript" src="resources/audio-testing.js"></script>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/convolution-testing.js"></script>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="webaudio.js"></script>
+<script type="text/javascript" src="layouttest-glue.js"></script>
+<script type="text/javascript" src="blink/audio-testing.js"></script>
+<script type="text/javascript" src="blink/convolution-testing.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 
 <body>
 
 <div id="description"></div>
 <div id="console"></div>
 
 <script>
 description("Tests ConvolverNode processing a mono channel with mono impulse response.");
+SimpleTest.waitForExplicitFinish();
 
 // To test the convolver, we convolve two square pulses together to
 // produce a triangular pulse.  To verify the result is correct we
 // check several parts of the result.  First, we make sure the initial
 // part of the result is zero (due to the latency in the convolver).
 // Next, the triangular pulse should match the theoretical result to
 // within some roundoff.  After the triangular pulse, the result
 // should be exactly zero, but round-off prevents that.  We make sure
 // the part after the pulse is sufficiently close to zero.  Finally,
 // the result should be exactly zero because the inputs are exactly
 // zero.
 function runTest() {
+    SpecialPowers.setBoolPref("media.webaudio.enabled", true);
+
     if (window.testRunner) {
         testRunner.dumpAsText();
         testRunner.waitUntilDone();
     }
-    
+
     window.jsTestIsAsync = true;
-        
+
     // Create offline audio context.
-    var context = new webkitOfflineAudioContext(2, sampleRate * renderLengthSeconds, sampleRate);
+    var context = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, sampleRate);
 
     var squarePulse = createSquarePulseBuffer(context, pulseLengthFrames);
     var trianglePulse = createTrianglePulseBuffer(context, 2 * pulseLengthFrames);
-    
+
     var bufferSource = context.createBufferSource();
     bufferSource.buffer = squarePulse;
-    
+
     var convolver = context.createConvolver();
     convolver.normalize = false;
     convolver.buffer = squarePulse;
 
     bufferSource.connect(convolver);
     convolver.connect(context.destination);
 
     bufferSource.noteOn(0);
-    
+
     context.oncomplete = checkConvolvedResult(trianglePulse);
     context.startRendering();
 }
 
+function finishJSTest() {
+  SpecialPowers.clearUserPref("media.webaudio.enabled");
+  SimpleTest.finish();
+}
+
 runTest();
 successfullyParsed = true;
 
 </script>
 
 <script src="../fast/js/resources/js-test-post.js"></script>
 </body>
 </html>