forked from mirrors/gecko-dev
Bug 1676502 - part1 : move remaining sound indicator browser tests to 'browser/base/content/test/tabMediaIndicator/'. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D96629
This commit is contained in:
parent
c0c278d532
commit
7e66621a55
21 changed files with 167 additions and 65 deletions
|
|
@ -1,14 +1,39 @@
|
|||
[DEFAULT]
|
||||
tags = audiochannel
|
||||
support-files =
|
||||
almostSilentAudioTrack.webm
|
||||
audio.ogg
|
||||
audioEndedDuringPlaying.webm
|
||||
file_almostSilentAudioTrack.html
|
||||
file_autoplay_media.html
|
||||
file_empty.html
|
||||
file_mediaPlayback.html
|
||||
file_mediaPlayback2.html
|
||||
file_mediaPlaybackFrame.html
|
||||
file_mediaPlaybackFrame2.html
|
||||
file_silentAudioTrack.html
|
||||
file_webAudio.html
|
||||
gizmo.mp4
|
||||
head.js
|
||||
noaudio.webm
|
||||
silentAudioTrack.webm
|
||||
|
||||
[browser_destroy_iframe.js]
|
||||
[browser_mediaplayback_audibility_change.js]
|
||||
[browser_mediaPlayback.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_mediaPlayback_mute.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_mute.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_mute2.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_mute_webAudio.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_sound_indicator_silent_video.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_webaudio_audibility_change.js]
|
||||
[browser_webAudio_hideSoundPlayingIcon.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_webAudio_silentData.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
const PAGE =
|
||||
"https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback.html";
|
||||
const FRAME =
|
||||
"https://example.com/browser/toolkit/content/tests/browser/file_mediaPlaybackFrame.html";
|
||||
const PAGE = GetTestWebBasedURL("file_mediaPlayback.html");
|
||||
const FRAME = GetTestWebBasedURL("file_mediaPlaybackFrame.html");
|
||||
|
||||
function wait_for_event(browser, event) {
|
||||
return BrowserTestUtils.waitForEvent(browser, event, false, event => {
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
const PAGE =
|
||||
"https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback2.html";
|
||||
const FRAME =
|
||||
"https://example.com/browser/toolkit/content/tests/browser/file_mediaPlaybackFrame2.html";
|
||||
const PAGE = GetTestWebBasedURL("file_mediaPlayback2.html");
|
||||
const FRAME = GetTestWebBasedURL("file_mediaPlaybackFrame2.html");
|
||||
|
||||
function wait_for_event(browser, event) {
|
||||
return BrowserTestUtils.waitForEvent(browser, event, false, event => {
|
||||
|
|
@ -5,16 +5,7 @@ if (!gMultiProcessBrowser) {
|
|||
PromiseTestUtils.expectUncaughtRejection(/is no longer, usable/);
|
||||
}
|
||||
|
||||
const PAGE =
|
||||
"https://example.com/browser/toolkit/content/tests/browser/file_webAudio.html";
|
||||
|
||||
async function click_icon(tab) {
|
||||
let icon = tab.soundPlayingIcon;
|
||||
|
||||
await hover_icon(icon, document.getElementById("tabbrowser-tab-tooltip"));
|
||||
EventUtils.synthesizeMouseAtCenter(icon, { button: 0 });
|
||||
leave_icon(icon);
|
||||
}
|
||||
const PAGE = GetTestWebBasedURL("file_webAudio.html");
|
||||
|
||||
function start_webAudio() {
|
||||
var startButton = content.document.getElementById("start");
|
||||
|
|
@ -35,7 +26,6 @@ function stop_webAudio() {
|
|||
}
|
||||
|
||||
add_task(async function setup_test_preference() {
|
||||
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["media.useAudioChannelService.testing", true],
|
||||
|
|
@ -54,11 +44,11 @@ add_task(async function mute_web_audio() {
|
|||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- tab should be audible -");
|
||||
await waitForTabPlayingEvent(tab, true);
|
||||
await waitForTabSoundIndicatorAppears(tab);
|
||||
|
||||
info("- mute browser -");
|
||||
ok(!tab.linkedBrowser.audioMuted, "Audio should not be muted by default");
|
||||
await click_icon(tab);
|
||||
await clickIcon(tab.soundPlayingIcon);
|
||||
ok(tab.linkedBrowser.audioMuted, "Audio should be muted now");
|
||||
|
||||
info("- stop web audip -");
|
||||
|
|
@ -69,11 +59,11 @@ add_task(async function mute_web_audio() {
|
|||
|
||||
info("- unmute browser -");
|
||||
ok(tab.linkedBrowser.audioMuted, "Audio should be muted now");
|
||||
await click_icon(tab);
|
||||
await clickIcon(tab.soundPlayingIcon);
|
||||
ok(!tab.linkedBrowser.audioMuted, "Audio should be unmuted now");
|
||||
|
||||
info("- tab should be audible -");
|
||||
await waitForTabPlayingEvent(tab, true);
|
||||
await waitForTabSoundIndicatorAppears(tab);
|
||||
|
||||
info("- remove tab -");
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
const SILENT_PAGE =
|
||||
"https://example.com/browser/toolkit/content/tests/browser/file_silentAudioTrack.html";
|
||||
const ALMOST_SILENT_PAGE =
|
||||
"https://example.com/browser/toolkit/content/tests/browser/file_almostSilentAudioTrack.html";
|
||||
const SILENT_PAGE = GetTestWebBasedURL("file_silentAudioTrack.html");
|
||||
const ALMOST_SILENT_PAGE = GetTestWebBasedURL(
|
||||
"file_almostSilentAudioTrack.html"
|
||||
);
|
||||
|
||||
function check_audio_playing_state(isPlaying) {
|
||||
let autoPlay = content.document.getElementById("autoplay");
|
||||
|
|
@ -37,7 +37,7 @@ add_task(async function should_not_show_sound_indicator_for_silent_video() {
|
|||
);
|
||||
|
||||
info("- tab should not have sound indicator before playing silent video -");
|
||||
await waitForTabPlayingEvent(tab, false);
|
||||
await waitForTabSoundIndicatorDisappears(tab);
|
||||
|
||||
info("- loading autoplay silent video -");
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, SILENT_PAGE);
|
||||
|
|
@ -49,7 +49,7 @@ add_task(async function should_not_show_sound_indicator_for_silent_video() {
|
|||
);
|
||||
|
||||
info("- tab should not have sound indicator after playing silent video -");
|
||||
await waitForTabPlayingEvent(tab, false);
|
||||
await waitForTabSoundIndicatorDisappears(tab);
|
||||
|
||||
info("- remove tab -");
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
|
@ -66,7 +66,7 @@ add_task(
|
|||
info(
|
||||
"- tab should not have sound indicator before playing almost silent video -"
|
||||
);
|
||||
await waitForTabPlayingEvent(tab, false);
|
||||
await waitForTabSoundIndicatorDisappears(tab);
|
||||
|
||||
info("- loading autoplay almost silent video -");
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, ALMOST_SILENT_PAGE);
|
||||
|
|
@ -80,7 +80,7 @@ add_task(
|
|||
info(
|
||||
"- tab should not have sound indicator after playing almost silent video -"
|
||||
);
|
||||
await waitForTabPlayingEvent(tab, false);
|
||||
await waitForTabSoundIndicatorDisappears(tab);
|
||||
|
||||
info("- remove tab -");
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
|
@ -39,13 +39,13 @@ async function testResumeRunningAudioContext() {
|
|||
});
|
||||
|
||||
info(`- wait for 'sound-playing' icon showing -`);
|
||||
await waitForTabPlayingEvent(tab, true);
|
||||
await waitForTabSoundIndicatorAppears(tab);
|
||||
|
||||
info(`- resume AudioContext -`);
|
||||
await SpecialPowers.spawn(browser, [], resumeAudioContext);
|
||||
|
||||
info(`- 'sound-playing' icon should still exist -`);
|
||||
await waitForTabPlayingEvent(tab, true);
|
||||
await waitForTabSoundIndicatorAppears(tab);
|
||||
|
||||
info(`- remove tab -`);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
|
|
@ -50,7 +50,7 @@ add_task(async function testSilentAudioContext() {
|
|||
// reason of no showing sound indicator is because of silent web audio, or
|
||||
// because the indicator is just not showing yet.
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
await waitForTabPlayingEvent(tab, false);
|
||||
await waitForTabSoundIndicatorDisappears(tab);
|
||||
|
||||
info(`- remove tab -`);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
var audio = new Audio();
|
||||
audio.oncanplay = function() {
|
||||
audio.oncanplay = null;
|
||||
audio.play();
|
||||
};
|
||||
audio.src = "audio.ogg";
|
||||
audio.loop = true;
|
||||
audio.id = "v";
|
||||
document.body.appendChild(audio);
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
||||
<meta content="utf-8" http-equiv="encoding">
|
||||
</head>
|
||||
<body>
|
||||
<video id="autoplay" src="silentAudioTrack.webm"></video>
|
||||
<script type="text/javascript">
|
||||
|
||||
// In linux debug on try server, sometimes the download process would fail, so
|
||||
// we can't activate the "auto-play" or playing after receving "oncanplay".
|
||||
// Therefore, we just call play here.
|
||||
var video = document.getElementById("autoplay");
|
||||
video.loop = true;
|
||||
video.play();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
||||
<meta content="utf-8" http-equiv="encoding">
|
||||
</head>
|
||||
<body>
|
||||
<pre id=state></pre>
|
||||
<button id="start" onclick="start_webaudio()">Start</button>
|
||||
<button id="stop" onclick="stop_webaudio()">Stop</button>
|
||||
<script type="text/javascript">
|
||||
var ac = new AudioContext();
|
||||
var dest = ac.destination;
|
||||
var osc = ac.createOscillator();
|
||||
osc.connect(dest);
|
||||
osc.start();
|
||||
document.querySelector("pre").innerText = ac.state;
|
||||
ac.onstatechange = function() {
|
||||
document.querySelector("pre").innerText = ac.state;
|
||||
}
|
||||
|
||||
function start_webaudio() {
|
||||
ac.resume();
|
||||
}
|
||||
|
||||
function stop_webaudio() {
|
||||
ac.suspend();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -60,7 +60,7 @@ async function waitForTabSoundIndicatorDisappears(tab) {
|
|||
|
||||
/**
|
||||
* Return a new foreground tab loading with an empty file.
|
||||
* @param needObserver
|
||||
* @param {boolean} needObserver
|
||||
* If true, sets an observer property on the returned tab. This property
|
||||
* exposes `hasEverUpdated()` which will return a bool indicating if the
|
||||
* sound indicator has ever updated.
|
||||
|
|
@ -91,3 +91,62 @@ function createSoundIndicatorObserver(tab) {
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sythesize mouse hover on the given icon, which would sythesize `mouseover`
|
||||
* and `mousemove` event on that. Return a promise that will be resolved when
|
||||
* the tooptip element shows.
|
||||
* @param {tab icon} icon
|
||||
* the icon on which we want to mouse hover
|
||||
* @param {tooltip element} tooltip
|
||||
* the tab tooltip elementss
|
||||
*/
|
||||
function hoverIcon(icon, tooltip) {
|
||||
disableNonTestMouse(true);
|
||||
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(tooltip, "popupshown");
|
||||
EventUtils.synthesizeMouse(icon, 1, 1, { type: "mouseover" });
|
||||
EventUtils.synthesizeMouse(icon, 2, 2, { type: "mousemove" });
|
||||
EventUtils.synthesizeMouse(icon, 3, 3, { type: "mousemove" });
|
||||
EventUtils.synthesizeMouse(icon, 4, 4, { type: "mousemove" });
|
||||
return popupShownPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Leave mouse from the given icon, which would sythesize `mouseout`
|
||||
* and `mousemove` event on that.
|
||||
* @param {tab icon} icon
|
||||
* the icon on which we want to mouse hover
|
||||
* @param {tooltip element} tooltip
|
||||
* the tab tooltip elementss
|
||||
*/
|
||||
function leaveIcon(icon) {
|
||||
EventUtils.synthesizeMouse(icon, 0, 0, { type: "mouseout" });
|
||||
EventUtils.synthesizeMouseAtCenter(document.documentElement, {
|
||||
type: "mousemove",
|
||||
});
|
||||
EventUtils.synthesizeMouseAtCenter(document.documentElement, {
|
||||
type: "mousemove",
|
||||
});
|
||||
EventUtils.synthesizeMouseAtCenter(document.documentElement, {
|
||||
type: "mousemove",
|
||||
});
|
||||
|
||||
disableNonTestMouse(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sythesize mouse click on the given icon.
|
||||
* @param {tab icon} icon
|
||||
* the icon on which we want to mouse hover
|
||||
*/
|
||||
async function clickIcon(icon) {
|
||||
await hoverIcon(icon, document.getElementById("tabbrowser-tab-tooltip"));
|
||||
EventUtils.synthesizeMouseAtCenter(icon, { button: 0 });
|
||||
leaveIcon(icon);
|
||||
}
|
||||
|
||||
function disableNonTestMouse(disable) {
|
||||
let utils = window.windowUtils;
|
||||
utils.disableNonTestMouseEvents(disable);
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -3,17 +3,12 @@ prefs =
|
|||
plugin.load_flash_only=false
|
||||
media.cubeb.sandbox=false # BMO 1610640
|
||||
support-files =
|
||||
almostSilentAudioTrack.webm
|
||||
audio.ogg
|
||||
empty.png
|
||||
file_almostSilentAudioTrack.html
|
||||
file_contentTitle.html
|
||||
file_empty.html
|
||||
file_findinframe.html
|
||||
file_mediaPlayback.html
|
||||
file_mediaPlayback2.html
|
||||
file_mediaPlaybackFrame.html
|
||||
file_mediaPlaybackFrame2.html
|
||||
file_multipleAudio.html
|
||||
file_multiplePlayingAudio.html
|
||||
file_nonAutoplayAudio.html
|
||||
|
|
@ -91,12 +86,6 @@ support-files =
|
|||
gizmo.mp4
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_license_links.js]
|
||||
[browser_mediaPlayback.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_mediaPlayback_mute.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_media_wakelock.js]
|
||||
support-files =
|
||||
browser_mediaStreamPlayback.html
|
||||
|
|
@ -108,18 +97,9 @@ support-files =
|
|||
gizmo-noaudio.webm
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_media_wakelock_webaudio.js]
|
||||
[browser_mute.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_mute2.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_mute_plugIn.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_mute_webAudio.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_quickfind_editable.js]
|
||||
skip-if = (verify && debug && (os == 'linux'))
|
||||
[browser_save_resend_postdata.js]
|
||||
|
|
@ -129,15 +109,6 @@ support-files =
|
|||
data/post_form_outer.sjs
|
||||
skip-if = e10s # Bug ?????? - test directly manipulates content (gBrowser.contentDocument.getElementById("postForm").submit();)
|
||||
[browser_saveImageURL.js]
|
||||
[browser_sound_indicator_silent_video.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_resume_bkg_video_on_tab_hover.js]
|
||||
skip-if = (os == "win" && processor == "aarch64") || debug # aarch64 due to 1536573, Bug 1388959
|
||||
[browser_webAudio_hideSoundPlayingIcon.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
[browser_webAudio_silentData.js]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ avoid-blacklist-and-whitelist:
|
|||
- browser/base/content/test/static/browser_misused_characters_in_strings.js
|
||||
- browser/base/content/test/static/browser_parsable_css.js
|
||||
- browser/base/content/test/static/browser_parsable_script.js
|
||||
- browser/base/content/test/tabMediaIndicator/browser_mute_webAudio.js
|
||||
- browser/base/content/test/tabs/browser_new_file_whitelisted_http_tab.js
|
||||
- browser/components/downloads/content/contentAreaDownloadsView.xhtml
|
||||
- browser/components/enterprisepolicies/helpers/WebsiteFilter.jsm
|
||||
|
|
@ -400,7 +401,6 @@ avoid-blacklist-and-whitelist:
|
|||
- toolkit/content/aboutUrlClassifier.js
|
||||
- toolkit/content/aboutUrlClassifier.xhtml
|
||||
- toolkit/content/tests/browser/browser_delay_autoplay_webAudio.js
|
||||
- toolkit/content/tests/browser/browser_mute_webAudio.js
|
||||
- toolkit/crashreporter/client/ping.cpp
|
||||
- toolkit/crashreporter/CrashAnnotations.cpp
|
||||
- toolkit/crashreporter/generate_crash_reporter_sources.py
|
||||
|
|
|
|||
Loading…
Reference in a new issue