Bug 1509933 - part3 : use the new pref in tests. r=padenot

This patch will do :
- replace the old pref with the new pref

The advantage of doing so :
- to ensure those tests can still use the correct blocking autoplay policy

Differential Revision: https://phabricator.services.mozilla.com/D73973
This commit is contained in:
alwu 2020-05-07 13:05:22 +00:00
Родитель c2f6d7f374
Коммит 1c6be41aa9
24 изменённых файлов: 25 добавлений и 25 удалений

Просмотреть файл

@ -4,7 +4,7 @@ function setup_test_preference(enableScript) {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", 1],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.allow-extension-background-pages", enableScript],
],
});

Просмотреть файл

@ -15,7 +15,7 @@
let manager = new MediaTestManager;
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true]);
["media.autoplay.blocking_policy", 0]);
window.info = function(msg, token) {
SimpleTest.info(msg + ", token=" + token);
@ -78,7 +78,7 @@ function createTestArray()
* Main test function for different autoplay cases without user interaction.
*
* When the pref "media.autoplay.default" is 1 and the pref
* "media.autoplay.enabled.user-gestures-needed" is true, we only allow
* "media.autoplay.blocking_policy" is 0, we only allow
* audible media to autoplay after the website has been activated by specific
* user gestures. However, inaudible media won't be restricted.
*

Просмотреть файл

@ -15,7 +15,7 @@
// which have been activated by same-origin user gesture.
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true]);
["media.autoplay.blocking_policy", 0]);
SpecialPowers.pushPrefEnv({'set': gTestPrefs}, () => {
runTest();

Просмотреть файл

@ -16,7 +16,7 @@
// Tests that we gesture activate on mousedown and keydown.
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true]);
["media.autoplay.blocking_policy", 0]);
SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
runTest();

Просмотреть файл

@ -19,7 +19,7 @@
// audible autoplay.
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true]);
["media.autoplay.blocking_policy", 0]);
SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
runTest();

Просмотреть файл

@ -16,7 +16,7 @@
// Tests that origins with "autoplay-media" permission can autoplay.
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true]);
["media.autoplay.blocking_policy", 0]);
SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
runTest();

Просмотреть файл

@ -20,7 +20,7 @@
// is called before the video has reached readyState >= HAVE_METADATA.
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true]);
["media.autoplay.blocking_policy", 0]);
SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
runTest();

Просмотреть файл

@ -20,7 +20,7 @@
// which have been activated by same-origin user gesture.
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true]);
["media.autoplay.blocking_policy", 0]);
SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
runTest();

Просмотреть файл

@ -44,7 +44,7 @@ SimpleTest.waitForExplicitFinish();
function setupTestPreferences() {
return SpecialPowers.pushPrefEnv({"set": [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-webaudio", true],
["media.autoplay.block-event.enabled", true],
]});

Просмотреть файл

@ -39,7 +39,7 @@ SimpleTest.waitForExplicitFinish();
function setupTestPreferences() {
return SpecialPowers.pushPrefEnv({"set": [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-webaudio", true],
["media.autoplay.block-event.enabled", true],
]});

Просмотреть файл

@ -42,7 +42,7 @@ SimpleTest.waitForExplicitFinish();
function setupTestPreferences() {
return SpecialPowers.pushPrefEnv({"set": [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-webaudio", true],
["media.autoplay.block-event.enabled", true],
]});

Просмотреть файл

@ -42,7 +42,7 @@ SimpleTest.waitForExplicitFinish();
function setupTestPreferences() {
return SpecialPowers.pushPrefEnv({"set": [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-webaudio", true],
["media.autoplay.block-event.enabled", true],
]});

Просмотреть файл

@ -26,7 +26,7 @@ SimpleTest.registerCleanupFunction(function() {
});
SpecialPowers.pushPrefEnv({"set": [["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true]]},
["media.autoplay.blocking_policy", 0]]},
startTest);
function startTest() {

Просмотреть файл

@ -58,7 +58,7 @@ user_pref("xpinstall.signatures.required", false);
user_pref("services.settings.server", "http://localhost/remote-settings-dummy/v1");
// Ensure autoplay is enabled for all platforms.
user_pref("media.autoplay.default", 0); // 0=Allowed, 1=Blocked, 2=Prompt
user_pref("media.autoplay.enabled.user-gestures-needed", true);
user_pref("media.autoplay.blocking_policy", 0);
user_pref("media.autoplay.ask-permission", false);
user_pref("media.autoplay.block-webaudio", false);
user_pref("media.allowed-to-play.enabled", true);

Просмотреть файл

@ -17,7 +17,7 @@ function setupTestPreferences(isAllowedAutoplay, isAllowedMuted) {
set: [
["dom.media.autoplay.autoplay-policy-api", true],
["media.autoplay.default", autoplayDefault],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
],
});
}

Просмотреть файл

@ -7,7 +7,7 @@ function setup_test_preference(enableUserGesture) {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", enableUserGesture],
["media.autoplay.blocking_policy", enableUserGesture ? 0 : 1],
],
});
}

Просмотреть файл

@ -20,7 +20,7 @@ function setTestingPreferences(defaultSetting) {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", defaultValue],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-event.enabled", true],
],
});

Просмотреть файл

@ -77,7 +77,7 @@ add_task(async function setup_test_preference() {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
],
});
});

Просмотреть файл

@ -65,7 +65,7 @@ function setupTestPreferences() {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-event.enabled", true],
["media.autoplay.block-webaudio", true],
["media.navigator.permission.fake", true],

Просмотреть файл

@ -15,7 +15,7 @@ add_task(() => {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-event.enabled", true],
],
});

Просмотреть файл

@ -19,7 +19,7 @@ function setup_test_preference() {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-webaudio", true],
["media.autoplay.block-event.enabled", true],
],

Просмотреть файл

@ -48,7 +48,7 @@ function setupTestPreferences() {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
["media.autoplay.block-event.enabled", true],
["media.autoplay.block-webaudio", true],
["media.navigator.permission.fake", true],

Просмотреть файл

@ -7,7 +7,7 @@ function setup_test_preference() {
return SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
],
});
}

Просмотреть файл

@ -111,7 +111,7 @@ add_task(async function resume_delayed_media_when_enable_blocking_autoplay() {
await SpecialPowers.pushPrefEnv({
set: [
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
["media.autoplay.enabled.user-gestures-needed", true],
["media.autoplay.blocking_policy", 0],
],
});