diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/media/webrtc/tests/mochitests/test_groupId.html | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_groupId.html')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_groupId.html | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_groupId.html b/dom/media/webrtc/tests/mochitests/test_groupId.html new file mode 100644 index 0000000000..261896d74b --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_groupId.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML> +<html> +<head> + <script src="mediaStreamPlayback.js"></script> +</head> +<body> +<pre id="test"> +<script type="application/javascript"> +createHTML({ title: "Test group id of MediaDeviceInfo", bug: "1213453" }); + +let getDefaultDevices = async () => { + let devices = await navigator.mediaDevices.enumerateDevices(); + is(devices.length, 2, "Two fake devices found."); + + devices.forEach(d => isnot(d.groupId, "", "GroupId is included in every device")); + + let videos = devices.filter(d => d.kind == "videoinput"); + is(videos.length, 1, "One video device found."); + let audios = devices.filter(d => d.kind == "audioinput"); + is(audios.length, 1, "One microphone device found."); + + return {audio: audios[0], video: videos[0]}; +} + +runTest(async () => { + // Force fake devices in order to be able to change camera name by pref. + await pushPrefs(["media.navigator.streams.fake", true], + ["media.audio_loopback_dev", ""], + ["media.video_loopback_dev", ""]); + + let {audio, video} = await getDefaultDevices(); + + /* The low level method to correlate groupIds is by device names. + * Use a similar comparison here to verify that it works. + * Multiple devices of the same device name are not expected in + * automation. */ + isnot(audio.groupId, video.groupId, "Not the same groupIds"); + // Change video name to match. + await pushPrefs(["media.getusermedia.fake-camera-name", audio.label]); + ({audio, video} = await getDefaultDevices()); + is(audio.groupId, video.groupId, "GroupIds should be the same"); +}); +</script> +</pre> +</body> +</html> |