Files
sousa-gecko/testing/web-platform/tests/screen-capture/getdisplaymedia-settings.https.html
T
youennf 765d96e1f2 Bug 1938314 [wpt PR 49775] - Add test checking the presence of deviceId in screen share video track, a=testonly
Automatic update from web-platform-tests
Add test checking the presence of deviceId in screen share video track (#49775)

* Add test checking the presence of deviceId in screen share video track

* Removing alert call and removing unneeded whitespace
--

wpt-commits: 44c2b3b6b5c1747f6a15ee894e590cf37dd519eb
wpt-pr: 49775
2025-01-08 10:20:55 +00:00

48 lines
1.5 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<title>getDisplayMedia</title>
<meta name="timeout" content="long">
<button id="button">User gesture</button>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<video id="display"></video>
<script>
'use strict';
const stopTracks = stream => stream.getTracks().forEach(track => track.stop());
async function getDisplayMedia(constraints) {
const p = new Promise(r => button.onclick = r);
await test_driver.click(button);
await p;
return navigator.mediaDevices.getDisplayMedia(constraints);
}
promise_test(async t => {
const stream = await getDisplayMedia({video: true});
const track = stream.getVideoTracks()[0];
t.add_cleanup(() => stopTracks(stream));
const settings = track.getSettings();
const capabilities = track.getCapabilities();
assert_true("deviceId" in settings);
assert_equals(capabilities.deviceId, settings.deviceId);
}, "getDisplayMedia() deviceId setting and capability");
promise_test(async t => {
const stream = await getDisplayMedia({video: true});
const track = stream.getVideoTracks()[0];
t.add_cleanup(() => stopTracks(stream));
const settings = track.getSettings();
const capabilities = track.getCapabilities();
assert_false("facingMode" in settings);
assert_false("facingMode" in capabilities);
}, "getDisplayMedia() and facingMode");
</script>