Bug 1579388 - Enable featurepolicy pref in beta test_enumerateDevices. r=baku

dom.security.featurePolicy.enabled is enable only in nightly, so some
tests in beta will be failed. We should manually enable the pref in test.

Differential Revision: https://phabricator.services.mozilla.com/D44990

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Thomas Nguyen 2019-09-09 12:01:49 +00:00
Родитель b7834b6960
Коммит 7da04c50bc
1 изменённых файлов: 4 добавлений и 4 удалений

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

@ -42,7 +42,8 @@ var validateDevice = ({kind, label, deviceId, groupId}) => {
} }
runTest(async () => { runTest(async () => {
await pushPrefs(["media.navigator.streams.fake", true]); await pushPrefs(["media.navigator.streams.fake", true],
["dom.security.featurePolicy.enabled", true]);
// Validate enumerated devices. // Validate enumerated devices.
@ -98,6 +99,7 @@ runTest(async () => {
await Promise.all(origins.map(origin => { await Promise.all(origins.map(origin => {
let iframe = document.createElement("iframe"); let iframe = document.createElement("iframe");
iframe.src = origin + path; iframe.src = origin + path;
iframe.allow = "camera;microphone";
info(iframe.src); info(iframe.src);
document.documentElement.appendChild(iframe); document.documentElement.appendChild(iframe);
return new Promise(resolve => iframe.onload = resolve); return new Promise(resolve => iframe.onload = resolve);
@ -106,9 +108,7 @@ runTest(async () => {
let [sameOriginDevices, differentOriginDevices] = origins.map(o => devicesMap.get(o)); let [sameOriginDevices, differentOriginDevices] = origins.map(o => devicesMap.get(o));
is(sameOriginDevices.length, devices.length); is(sameOriginDevices.length, devices.length);
// Camera and microphone are allowed for documents that are same-origin by is(differentOriginDevices.length, devices.length);
// default.
is(differentOriginDevices.length, 0);
[...sameOriginDevices, ...differentOriginDevices].forEach(d => validateDevice(d)); [...sameOriginDevices, ...differentOriginDevices].forEach(d => validateDevice(d));
for (let device of sameOriginDevices) { for (let device of sameOriginDevices) {