Bug 1578615 - part6 : modify tests. r=chunmin
authoralwu <alwu@mozilla.com>
Thu, 26 Sep 2019 02:53:52 +0000
changeset 495065 2c7f0d54cda8988325680a271fe8fbfb70a3a681
parent 495064 34b256af59d62cfef82cd88296a7dde9da326a8f
child 495066 263512ebd456125cdab2dab1a90bdaba65ee0137
push id96405
push useralwu@mozilla.com
push dateThu, 26 Sep 2019 06:03:48 +0000
treeherderautoland@aeec93cc3005 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschunmin
bugs1578615
milestone71.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 1578615 - part6 : modify tests. r=chunmin We could simply check `TabBlockEvent` to know whether we starts delaying media playback or not. We don't need to check media element's `computedSuspended`. Because `computedSuspended` is something, which was designed to get the internal suspended state of `AudioChannelWrapper`, in our case, as the delaying autoplay is not related to `AudioChannelWrapper` anymore, so the state we got actually couldn't reflect anything. Differential Revision: https://phabricator.services.mozilla.com/D44920
toolkit/content/tests/browser/browser_block_autoplay_media.js
toolkit/content/tests/browser/browser_block_autoplay_media_pausedAfterPlay.js
toolkit/content/tests/browser/browser_block_autoplay_playAfterTabVisible.js
toolkit/content/tests/browser/browser_block_multipleMedia.js
toolkit/content/tests/browser/browser_block_notInTreeAudio.js
toolkit/content/tests/browser/browser_block_playMediaInMuteTab.js
toolkit/content/tests/browser/browser_block_silentAudioTrack_media.js
--- a/toolkit/content/tests/browser/browser_block_autoplay_media.js
+++ b/toolkit/content/tests/browser/browser_block_autoplay_media.js
@@ -1,32 +1,11 @@
 const PAGE =
   "https://example.com/browser/toolkit/content/tests/browser/file_multipleAudio.html";
 
-var SuspendedType = {
-  NONE_SUSPENDED: 0,
-  SUSPENDED_PAUSE: 1,
-  SUSPENDED_BLOCK: 2,
-  SUSPENDED_PAUSE_DISPOSABLE: 3,
-};
-
-function check_audio_suspended(browser, suspendedType) {
-  return ContentTask.spawn(browser, suspendedType, suspendedType => {
-    var autoPlay = content.document.getElementById("autoplay");
-    if (!autoPlay) {
-      ok(false, "Can't get the audio element!");
-    }
-    is(
-      autoPlay.computedSuspended,
-      suspendedType,
-      "The suspeded state of autoplay audio is correct."
-    );
-  });
-}
-
 function check_audio_paused(browser, shouldBePaused) {
   return ContentTask.spawn(browser, shouldBePaused, shouldBePaused => {
     var autoPlay = content.document.getElementById("autoplay");
     if (!autoPlay) {
       ok(false, "Can't get the audio element!");
     }
     is(
       autoPlay.paused,
@@ -47,54 +26,43 @@ add_task(async function setup_test_prefe
 
 add_task(async function block_autoplay_media() {
   info("- open new background tab1 -");
   let tab1 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab1.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab1.linkedBrowser, false, PAGE);
 
   info("- should block autoplay media for non-visited tab1 -");
-  await check_audio_suspended(
-    tab1.linkedBrowser,
-    SuspendedType.SUSPENDED_BLOCK
-  );
+  await waitForTabBlockEvent(tab1, true);
 
   info("- open new background tab2 -");
   let tab2 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab2.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab2.linkedBrowser, false, PAGE);
 
   info("- should block autoplay for non-visited tab2 -");
-  await check_audio_suspended(
-    tab2.linkedBrowser,
-    SuspendedType.SUSPENDED_BLOCK
-  );
+  await waitForTabBlockEvent(tab2, true);
 
   info("- select tab1 as foreground tab -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab1);
 
   info("- media should be unblocked because the tab was visited -");
   await waitForTabPlayingEvent(tab1, true);
-  await check_audio_suspended(tab1.linkedBrowser, SuspendedType.NONE_SUSPENDED);
 
   info("- open another new foreground tab3 -");
   let tab3 = await BrowserTestUtils.openNewForegroundTab(
     window.gBrowser,
     "about:blank"
   );
   info("- should still play media from tab1 -");
   await waitForTabPlayingEvent(tab1, true);
-  await check_audio_suspended(tab1.linkedBrowser, SuspendedType.NONE_SUSPENDED);
 
   info("- should still block media from tab2 -");
   await waitForTabPlayingEvent(tab2, false);
-  await check_audio_suspended(
-    tab2.linkedBrowser,
-    SuspendedType.SUSPENDED_BLOCK
-  );
+  await waitForTabBlockEvent(tab2, true);
 
   // Test 4: Disable autoplay and verify that when a tab is opened in the
   // background and has had its playback start delayed, resuming via the audio
   // tab indicator overrides the autoplay blocking logic.
   //
   // Clicking "play" on the audio tab indicator should always start playback
   // in that tab, even if it's in an autoplay-blocked origin.
   //
@@ -109,20 +77,17 @@ add_task(async function block_autoplay_m
   });
 
   info("- open new background tab4 -");
   let tab4 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab4.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab4.linkedBrowser, false, PAGE);
 
   info("- should block autoplay for non-visited tab4 -");
-  await check_audio_suspended(
-    tab4.linkedBrowser,
-    SuspendedType.SUSPENDED_BLOCK
-  );
+  await waitForTabBlockEvent(tab4, true);
   await check_audio_paused(tab4.linkedBrowser, true);
   tab4.linkedBrowser.resumeMedia();
   info("- should not block media from tab4 -");
   await waitForTabPlayingEvent(tab4, true);
   await check_audio_paused(tab4.linkedBrowser, false);
 
   info(
     "- check that loading a new URI in page clears gesture activation status -"
--- a/toolkit/content/tests/browser/browser_block_autoplay_media_pausedAfterPlay.js
+++ b/toolkit/content/tests/browser/browser_block_autoplay_media_pausedAfterPlay.js
@@ -1,33 +1,13 @@
 const PAGE_SHOULD_PLAY =
   "https://example.com/browser/toolkit/content/tests/browser/file_blockMedia_shouldPlay.html";
 const PAGE_SHOULD_NOT_PLAY =
   "https://example.com/browser/toolkit/content/tests/browser/file_blockMedia_shouldNotPlay.html";
 
-var SuspendedType = {
-  NONE_SUSPENDED: 0,
-  SUSPENDED_PAUSE: 1,
-  SUSPENDED_BLOCK: 2,
-  SUSPENDED_PAUSE_DISPOSABLE: 3,
-};
-
-function check_audio_suspended(suspendedType) {
-  var audio = content.document.getElementById("testAudio");
-  if (!audio) {
-    ok(false, "Can't get the audio element!");
-  }
-
-  is(
-    audio.computedSuspended,
-    suspendedType,
-    "The suspeded state of audio is correct."
-  );
-}
-
 function check_audio_pause_state(expectPause) {
   var audio = content.document.getElementById("testAudio");
   if (!audio) {
     ok(false, "Can't get the audio element!");
   }
 
   is(audio.paused, expectPause, "The pause state of audio is corret.");
 }
@@ -37,60 +17,39 @@ add_task(async function setup_test_prefe
     set: [
       ["media.useAudioChannelService.testing", true],
       ["media.block-autoplay-until-in-foreground", true],
     ],
   });
 });
 
 add_task(async function block_autoplay_media() {
-  info("- open new background tab1, and check tab1's media suspend type -");
+  info("- open new background tab1, and tab1 should not be blocked -");
   let tab1 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab1.linkedBrowser, PAGE_SHOULD_NOT_PLAY);
   await BrowserTestUtils.browserLoaded(tab1.linkedBrowser);
-  await ContentTask.spawn(
-    tab1.linkedBrowser,
-    SuspendedType.NONE_SUSPENDED,
-    check_audio_suspended
-  );
-
-  info("- the tab1 should not be blocked -");
   await waitForTabBlockEvent(tab1, false);
 
-  info("- open new background tab2, and check tab2's media suspend type -");
+  info("- open new background tab2, and tab2 should be blocked -");
   let tab2 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab2.linkedBrowser, PAGE_SHOULD_PLAY);
   await BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
-  await ContentTask.spawn(
-    tab2.linkedBrowser,
-    SuspendedType.SUSPENDED_BLOCK,
-    check_audio_suspended
-  );
-
-  info("- the tab2 should be blocked -");
   await waitForTabBlockEvent(tab2, true);
 
-  info("- select tab1 as foreground tab, and tab1's media should be paused -");
+  info("- select tab1 as foreground tab  -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab1);
+
+  info("- tab1 should not be blocked, and media should not started -");
+  await waitForTabBlockEvent(tab1, false);
   await ContentTask.spawn(tab1.linkedBrowser, true, check_audio_pause_state);
 
-  info("- the tab1 should not be blocked -");
-  await waitForTabBlockEvent(tab1, false);
+  info("- select tab2 as foreground tab -");
+  await BrowserTestUtils.switchTab(window.gBrowser, tab2);
 
-  info("- select tab2 as foreground tab, and the tab2 should not be blocked -");
-  await BrowserTestUtils.switchTab(window.gBrowser, tab2);
+  info("- tab2 should not be blocked and media should be playing -");
   await waitForTabBlockEvent(tab2, false);
-
-  info("- tab2's media should be playing -");
   await waitForTabPlayingEvent(tab2, true);
   await ContentTask.spawn(tab2.linkedBrowser, false, check_audio_pause_state);
 
-  info("- check tab2's media suspend type -");
-  await ContentTask.spawn(
-    tab2.linkedBrowser,
-    SuspendedType.NONE_SUSPENDED,
-    check_audio_suspended
-  );
-
   info("- remove tabs -");
   BrowserTestUtils.removeTab(tab1);
   BrowserTestUtils.removeTab(tab2);
 });
--- a/toolkit/content/tests/browser/browser_block_autoplay_playAfterTabVisible.js
+++ b/toolkit/content/tests/browser/browser_block_autoplay_playAfterTabVisible.js
@@ -1,31 +1,11 @@
 const PAGE =
   "https://example.com/browser/toolkit/content/tests/browser/file_nonAutoplayAudio.html";
 
-var SuspendedType = {
-  NONE_SUSPENDED: 0,
-  SUSPENDED_PAUSE: 1,
-  SUSPENDED_BLOCK: 2,
-  SUSPENDED_PAUSE_DISPOSABLE: 3,
-};
-
-function check_audio_suspended(suspendedType) {
-  var audio = content.document.getElementById("testAudio");
-  if (!audio) {
-    ok(false, "Can't get the audio element!");
-  }
-
-  is(
-    audio.computedSuspended,
-    suspendedType,
-    "The suspeded state of audio is correct."
-  );
-}
-
 function check_audio_pause_state(expectPause) {
   var audio = content.document.getElementById("testAudio");
   if (!audio) {
     ok(false, "Can't get the audio element!");
   }
 
   is(audio.paused, expectPause, "The pause state of audio is corret.");
 }
@@ -72,18 +52,14 @@ add_task(async function media_should_be_
   );
   await BrowserTestUtils.switchTab(window.gBrowser, tab);
   await ContentTask.spawn(tab.linkedBrowser, true, check_audio_pause_state);
 
   info("- start audio in tab -");
   await ContentTask.spawn(tab.linkedBrowser, null, play_audio);
 
   info("- audio should be playing -");
+  await waitForTabBlockEvent(tab, false);
   await ContentTask.spawn(tab.linkedBrowser, false, check_audio_pause_state);
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    SuspendedType.NONE_SUSPENDED,
-    check_audio_suspended
-  );
 
   info("- remove tab -");
   BrowserTestUtils.removeTab(tab);
 });
--- a/toolkit/content/tests/browser/browser_block_multipleMedia.js
+++ b/toolkit/content/tests/browser/browser_block_multipleMedia.js
@@ -1,51 +1,12 @@
 /* eslint-disable mozilla/no-arbitrary-setTimeout */
 const PAGE =
   "https://example.com/browser/toolkit/content/tests/browser/file_multipleAudio.html";
 
-var SuspendedType = {
-  NONE_SUSPENDED: 0,
-  SUSPENDED_PAUSE: 1,
-  SUSPENDED_BLOCK: 2,
-  SUSPENDED_PAUSE_DISPOSABLE: 3,
-};
-
-function check_all_audio_suspended(suspendedType) {
-  let autoPlay = content.document.getElementById("autoplay");
-  let nonAutoPlay = content.document.getElementById("nonautoplay");
-  if (!autoPlay || !nonAutoPlay) {
-    ok(false, "Can't get the audio element!");
-  }
-
-  is(
-    autoPlay.computedSuspended,
-    suspendedType,
-    "The suspeded state of autoplay audio is correct."
-  );
-  is(
-    nonAutoPlay.computedSuspended,
-    suspendedType,
-    "The suspeded state of non-autoplay audio is correct."
-  );
-}
-
-function check_autoplay_audio_suspended(suspendedType) {
-  let autoPlay = content.document.getElementById("autoplay");
-  if (!autoPlay) {
-    ok(false, "Can't get the audio element!");
-  }
-
-  is(
-    autoPlay.computedSuspended,
-    suspendedType,
-    "The suspeded state of autoplay audio is correct."
-  );
-}
-
 function check_autoplay_audio_onplay() {
   let autoPlay = content.document.getElementById("autoplay");
   if (!autoPlay) {
     ok(false, "Can't get the audio element!");
   }
 
   return new Promise((resolve, reject) => {
     autoPlay.onplay = () => {
@@ -60,29 +21,16 @@ function check_autoplay_audio_onplay() {
     setTimeout(() => {
       ok(true, "Doesn't receive play event when media was blocked.");
       autoPlay.onplay = null;
       resolve();
     }, 1000);
   });
 }
 
-function check_nonautoplay_audio_suspended(suspendedType) {
-  let nonAutoPlay = content.document.getElementById("nonautoplay");
-  if (!nonAutoPlay) {
-    ok(false, "Can't get the audio element!");
-  }
-
-  is(
-    nonAutoPlay.computedSuspended,
-    suspendedType,
-    "The suspeded state of non-autoplay audio is correct."
-  );
-}
-
 function play_nonautoplay_audio_should_be_blocked() {
   let nonAutoPlay = content.document.getElementById("nonautoplay");
   if (!nonAutoPlay) {
     ok(false, "Can't get the audio element!");
   }
 
   nonAutoPlay.play();
   ok(nonAutoPlay.paused, "The blocked audio can't be playback.");
@@ -103,50 +51,27 @@ add_task(async function block_multiple_m
   let browser = tab.linkedBrowser;
   BrowserTestUtils.loadURI(browser, PAGE);
   await BrowserTestUtils.browserLoaded(browser);
 
   info("- tab should be blocked -");
   await waitForTabBlockEvent(tab, true);
 
   info("- autoplay media should be blocked -");
-  await ContentTask.spawn(
-    browser,
-    SuspendedType.SUSPENDED_BLOCK,
-    check_autoplay_audio_suspended
-  );
   await ContentTask.spawn(browser, null, check_autoplay_audio_onplay);
 
-  info(
-    "- non-autoplay media won't be blocked, because it doesn't start playing -"
-  );
-  await ContentTask.spawn(
-    browser,
-    SuspendedType.NONE_SUSPENDED,
-    check_nonautoplay_audio_suspended
-  );
-
   info("- non-autoplay can't start playback when the tab is blocked -");
   await ContentTask.spawn(
     browser,
     null,
     play_nonautoplay_audio_should_be_blocked
   );
-  await ContentTask.spawn(
-    browser,
-    SuspendedType.SUSPENDED_BLOCK,
-    check_nonautoplay_audio_suspended
-  );
 
   info("- select tab as foreground tab -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab);
 
   info("- tab should be resumed -");
   await waitForTabPlayingEvent(tab, true);
-  await ContentTask.spawn(
-    browser,
-    SuspendedType.NONE_SUSPENDED,
-    check_all_audio_suspended
-  );
+  await waitForTabBlockEvent(tab, false);
 
   info("- remove tab -");
   BrowserTestUtils.removeTab(tab);
 });
--- a/toolkit/content/tests/browser/browser_block_notInTreeAudio.js
+++ b/toolkit/content/tests/browser/browser_block_notInTreeAudio.js
@@ -1,32 +1,12 @@
 /* eslint-disable mozilla/no-arbitrary-setTimeout */
 const PAGE =
   "https://example.com/browser/toolkit/content/tests/browser/file_nonAutoplayAudio.html";
 
-var SuspendedType = {
-  NONE_SUSPENDED: 0,
-  SUSPENDED_PAUSE: 1,
-  SUSPENDED_BLOCK: 2,
-  SUSPENDED_PAUSE_DISPOSABLE: 3,
-};
-
-function check_audio_suspended(suspendedType) {
-  var audio = content.document.getElementById("testAudio");
-  if (!audio) {
-    ok(false, "Can't get the audio element!");
-  }
-
-  is(
-    audio.computedSuspended,
-    suspendedType,
-    "The suspeded state of audio is correct."
-  );
-}
-
 function check_audio_pause_state(expectPause) {
   var audio = content.document.getElementById("testAudio");
   if (!audio) {
     ok(false, "Can't get the audio element!");
   }
 
   is(audio.paused, expectPause, "The pause state of audio is corret.");
 }
@@ -59,23 +39,16 @@ add_task(async function block_not_in_tre
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- tab should not be blocked -");
   await waitForTabBlockEvent(tab, false);
 
-  info("- check audio's suspend state -");
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    SuspendedType.NONE_SUSPENDED,
-    check_audio_suspended
-  );
-
   info("- check audio's playing state -");
   await ContentTask.spawn(tab.linkedBrowser, true, check_audio_pause_state);
 
   info("- playing audio -");
   await ContentTask.spawn(tab.linkedBrowser, null, play_not_in_tree_audio);
 
   info("- tab should be blocked -");
   await waitForTabBlockEvent(tab, true);
--- a/toolkit/content/tests/browser/browser_block_playMediaInMuteTab.js
+++ b/toolkit/content/tests/browser/browser_block_playMediaInMuteTab.js
@@ -1,18 +1,11 @@
 const PAGE =
   "https://example.com/browser/toolkit/content/tests/browser/file_nonAutoplayAudio.html";
 
-var SuspendedType = {
-  NONE_SUSPENDED: 0,
-  SUSPENDED_PAUSE: 1,
-  SUSPENDED_BLOCK: 2,
-  SUSPENDED_PAUSE_DISPOSABLE: 3,
-};
-
 function wait_for_event(browser, event) {
   return BrowserTestUtils.waitForEvent(browser, event, false, event => {
     is(
       event.originalTarget,
       browser,
       "Event must be dispatched to correct browser."
     );
     return true;
@@ -25,29 +18,16 @@ function check_audio_volume_and_mute(exp
     ok(false, "Can't get the audio element!");
   }
 
   let expectedVolume = expectedMute ? 0.0 : 1.0;
   is(expectedVolume, audio.computedVolume, "Audio's volume is correct!");
   is(expectedMute, audio.computedMuted, "Audio's mute state is correct!");
 }
 
-function check_audio_suspended(suspendedType) {
-  var audio = content.document.getElementById("testAudio");
-  if (!audio) {
-    ok(false, "Can't get the audio element!");
-  }
-
-  is(
-    audio.computedSuspended,
-    suspendedType,
-    "The suspeded state of audio is correct."
-  );
-}
-
 function check_audio_pause_state(expectedPauseState) {
   var audio = content.document.getElementById("testAudio");
   if (!audio) {
     ok(false, "Can't get the audio element!");
   }
 
   is(audio.paused, expectedPauseState, "Audio is paused.");
 }
@@ -75,64 +55,42 @@ add_task(async function unblock_icon_sho
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- audio doesn't be started in beginning -");
   await ContentTask.spawn(tab.linkedBrowser, true, check_audio_pause_state);
 
-  info("- audio shouldn't be muted or blocked -");
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    SuspendedType.NONE_SUSPENDED,
-    check_audio_suspended
-  );
+  info("- audio shouldn't be muted -");
   await ContentTask.spawn(
     tab.linkedBrowser,
     false /* unmute */,
     check_audio_volume_and_mute
   );
 
   info("- tab shouldn't display unblocking icon -");
   await waitForTabBlockEvent(tab, false);
 
   info("- mute tab -");
   tab.linkedBrowser.mute();
   ok(tab.linkedBrowser.audioMuted, "Audio should be muted now");
 
   info("- try to start audio in background tab -");
   await ContentTask.spawn(tab.linkedBrowser, null, play_audio);
 
-  info("- audio should be muted and blocked -");
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    SuspendedType.SUSPENDED_BLOCK,
-    check_audio_suspended
-  );
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    true /* mute */,
-    check_audio_volume_and_mute
-  );
-
   info("- tab should display unblocking icon -");
   await waitForTabBlockEvent(tab, true);
 
   info("- select tab as foreground tab -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab);
 
   info("- audio shoule be muted, but not be blocked -");
   await ContentTask.spawn(
     tab.linkedBrowser,
-    SuspendedType.NONE_SUSPENDED,
-    check_audio_suspended
-  );
-  await ContentTask.spawn(
-    tab.linkedBrowser,
     true /* mute */,
     check_audio_volume_and_mute
   );
 
   info("- tab should not display unblocking icon -");
   await waitForTabBlockEvent(tab, false);
 
   info("- remove tab -");
--- a/toolkit/content/tests/browser/browser_block_silentAudioTrack_media.js
+++ b/toolkit/content/tests/browser/browser_block_silentAudioTrack_media.js
@@ -1,110 +1,62 @@
 const PAGE =
   "https://example.com/browser/toolkit/content/tests/browser/file_silentAudioTrack.html";
 
-var SuspendedType = {
-  NONE_SUSPENDED: 0,
-  SUSPENDED_PAUSE: 1,
-  SUSPENDED_BLOCK: 2,
-  SUSPENDED_PAUSE_DISPOSABLE: 3,
-};
-
 async function click_unblock_icon(tab) {
   let icon = tab.soundPlayingIcon;
 
   await hover_icon(icon, document.getElementById("tabbrowser-tab-tooltip"));
   EventUtils.synthesizeMouseAtCenter(icon, { button: 0 });
   leave_icon(icon);
 }
 
-function check_audio_suspended(suspendedType) {
-  var autoPlay = content.document.getElementById("autoplay");
-  if (!autoPlay) {
-    ok(false, "Can't get the audio element!");
-  }
-
-  is(
-    autoPlay.computedSuspended,
-    suspendedType,
-    "The suspeded state of autoplay audio is correct."
-  );
-}
-
 add_task(async function setup_test_preference() {
   await SpecialPowers.pushPrefEnv({
     set: [
       ["media.useAudioChannelService.testing", true],
       ["media.block-autoplay-until-in-foreground", true],
     ],
   });
 });
 
 add_task(async function unblock_icon_should_disapear_after_resume_tab() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
-  info("- the suspend state of tab should be suspend-block -");
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    SuspendedType.SUSPENDED_BLOCK,
-    check_audio_suspended
-  );
-
   info("- tab should display unblocking icon -");
   await waitForTabBlockEvent(tab, true);
 
   info("- select tab as foreground tab -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab);
 
-  info("- the suspend state of tab should be none-suspend -");
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    SuspendedType.NONE_SUSPENDED,
-    check_audio_suspended
-  );
-
   info("- should not display unblocking icon -");
   await waitForTabBlockEvent(tab, false);
 
   info("- should not display sound indicator icon -");
   await waitForTabPlayingEvent(tab, false);
 
   info("- remove tab -");
   BrowserTestUtils.removeTab(tab);
 });
 
 add_task(async function should_not_show_sound_indicator_after_resume_tab() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
-  info("- the suspend state of tab should be suspend-block -");
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    SuspendedType.SUSPENDED_BLOCK,
-    check_audio_suspended
-  );
-
   info("- tab should display unblocking icon -");
   await waitForTabBlockEvent(tab, true);
 
   info("- click play tab icon -");
   await click_unblock_icon(tab);
 
-  info("- the suspend state of tab should be none-suspend -");
-  await ContentTask.spawn(
-    tab.linkedBrowser,
-    SuspendedType.NONE_SUSPENDED,
-    check_audio_suspended
-  );
-
   info("- should not display unblocking icon -");
   await waitForTabBlockEvent(tab, false);
 
   info("- should not display sound indicator icon -");
   await waitForTabPlayingEvent(tab, false);
 
   info("- remove tab -");
   BrowserTestUtils.removeTab(tab);