Skip to content

Commit

Permalink
Add web platform tests for screen sharing controls
Browse files Browse the repository at this point in the history
This CL adds web platform tests for recent screen sharing controls:
- DisplayMediaStreamConstraints.systemAudio
- DisplayMediaStreamConstraints.selfBrowserSurface
- MediaTrackConstraintSet.displaySurface
- DisplayMediaStreamConstraints.surfaceSwitching

Change-Id: I28de0e8a3b0e8a0829aaea05713a874671c84ed1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3924078
Reviewed-by: Elad Alon <[email protected]>
Commit-Queue: Elad Alon <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1052903}
  • Loading branch information
beaufortfrancois authored and chromium-wpt-export-bot committed Sep 29, 2022
1 parent 0ee0bf4 commit 9320d46
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions screen-capture/getdisplaymedia.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,35 @@
}, property + " is supported");
});
}

[
{video: {displaySurface: "monitor"}},
{video: {displaySurface: "window"}},
{video: {displaySurface: "browser"}},
{selfBrowserSurface: "include"},
{selfBrowserSurface: "exclude"},
{surfaceSwitching: "include"},
{surfaceSwitching: "exclude"},
{systemAudio: "include"},
{systemAudio: "exclude"},
].forEach(constraints => promise_test(async t => {
const stream = await getDisplayMedia(constraints);
t.add_cleanup(() => stopTracks(stream));
}, `getDisplayMedia(${j(constraints)}) must succeed`));

[
{selfBrowserSurface: "invalid"},
{surfaceSwitching: "invalid"},
{systemAudio: "invalid"},
].forEach(constraints => promise_test(async t => {
await test_driver.bless('getDisplayMedia()');
const p = navigator.mediaDevices.getDisplayMedia(constraints);
t.add_cleanup(async () => {
try { stopTracks(await p) } catch {}
});
await promise_rejects_js(
t, TypeError, Promise.race([p, Promise.resolve()]),
'getDisplayMedia should have returned an already-rejected promise.');
}, `getDisplayMedia(${j(constraints)}) must fail with TypeError`));

</script>

0 comments on commit 9320d46

Please sign in to comment.