diff options
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_enumerateDevices_iframe.html')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_enumerateDevices_iframe.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_enumerateDevices_iframe.html b/dom/media/webrtc/tests/mochitests/test_enumerateDevices_iframe.html new file mode 100644 index 0000000000..beea3a4f97 --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_enumerateDevices_iframe.html @@ -0,0 +1,28 @@ +<!DOCTYPE HTML> +<html> +<body> +<pre id="test"> +<script type="application/javascript"> +/** + Runs inside iframe in test_enumerateDevices.html. +*/ + +const pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p}); +const gUM = c => navigator.mediaDevices.getUserMedia(c); + +(async () => { + await pushPrefs(["media.navigator.streams.fake", true]); + + // Validate enumerated devices after gUM. + for (const track of (await gUM({video: true, audio: true})).getTracks()) { + track.stop(); + } + + const devices = await navigator.mediaDevices.enumerateDevices(); + parent.postMessage(JSON.stringify(devices), "https://example.com:443"); + +})().catch(e => setTimeout(() => { throw e; })); +</script> +</pre> +</body> +</html> |