Bug 1240423 - part8 : modify tests r=baku
authorAlastor Wu <alwu@mozilla.com>
Wed, 01 Jun 2016 10:26:34 +0800
changeset 340940 07bc3e5d3815bc23374ec864db07cbc3b719bd86
parent 340939 e40fc1609c5e677dc2d98391c41a69aed63e6942
child 340941 4b6bc4d7371eaf46c7102e59f2985005af8be3c1
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1240423
milestone49.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 1240423 - part8 : modify tests r=baku MozReview-Commit-ID: 7NlzmcZAlrd
browser/base/content/test/general/browser_audioTabIcon.js
dom/base/test/test_audioNotification.html
dom/base/test/test_audioNotificationSilent_audioFile.html
dom/base/test/test_audioNotificationSilent_webAudio.html
dom/base/test/test_audioNotificationStopOnNavigation.html
dom/base/test/test_audioNotificationStream.html
dom/base/test/test_audioNotificationWithEarlyPlay.html
dom/base/test/test_noAudioNotificationOnMutedElement.html
dom/base/test/test_noAudioNotificationOnMutedOrVolume0Element.html
dom/base/test/test_noAudioNotificationOnVolume0Element.html
dom/base/test/test_pluginAudioNotification.html
dom/base/test/test_webaudioNotification.html
dom/base/test/test_webaudioNotificationStopOnNavigation.html
dom/browser-element/mochitest/browserElement_ActiveStateChange.js
dom/browser-element/mochitest/browserElement_ActiveStateChangeOnChangingMutedOrVolume.js
dom/browser-element/mochitest/browserElement_AudioPlayback.js
dom/browser-element/mochitest/file_browserElement_ActiveStateChange.html
dom/browser-element/mochitest/file_browserElement_ActiveStateChangeOnChangingMutedOrVolume.html
dom/browser-element/mochitest/mochitest-oop.ini
dom/browser-element/mochitest/mochitest.ini
dom/browser-element/mochitest/test_browserElement_inproc_ActiveStateChange.html
dom/browser-element/mochitest/test_browserElement_inproc_ActiveStateChangeOnChangingMutedOrVolume.html
dom/browser-element/mochitest/test_browserElement_oop_ActiveStateChange.html
dom/browser-element/mochitest/test_browserElement_oop_ActiveStateChangeOnChangingMutedOrVolume.html
toolkit/content/tests/browser/browser_mediaPlayback_mute.js
--- a/browser/base/content/test/general/browser_audioTabIcon.js
+++ b/browser/base/content/test/general/browser_audioTabIcon.js
@@ -1,19 +1,24 @@
 const PAGE = "https://example.com/browser/browser/base/content/test/general/file_mediaPlayback.html";
 
 function* wait_for_tab_playing_event(tab, expectPlaying) {
-  yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => {
-    if (event.detail.changed.indexOf("soundplaying") >= 0) {
-      is(tab.hasAttribute("soundplaying"), expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
-      is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
-      return true;
-    }
-    return false;
-  });
+  if (tab.soundPlaying == expectPlaying) {
+    ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
+    return true;
+  } else {
+    yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => {
+      if (event.detail.changed.indexOf("soundplaying") >= 0) {
+        is(tab.hasAttribute("soundplaying"), expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
+        is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
+        return true;
+      }
+      return false;
+    });
+  }
 }
 
 function* play(tab) {
   let browser = tab.linkedBrowser;
   yield ContentTask.spawn(browser, {}, function* () {
     let audio = content.document.querySelector("audio");
     audio.play();
   });
--- a/dom/base/test/test_audioNotification.html
+++ b/dom/base/test/test_audioNotification.html
@@ -37,17 +37,17 @@ var tests = [
   },
 
   function() {
     expectedNotification = 'active';
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     audio.pause();
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
--- a/dom/base/test/test_audioNotificationSilent_audioFile.html
+++ b/dom/base/test/test_audioNotificationSilent_audioFile.html
@@ -46,17 +46,17 @@ function audioPlayingStart() {
 
   info("Audio playing start");
   audio.play();
 }
 
 function audioBecomeSilentDuringPlaying() {
   info("Audio would become silent during playing");
 
-  expectedPlaybackActive = 'inactive';
+  expectedPlaybackActive = 'inactive-nonaudible';
   expectedPlaying = true;
 }
 
 function finish() {
   observerService.removeObserver(observer, "audio-playback");
   ok(true, "Observer removed");
 
   SimpleTest.finish();
--- a/dom/base/test/test_audioNotificationSilent_webAudio.html
+++ b/dom/base/test/test_audioNotificationSilent_webAudio.html
@@ -54,17 +54,17 @@ function audioPlayingStart() {
 
   info("Audio playing start");
   playOscillatorNode();
 }
 
 function audioBecomeSilentDuringPlaying() {
   info("Audio would become silent during playing");
 
-  expectedPlaybackActive = 'inactive';
+  expectedPlaybackActive = 'inactive-pause';
   expectedPlaying = "running";
 }
 
 function finish() {
   observerService.removeObserver(observer, "audio-playback");
   ok(true, "Observer removed");
 
   SimpleTest.finish();
--- a/dom/base/test/test_audioNotificationStopOnNavigation.html
+++ b/dom/base/test/test_audioNotificationStopOnNavigation.html
@@ -37,17 +37,17 @@ var tests = [
   },
 
   function() {
     expectedNotification = 'active';
     iframe.src = "file_audioLoop.html";
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     iframe.src = "data:text/html,page without audio";
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
--- a/dom/base/test/test_audioNotificationStream.html
+++ b/dom/base/test/test_audioNotificationStream.html
@@ -37,17 +37,17 @@ var tests = [
   },
 
   function() {
     expectedNotification = 'active';
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     audio.pause();
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
--- a/dom/base/test/test_audioNotificationWithEarlyPlay.html
+++ b/dom/base/test/test_audioNotificationWithEarlyPlay.html
@@ -39,17 +39,17 @@ var tests = [
 
   function() {
     expectedNotification = 'active';
     audio.src = "audio.ogg";
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     audio.pause();
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
--- a/dom/base/test/test_noAudioNotificationOnMutedElement.html
+++ b/dom/base/test/test_noAudioNotificationOnMutedElement.html
@@ -45,38 +45,38 @@ var tests = [
 
   // Verify that muting and unmuting dispatches the events as expected.
   function() {
     expectedNotification = 'active';
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-nonaudible';
     audio.muted = true;
   },
 
   function() {
     expectedNotification = 'active';
     audio.muted = false;
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     audio.pause();
   },
 
   // Verify that no events are dispatched when muted.
   function() {
     expectedNotification = 'active';
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-nonaudible';
     audio.muted = true;
   },
 
   function() {
     expectedNotification = null;
     audio.onpause  = function() {
       // Yield to the event loop a few times to make sure that audio-playback is not dispatched.
       SimpleTest.executeSoon(function() {
--- a/dom/base/test/test_noAudioNotificationOnMutedOrVolume0Element.html
+++ b/dom/base/test/test_noAudioNotificationOnMutedOrVolume0Element.html
@@ -45,17 +45,17 @@ var tests = [
 
   // Verify that unmuting when the volume is 0 doesn't dispatch the events.
   function() {
     expectedNotification = 'active';
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-nonaudible';
     audio.muted = true;
   },
 
   function() {
     expectedNotification = null;
     audio.volume = 0;
     // Yield to the event loop a few times to make sure that audio-playback is not dispatched.
     SimpleTest.executeSoon(function() {
@@ -81,28 +81,28 @@ var tests = [
   },
 
   function() {
     expectedNotification = 'active';
     audio.volume = 0.5;
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     audio.pause();
   },
 
   // Verify that raising the volume when muted doesn't dispatch the events.
   function() {
     expectedNotification = 'active';
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-nonaudible';
     audio.muted = true;
   },
 
   function() {
     expectedNotification = null;
     audio.volume = 0;
     // Yield to the event loop a few times to make sure that audio-playback is not dispatched.
     SimpleTest.executeSoon(function() {
@@ -128,17 +128,17 @@ var tests = [
   },
 
   function() {
     expectedNotification = 'active';
     audio.muted = false;
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     audio.pause();
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
--- a/dom/base/test/test_noAudioNotificationOnVolume0Element.html
+++ b/dom/base/test/test_noAudioNotificationOnVolume0Element.html
@@ -45,38 +45,38 @@ var tests = [
 
   // Verify that muting and unmuting dispatches the events as expected.
   function() {
     expectedNotification = 'active';
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-nonaudible';
     audio.volume = 0;
   },
 
   function() {
     expectedNotification = 'active';
     audio.volume = 1;
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     audio.pause();
   },
 
   // Verify that no events are dispatched when volume is set to 0..
   function() {
     expectedNotification = 'active';
     audio.play();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-nonaudible';
     audio.volume = 0;
   },
 
   function() {
     expectedNotification = null;
     audio.onpause  = function() {
       // Yield to the event loop a few times to make sure that audio-playback is not dispatched.
       SimpleTest.executeSoon(function() {
--- a/dom/base/test/test_pluginAudioNotification.html
+++ b/dom/base/test/test_pluginAudioNotification.html
@@ -79,17 +79,17 @@ var tests = [
     iframe.contentWindow.toggleMuteState(true);
     ok(iframe.contentWindow.pluginMuted(), "Plugin should be muted");
     iframe.contentWindow.toggleMuteState(false);
     ok(!iframe.contentWindow.pluginMuted(), "Plugin should not be muted");
     runTest();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     iframe.contentWindow.stopAudio();
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
--- a/dom/base/test/test_webaudioNotification.html
+++ b/dom/base/test/test_webaudioNotification.html
@@ -37,27 +37,27 @@ var tests = [
   },
 
   function() {
     iframe.src = "file_webaudioLoop.html";
     expectedNotification = 'active';
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     iframe.contentWindow.suspendAC();
   },
 
   function() {
     expectedNotification = 'active';
     iframe.contentWindow.resumeAC();
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     iframe.contentWindow.closeAC();
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
--- a/dom/base/test/test_webaudioNotificationStopOnNavigation.html
+++ b/dom/base/test/test_webaudioNotificationStopOnNavigation.html
@@ -37,17 +37,17 @@ var tests = [
   },
 
   function() {
     expectedNotification = 'active';
     iframe.src = "file_webaudioLoop2.html";
   },
 
   function() {
-    expectedNotification = 'inactive';
+    expectedNotification = 'inactive-pause';
     iframe.src = "data:text/html,page without audio";
   },
 
   function() {
     observerService.removeObserver(observer, "audio-playback");
     ok(true, "Observer removed");
     runTest();
   }
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_ActiveStateChange.js
@@ -0,0 +1,110 @@
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+browserElementTestHelpers.setEnabledPref(true);
+browserElementTestHelpers.addPermission();
+
+var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_ActiveStateChange.html';
+var generator = runTests();
+var testFrame;
+var ac;
+
+function assert(aVal, aMessage) {
+  return (!aVal) ? error(aMessage) : 0;
+}
+
+function error(aMessage) {
+  ok(false, "Error : " + aMessage);
+  finish();
+}
+
+function continueTest() {
+  try {
+    generator.next();
+  } catch (e if e instanceof StopIteration) {
+    error("Stop test because of exception!");
+  }
+}
+
+function finish() {
+  document.body.removeChild(testFrame);
+  SimpleTest.finish();
+}
+
+function setCommand(aArg) {
+  assert(!!ac, "Audio channel doesn't exist!");
+  info("# Command = " + aArg);
+
+  testFrame.src = fileURL + '#' + aArg;
+  var expectedActive = false;
+  switch (aArg) {
+    case 'play':
+      expectedActive = true;
+      break;
+    case 'pause':
+      expectedActive = false;
+      break;
+    default :
+      error("Undefined command!");
+  }
+
+  ac.onactivestatechanged = () => {
+    ac.onactivestatechanged = null;
+    ac.isActive().onsuccess = (e) => {
+      is(expectedActive, e.target.result,
+         "Correct active state = " + expectedActive);
+      continueTest();
+    }
+  };
+}
+
+function runTests() {
+  setCommand('play');
+  yield undefined;
+
+  setCommand('pause');
+  yield undefined;
+
+  finish();
+  yield undefined;
+}
+
+function setupTestFrame() {
+  testFrame = document.createElement('iframe');
+  testFrame.setAttribute('mozbrowser', 'true');
+  testFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
+  testFrame.src = fileURL;
+
+  function loadend() {
+    testFrame.removeEventListener('mozbrowserloadend', loadend);
+    ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
+    var channels = testFrame.allowedAudioChannels;
+    is(channels.length, 1, "1 audio channel by default");
+
+    ac = channels[0];
+
+    ok(ac instanceof BrowserElementAudioChannel, "Correct class");
+    ok("isActive" in ac, "isActive exists");
+    ok("onactivestatechanged" in ac, "onactivestatechanged exists");
+
+    generator.next();
+  }
+
+  function alertError(e) {
+    testFrame.removeEventListener('mozbrowsershowmodalprompt', alertError);
+    var message = e.detail.message
+    error(message);
+  }
+
+  testFrame.addEventListener('mozbrowserloadend', loadend);
+  testFrame.addEventListener('mozbrowsershowmodalprompt', alertError);
+  document.body.appendChild(testFrame);
+}
+
+addEventListener('testready', function() {
+  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
+                            function() {
+    SimpleTest.executeSoon(setupTestFrame);
+  });
+});
+
deleted file mode 100644
--- a/dom/browser-element/mochitest/browserElement_ActiveStateChangeOnChangingMutedOrVolume.js
+++ /dev/null
@@ -1,126 +0,0 @@
-"use strict";
-
-SimpleTest.waitForExplicitFinish();
-browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.addPermission();
-
-var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_ActiveStateChangeOnChangingMutedOrVolume.html';
-var generator = runTests();
-var testFrame;
-var ac;
-
-function assert(aVal, aMessage) {
-  return (!aVal) ? error(aMessage) : 0;
-}
-
-function error(aMessage) {
-  ok(false, "Error : " + aMessage);
-  finish();
-}
-
-function continueTest() {
-  try {
-    generator.next();
-  } catch (e if e instanceof StopIteration) {
-    error("Stop test because of exception!");
-  }
-}
-
-function finish() {
-  document.body.removeChild(testFrame);
-  SimpleTest.finish();
-}
-
-function setCommand(aArg) {
-  assert(!!ac, "Audio channel doesn't exist!");
-  info("# Command = " + aArg);
-
-  testFrame.src = fileURL + '#' + aArg;
-  var expectedActive = false;
-  switch (aArg) {
-    case 'play':
-    case 'unmute':
-    case 'volume-1':
-      expectedActive = true;
-      break;
-    case 'pause':
-    case 'mute':
-    case 'volume-0':
-      expectedActive = false;
-      break;
-    default :
-      error("Undefined command!");
-  }
-
-  ac.onactivestatechanged = () => {
-    ac.onactivestatechanged = null;
-    ac.isActive().onsuccess = (e) => {
-      is(expectedActive, e.target.result,
-         "Correct active state = " + expectedActive);
-      continueTest();
-    }
-  };
-}
-
-function runTests() {
-  setCommand('play');
-  yield undefined;
-
-  setCommand('mute');
-  yield undefined;
-
-  setCommand('unmute');
-  yield undefined;
-
-  setCommand('volume-0');
-  yield undefined;
-
-  setCommand('volume-1');
-  yield undefined;
-
-  setCommand('pause');
-  yield undefined;
-
-  finish();
-  yield undefined;
-}
-
-function setupTestFrame() {
-  testFrame = document.createElement('iframe');
-  testFrame.setAttribute('mozbrowser', 'true');
-  testFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
-  testFrame.src = fileURL;
-
-  function loadend() {
-    testFrame.removeEventListener('mozbrowserloadend', loadend);
-    ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
-    var channels = testFrame.allowedAudioChannels;
-    is(channels.length, 1, "1 audio channel by default");
-
-    ac = channels[0];
-
-    ok(ac instanceof BrowserElementAudioChannel, "Correct class");
-    ok("isActive" in ac, "isActive exists");
-    ok("onactivestatechanged" in ac, "onactivestatechanged exists");
-
-    generator.next();
-  }
-
-  function alertError(e) {
-    testFrame.removeEventListener('mozbrowsershowmodalprompt', alertError);
-    var message = e.detail.message
-    error(message);
-  }
-
-  testFrame.addEventListener('mozbrowserloadend', loadend);
-  testFrame.addEventListener('mozbrowsershowmodalprompt', alertError);
-  document.body.appendChild(testFrame);
-}
-
-addEventListener('testready', function() {
-  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
-                            function() {
-    SimpleTest.executeSoon(setupTestFrame);
-  });
-});
-
--- a/dom/browser-element/mochitest/browserElement_AudioPlayback.js
+++ b/dom/browser-element/mochitest/browserElement_AudioPlayback.js
@@ -42,25 +42,25 @@ function runTest() {
   // an audio element and play it.
   iframe.addEventListener('mozbrowserloadend', () => {
     let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
     mm.loadFrameScript('data:,(' + playAudioScript.toString() + ')();', false);
   });
 
   // Two events should come in, when the audio starts, and stops playing.
   // The first one should have a detail of 'active' and the second one
-  // should have a detail of 'inactive'.
+  // should have a detail of 'inactive-pause'.
   let expectedNextData = 'active';
   iframe.addEventListener('mozbrowseraudioplaybackchange', (e) => {
     is(e.detail, expectedNextData, 'Audio detail should be correct')
     is(e.target, iframe, 'event target should be the first iframe')
-    if (e.detail === 'inactive') {
+    if (e.detail === 'inactive-pause') {
       SimpleTest.finish();
     }
-    expectedNextData = 'inactive';
+    expectedNextData = 'inactive-pause';
   });
 
   // Make sure an event only goes to the first iframe.
   iframe2.addEventListener('mozbrowseraudioplaybackchange', (e) => {
     ok(false,
        'mozbrowseraudioplaybackchange should dispatch to the correct browser');
   });
 
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/file_browserElement_ActiveStateChange.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script type="application/javascript;version=1.7">
+var audio = new Audio();
+audio.src = "audio.ogg";
+audio.loop = true;
+
+function runCommands()
+{
+  switch(location.hash) {
+    case '#play':
+      audio.play();
+      break;
+    case '#pause':
+      audio.pause();
+      break;
+    default :
+      alert("Undefined command!");
+  }
+}
+window.addEventListener('hashchange', runCommands);
+</script>
+</body>
+</html>
\ No newline at end of file
deleted file mode 100644
--- a/dom/browser-element/mochitest/file_browserElement_ActiveStateChangeOnChangingMutedOrVolume.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<body>
-<script type="application/javascript;version=1.7">
-var audio = new Audio();
-audio.src = "audio.ogg";
-audio.loop = true;
-
-function runCommands()
-{
-  switch(location.hash) {
-    case '#play':
-      audio.play();
-      break;
-    case '#mute':
-      audio.muted = true;
-      break;
-    case '#unmute':
-      audio.muted = false;
-      break;
-    case '#volume-0':
-      audio.volume = 0.0;
-      break;
-    case '#volume-1':
-      audio.volume = 1.0;
-      break;
-    case '#pause':
-      audio.pause();
-      break;
-    default :
-      alert("Undefined command!");
-  }
-}
-window.addEventListener('hashchange', runCommands);
-</script>
-</body>
-</html>
\ No newline at end of file
--- a/dom/browser-element/mochitest/mochitest-oop.ini
+++ b/dom/browser-element/mochitest/mochitest-oop.ini
@@ -125,10 +125,10 @@ disabled = bug 924771
 [test_browserElement_oop_AudioChannel.html]
 tags = audiochannel
 [test_browserElement_oop_AudioChannel_nested.html]
 tags = audiochannel
 [test_browserElement_oop_SetNFCFocus.html]
 [test_browserElement_oop_getWebManifest.html]
 [test_browserElement_oop_OpenWindowEmpty.html]
 skip-if = (toolkit == 'gonk') # Test doesn't work on B2G emulator
-[test_browserElement_oop_ActiveStateChangeOnChangingMutedOrVolume.html]
+[test_browserElement_oop_ActiveStateChange.html]
 tags = audiochannel
\ No newline at end of file
--- a/dom/browser-element/mochitest/mochitest.ini
+++ b/dom/browser-element/mochitest/mochitest.ini
@@ -1,16 +1,16 @@
 [DEFAULT]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || e10s
 support-files =
   audio.ogg
   ../../../dom/media/test/short-video.ogv
   async.js
   browserElementTestHelpers.js
-  browserElement_ActiveStateChangeOnChangingMutedOrVolume.js
+  browserElement_ActiveStateChange.js
   browserElement_Alert.js
   browserElement_AlertInFrame.js
   browserElement_AllowEmbedAppsInNestedOOIframe.js
   browserElement_AppFramePermission.js
   browserElement_AppWindowNamespace.js
   browserElement_AudioChannelSeeking.js
   browserElement_AudioChannelMutedByDefault.js
   browserElement_AudioPlayback.js
@@ -80,17 +80,17 @@ support-files =
   browserElement_VisibilityChange.js
   browserElement_XFrameOptions.js
   browserElement_XFrameOptionsAllowFrom.js
   browserElement_XFrameOptionsDeny.js
   browserElement_XFrameOptionsSameOrigin.js
   browserElement_GetContentDimensions.js
   browserElement_AudioChannel.js
   browserElement_AudioChannel_nested.js
-  file_browserElement_ActiveStateChangeOnChangingMutedOrVolume.html
+  file_browserElement_ActiveStateChange.html
   file_browserElement_AlertInFrame.html
   file_browserElement_AlertInFrame_Inner.html
   file_browserElement_AllowEmbedAppsInNestedOOIframe.html
   file_browserElement_AppFramePermission.html
   file_browserElement_AppWindowNamespace.html
   file_browserElement_AudioChannelSeeking.html
   file_browserElement_AudioChannel_nested.html
   file_browserElement_AudioChannelMutedByDefault.html
@@ -262,10 +262,10 @@ disabled = bug 774100
 [test_browserElement_inproc_GetContentDimensions.html]
 [test_browserElement_inproc_AudioChannel.html]
 tags = audiochannel
 [test_browserElement_inproc_AudioChannel_nested.html]
 tags = audiochannel
 [test_browserElement_inproc_SetNFCFocus.html]
 [test_browserElement_inproc_OpenWindowEmpty.html]
 skip-if = (toolkit == 'gonk') # Test doesn't work on B2G emulator
-[test_browserElement_inproc_ActiveStateChangeOnChangingMutedOrVolume.html]
+[test_browserElement_inproc_ActiveStateChange.html]
 tags = audiochannel
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_ActiveStateChange.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test ActiveStateChangeOnChangingMutedOrVolume</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_ActiveStateChange.js">
+</script>
+</body>
+</html>
deleted file mode 100644
--- a/dom/browser-element/mochitest/test_browserElement_inproc_ActiveStateChangeOnChangingMutedOrVolume.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test ActiveStateChangeOnChangingMutedOrVolume</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<script type="application/javascript;version=1.7" src="browserElement_ActiveStateChangeOnChangingMutedOrVolume.js">
-</script>
-</body>
-</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_oop_ActiveStateChange.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test ActiveStateChangeOnChangingMutedOrVolume</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_ActiveStateChange.js">
+</script>
+</body>
+</html>
deleted file mode 100644
--- a/dom/browser-element/mochitest/test_browserElement_oop_ActiveStateChangeOnChangingMutedOrVolume.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test ActiveStateChangeOnChangingMutedOrVolume</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<script type="application/javascript;version=1.7" src="browserElement_ActiveStateChangeOnChangingMutedOrVolume.js">
-</script>
-</body>
-</html>
--- a/toolkit/content/tests/browser/browser_mediaPlayback_mute.js
+++ b/toolkit/content/tests/browser/browser_mediaPlayback_mute.js
@@ -53,25 +53,25 @@ function* test_on_browser(url, browser) 
 function* test_visibility(url, browser) {
   browser.loadURI(url);
   yield wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   var result = yield ContentTask.spawn(browser, null, test_audio_in_browser);
   is(result.computedVolume, 1, "Audio volume is 1");
   is(result.computedMuted, false, "Audio is not muted");
 
-  ok(!browser.audioMuted, "Audio should not be muted by default");
-  browser.mute();
-  ok(browser.audioMuted, "Audio should be muted now");
-
   yield BrowserTestUtils.withNewTab({
     gBrowser,
     url: "about:blank",
   }, function() {});
 
+  ok(!browser.audioMuted, "Audio should not be muted by default");
+  browser.mute();
+  ok(browser.audioMuted, "Audio should be muted now");
+
   yield wait_for_event(browser, "DOMAudioPlaybackStopped");
 
   result = yield ContentTask.spawn(browser, null, test_audio_in_browser);
   is(result.computedVolume, 0, "Audio volume is 0 when muted");
   is(result.computedMuted, true, "Audio is muted");
 }
 
 add_task(function*() {