Skip to content

Commit

Permalink
User gesture + audio optional in parallel-capture-requests wpt
Browse files Browse the repository at this point in the history
Bug: 1373032
Change-Id: I3823fff2a8151273fd672292bfb4ffb3ed32c435
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4037741
Commit-Queue: Tove Petersson <[email protected]>
Reviewed-by: Florent Castelli <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1073319}
  • Loading branch information
tovepet authored and chromium-wpt-export-bot committed Nov 18, 2022
1 parent 7fed25a commit 60845e6
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions mediacapture-streams/parallel-capture-requests.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,52 @@
<title>Parallel capture requests</title>
</head>
<body>
<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>
<script>
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(function() {
const getUserMediaPromise =
navigator.mediaDevices.getUserMedia({audio: true, video:true});
const getDisplayMediaPromise =
navigator.mediaDevices.getDisplayMedia({video: true, audio: true});
getDisplayMedia({video: true, audio: true});
return Promise.all([getUserMediaPromise, getDisplayMediaPromise])
.then(function(s) {
assert_equals(s[0].getTracks().length, 2);
assert_equals(s[0].getAudioTracks().length, 1);
assert_greater_than_equal(s[0].getTracks().length, 1);
assert_less_than_equal(s[0].getTracks().length, 2);
assert_equals(s[0].getVideoTracks().length, 1);
assert_equals(s[1].getTracks().length, 2);
assert_equals(s[1].getAudioTracks().length, 1);
assert_less_than_equal(s[0].getAudioTracks().length, 1);
assert_greater_than_equal(s[1].getTracks().length, 1);
assert_less_than_equal(s[1].getTracks().length, 2);
assert_equals(s[1].getVideoTracks().length, 1);
assert_less_than_equal(s[1].getAudioTracks().length, 1);
});
}, 'getDisplayMedia() and parallel getUserMedia()');

promise_test(function() {
const getDisplayMediaPromise =
navigator.mediaDevices.getDisplayMedia({video: true, audio: true});
getDisplayMedia({video: true, audio: true});
const getUserMediaPromise =
navigator.mediaDevices.getUserMedia({audio: true, video:true});
return Promise.all([getDisplayMediaPromise, getUserMediaPromise])
.then(function(s) {
assert_equals(s[0].getTracks().length, 2);
assert_equals(s[0].getAudioTracks().length, 1);
assert_greater_than_equal(s[0].getTracks().length, 1);
assert_less_than_equal(s[0].getTracks().length, 2);
assert_equals(s[0].getVideoTracks().length, 1);
assert_equals(s[1].getTracks().length, 2);
assert_equals(s[1].getAudioTracks().length, 1);
assert_less_than_equal(s[0].getAudioTracks().length, 1);
assert_greater_than_equal(s[1].getTracks().length, 1);
assert_less_than_equal(s[1].getTracks().length, 2);
assert_equals(s[1].getVideoTracks().length, 1);
assert_less_than_equal(s[1].getAudioTracks().length, 1);
});
}, 'getUserMedia() and parallel getDisplayMedia()');
</script>
Expand Down

0 comments on commit 60845e6

Please sign in to comment.