Bug 878875 - Port Blink's LayoutTest for PannerNode to mochitest-plain. r=ehsan
authorPaul Adenot <paul@paul.cx>
Fri, 07 Jun 2013 20:06:40 +0200
changeset 145894 fcdcf78fa4e34a94d77f4307fc1c0dd197a4ef14
parent 145893 b61e0a52d29cbf47f7f01838539d499a90d196cb
child 145895 29363d0fd7ff5f52300d39bb87c4aa3f4e6ec386
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs878875
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 878875 - Port Blink's LayoutTest for PannerNode to mochitest-plain. r=ehsan
content/media/webaudio/test/Makefile.in
content/media/webaudio/test/blink/Makefile.in
content/media/webaudio/test/blink/panner-model-testing.js
content/media/webaudio/test/layouttest-glue.js
content/media/webaudio/test/moz.build
content/media/webaudio/test/test_pannerNode_equalPower.html
--- a/content/media/webaudio/test/Makefile.in
+++ b/content/media/webaudio/test/Makefile.in
@@ -7,16 +7,17 @@ topsrcdir      := @top_srcdir@
 srcdir         := @srcdir@
 VPATH          := @srcdir@
 relativesrcdir := @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_FILES := \
   webaudio.js \
+  layouttest-glue.js \
   test_bug808374.html \
   test_bug827541.html \
   test_bug839753.html \
   test_bug845960.html \
   test_bug856771.html \
   test_bug866570.html \
   test_bug866737.html \
   test_bug867089.html \
@@ -62,16 +63,17 @@ MOCHITEST_FILES := \
   test_gainNodeInLoop.html \
   test_mediaDecoding.html \
   test_mixingRules.html \
   test_nodeToParamConnection.html \
   test_OfflineAudioContext.html \
   test_offlineDestinationChannelCountLess.html \
   test_offlineDestinationChannelCountMore.html \
   test_pannerNode.html \
+  test_pannerNode_equalPower.html \
   test_scriptProcessorNode.html \
   test_scriptProcessorNodeChannelCount.html \
   test_scriptProcessorNodeZeroInputOutput.html \
   test_singleSourceDest.html \
   test_waveShaper.html \
   test_waveShaperNoCurve.html \
   test_waveShaperZeroLengthCurve.html \
   test_waveTable.html \
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/test/blink/Makefile.in
@@ -0,0 +1,19 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH          := @DEPTH@
+topsrcdir      := @top_srcdir@
+srcdir         := @srcdir@
+VPATH          := @srcdir@
+relativesrcdir := @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MOCHITEST_FILES := \
+  panner-model-testing.js \
+  audio-testing.js \
+  $(NULL)
+
+include $(topsrcdir)/config/rules.mk
+
--- a/content/media/webaudio/test/blink/panner-model-testing.js
+++ b/content/media/webaudio/test/blink/panner-model-testing.js
@@ -1,9 +1,9 @@
-var sampleRate = 44100.0;
+var sampleRate = 48000.0;
 
 var numberOfChannels = 1;
 
 // Time step when each panner node starts.
 var timeStep = 0.001;
 
 // Length of the impulse signal.
 var pulseLengthFrames = Math.round(timeStep * sampleRate);
@@ -186,17 +186,17 @@ function checkResult(event) {
     }
 
     if (maxErrorL <= maxAllowedError) {
         testPassed("Left channel gain values are correct.");
     } else {
         testFailed("Left channel gain values are incorrect.  Max error = " + maxErrorL + " at time " + time[maxErrorIndexL] + " (threshold = " + maxAllowedError + ")");
         success = false;
     }
-    
+
     if (maxErrorR <= maxAllowedError) {
         testPassed("Right channel gain values are correct.");
     } else {
         testFailed("Right channel gain values are incorrect.  Max error = " + maxErrorR + " at time " + time[maxErrorIndexR] + " (threshold = " + maxAllowedError + ")");
         success = false;
     }
 
     if (success) {
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/test/layouttest-glue.js
@@ -0,0 +1,15 @@
+// Reimplementation of the LayoutTest API from Blink so we can easily port
+// WebAudio tests to Simpletest, without touching the internals of the test.
+
+function testFailed(msg) {
+  ok(false, msg);
+}
+
+function testPassed(msg) {
+  ok(true, msg);
+}
+
+function finishJSTest() {
+  SimpleTest.finish();
+}
+
--- a/content/media/webaudio/test/moz.build
+++ b/content/media/webaudio/test/moz.build
@@ -1,5 +1,7 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+PARALLEL_DIRS += ['blink']
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/test/test_pannerNode_equalPower.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Test PannerNode</title>
+<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/panner-model-testing.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(function() {
+  SpecialPowers.setBoolPref("media.webaudio.enabled", true);
+  function checkFinished() {
+    SpecialPowers.clearUserPref("media.webaudio.enabled");
+    SimpleTest.finish();
+  }
+  var ctx = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, sampleRate);
+  createTestAndRun(ctx, nodesToCreate, 2, checkFinished);
+});
+</script>
+</pre>
+</body>
+</html>