Bug 1195051 - Part 3: Test changes; r=padenot
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 15 Aug 2015 18:43:20 -0400
changeset 258037 5a66bd178c4cdadcdb381550e33a6d7b6b971062
parent 258036 4abc258b07a7d019890454eb3b7620bb4a4d357b
child 258038 64c69057a183e8b6314576c8e5bddd7ffe2ee00c
push id29241
push userkwierso@gmail.com
push dateTue, 18 Aug 2015 00:00:46 +0000
treeherdermozilla-central@6ae3e9ff53b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1195051
milestone43.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 1195051 - Part 3: Test changes; r=padenot
dom/base/test/file_webaudioLoop.html
dom/base/test/mochitest.ini
dom/base/test/test_noWebAudioNotification.html
dom/base/test/test_webaudioNotification.html
--- a/dom/base/test/file_webaudioLoop.html
+++ b/dom/base/test/file_webaudioLoop.html
@@ -4,25 +4,20 @@ var ac = new AudioContext();
 fetch("audio.ogg").then(response => {
   return response.arrayBuffer();
 }).then(ab => {
   return ac.decodeAudioData(ab);
 }).then(ab => {
   var src = ac.createBufferSource();
   src.buffer = ab;
   src.loop = true;
+  src.loopStart = 0;
+  src.loopEnd = ab.duration;
   src.start();
   src.connect(ac.destination);
-  setTimeout(() => {
-    if (ac.state == "running") {
-      parent.runTest();
-    } else {
-      setTimeout(arguments.callee, 0);
-    }
-  });
 });
 
 var suspendPromise;
 function suspendAC() {
   suspendPromise = ac.suspend();
 }
 
 var resumePromise;
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -299,16 +299,17 @@ skip-if = buildapp == 'mulet' || buildap
 [test_messagemanager_targetchain.html]
 [test_named_frames.html]
 [test_navigator_resolve_identity.html]
 [test_navigator_language.html]
 [test_noAudioNotification.html]
 [test_noAudioNotificationOnMutedElement.html]
 [test_noAudioNotificationOnMutedOrVolume0Element.html]
 [test_noAudioNotificationOnVolume0Element.html]
+[test_noWebAudioNotification.html]
 [test_openDialogChromeOnly.html]
 [test_open_null_features.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Fails on b2g-desktop, tracked in bug 1011874
 [test_postMessage_solidus.html]
 [test_pluginAudioNotification.html]
 skip-if = (buildapp == 'b2g' || buildapp == 'mulet' || toolkit == 'android') # Plugins don't work on Android and/or B2G/Mulet
 [test_screen_orientation.html]
 [test_settimeout_extra_arguments.html]
copy from dom/base/test/test_webaudioNotification.html
copy to dom/base/test/test_noWebAudioNotification.html
--- a/dom/base/test/test_webaudioNotification.html
+++ b/dom/base/test/test_noWebAudioNotification.html
@@ -1,67 +1,49 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <title>Test for audio controller in windows</title>
+  <title>Test for video controller in windows</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <pre id="test">
 </pre>
-<iframe></iframe>
 
 <script type="application/javascript">
 
 SimpleTest.waitForExplicitFinish();
-
-var expectedNotification = null;
-var iframe = null;
+SimpleTest.requestFlakyTimeout("Testing an event not happening");
 
 var observer = {
   observe: function(subject, topic, data) {
-    is(topic, "audio-playback", "audio-playback received");
-    is(data, expectedNotification, "This is the right notification");
-    SimpleTest.executeSoon(runTest);
+    ok(false, "should not receive audio-playback notification!");
   }
 };
 
 var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
                                    .getService(SpecialPowers.Ci.nsIObserverService);
 
+var ac;
+
 var tests = [
   function() {
-    iframe = document.querySelector("iframe");
     SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
   },
 
   function() {
-    iframe.src = "file_webaudioLoop.html";
-  },
-
-  function() {
     observerService.addObserver(observer, "audio-playback", false);
     ok(true, "Observer set");
     runTest();
   },
 
   function() {
-    expectedNotification = 'inactive';
-    iframe.contentWindow.suspendAC();
-  },
-
-  function() {
-    expectedNotification = 'active';
-    iframe.contentWindow.resumeAC();
-  },
-
-  function() {
-    expectedNotification = 'inactive';
-    iframe.contentWindow.closeAC();
+    ac = new AudioContext();
+    setTimeout(runTest, 100);
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
 ];
@@ -71,14 +53,14 @@ function runTest() {
     SimpleTest.finish();
     return;
   }
 
   var test = tests.shift();
   test();
 }
 
-onload = runTest;
+runTest();
 
 </script>
 </body>
 </html>
 
--- a/dom/base/test/test_webaudioNotification.html
+++ b/dom/base/test/test_webaudioNotification.html
@@ -30,23 +30,24 @@ var observerService = SpecialPowers.Cc["
 
 var tests = [
   function() {
     iframe = document.querySelector("iframe");
     SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
   },
 
   function() {
-    iframe.src = "file_webaudioLoop.html";
+    observerService.addObserver(observer, "audio-playback", false);
+    ok(true, "Observer set");
+    runTest();
   },
 
   function() {
-    observerService.addObserver(observer, "audio-playback", false);
-    ok(true, "Observer set");
-    runTest();
+    iframe.src = "file_webaudioLoop.html";
+    expectedNotification = 'active';
   },
 
   function() {
     expectedNotification = 'inactive';
     iframe.contentWindow.suspendAC();
   },
 
   function() {