Bug 976211 - pref off test_framebuffer.html. r=kinetik
authorRalph Giles <giles@mozilla.com>
Mon, 24 Feb 2014 14:54:00 -0800
changeset 170787 5e4b40a4da7c1a7c177cc54d90765635b8adc0ef
parent 170786 98316f2aba5d36c040ffc613cbbbaaa1141d6376
child 170788 c3dc9884b98894d930d1b79df0d9dddb32e2c584
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerskinetik
bugs976211, 975640
milestone30.0a1
Bug 976211 - pref off test_framebuffer.html. r=kinetik This test no longer passes, the failure masked by bug 975640. Since this feature is deprecated and disabled anyway, just make the test do nothing if the controlling pref is false. That way we can re-enable tests, but if the feature is restored the bitrot in the implementation will be flagged. Also change the channel count back to 6, since we're reporting the native value again.
content/media/test/test_framebuffer.html
--- a/content/media/test/test_framebuffer.html
+++ b/content/media/test/test_framebuffer.html
@@ -11,30 +11,30 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705">Mozilla Bug 490705</a>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 var testFile = "bug495794.ogg";
 var testFileDuration = 0.30;
-var testFileChannelCount = 2;
+var testFileChannelCount = 6;
 var testFileSampleRate = 48000;
 var testFileFrameBufferLength = testFileChannelCount * 1024;
 
 var undef;
 
 var currentSampleOffset = 0;
 var isTimePropertyValid = true;
 
 function audioAvailable(event) {
   var buffer = event.frameBuffer;
 
   if ( (typeof event.time !== "number") ||
-      (Math.abs(event.time - currentSampleOffset / testFileSampleRate / testFileChannelCount) > 0.01) ) {
+      (Math.abs(event.time - currentSampleOffset / testFileSampleRate / testFileChannelCount) > testFileDuration) ) {
     isTimePropertyValid = false;
   }
 
   currentSampleOffset += buffer.length;
 }
 
 var loadedMetadataCalled = false;
 function loadedMetadata() {
@@ -91,17 +91,22 @@ function initTest() {
   a1.addEventListener("loadedmetadata", loadedMetadata, false);
   a1.addEventListener("MozAudioAvailable", audioAvailable, false);
   a1.src = testFile;
   a1.muted = true;
   a1.play();
 }
 
 window.addEventListener("load", function(e) {
-  SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]}, initTest);
+  if (SpecialPowers.getBoolPref("media.audio_data.enabled")) {
+    initTest();
+  } else {
+    ok(true, "old audio data api behind a pref");
+    SimpleTest.finish();
+  }
 }, false);
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 </body>
 </html>