mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1455747 [wpt PR 10554] - Support groupId constrainable properties in MediaDevices.getUserMedia(), a=testonly
Automatic update from web-platform-testsSupport groupId constrainable properties in MediaDevices.getUserMedia() This CL also adds support in MediaStreamTrack.applyConstraints(). Drive-by: Minor lint fixes. Bug: 833333 Change-Id: I8636def42d9ed64c6f58777d44343e569e541bfb Reviewed-on: https://chromium-review.googlesource.com/1021570 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Harald Alvestrand <hta@chromium.org> Commit-Queue: Guido Urdaneta <guidou@chromium.org> Cr-Commit-Position: refs/heads/master@{#556124} -- wpt-commits: 23a93d234f1f9fc681cdee1d0c05c38070910da2 wpt-pr: 10554
This commit is contained in:
parent
4e1fb0f0af
commit
0f18abb1e1
@ -345172,6 +345172,12 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mediacapture-streams/MediaStreamTrack-applyConstraints.https.html": [
|
||||
[
|
||||
"/mediacapture-streams/MediaStreamTrack-applyConstraints.https.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mediacapture-streams/MediaStreamTrack-getCapabilities.https.html": [
|
||||
[
|
||||
"/mediacapture-streams/MediaStreamTrack-getCapabilities.https.html",
|
||||
@ -583322,7 +583328,7 @@
|
||||
"testharness"
|
||||
],
|
||||
"mediacapture-streams/MediaDevices-getUserMedia.https.html": [
|
||||
"a515deeec87c394b4a826b538df6dd0baa05cae6",
|
||||
"dbd2cbacb24f088167e1c34207bea12c19f5d0e1",
|
||||
"testharness"
|
||||
],
|
||||
"mediacapture-streams/MediaStream-MediaElement-preload-none-manual.https.html": [
|
||||
@ -583377,6 +583383,10 @@
|
||||
"e3358344a76f874b68bdba743f113caa3b61ec88",
|
||||
"testharness"
|
||||
],
|
||||
"mediacapture-streams/MediaStreamTrack-applyConstraints.https.html": [
|
||||
"cda78cab93e93f9e436d46db8b7a6a0d12471e87",
|
||||
"testharness"
|
||||
],
|
||||
"mediacapture-streams/MediaStreamTrack-end-manual.https.html": [
|
||||
"6511203b417168722d1e05d90e58364ebce145ea",
|
||||
"manual"
|
||||
|
@ -36,6 +36,34 @@ test(function () {
|
||||
// list.deviceId
|
||||
// list.groupId
|
||||
}, "mediaDevices.getUserMedia() is present on navigator");
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaDevices.enumerateDevices()
|
||||
.then(t.step_func(async devices => {
|
||||
for (var i in devices) {
|
||||
await navigator.mediaDevices.getUserMedia(
|
||||
{video: {groupId: {exact: devices[i].groupId}}})
|
||||
.then(
|
||||
t.step_func(stream => {
|
||||
var found_device = devices.find(element => {
|
||||
return element.deviceId ==
|
||||
stream.getTracks()[0].getSettings().deviceId;
|
||||
});
|
||||
assert_true(undefined !== found_device);
|
||||
assert_equals(found_device.kind, "videoinput");
|
||||
assert_equals(found_device.groupId, devices[i].groupId);
|
||||
}),
|
||||
t.step_func(error => {
|
||||
assert_equals(error.name, "OverconstrainedError");
|
||||
assert_equals(error.constraint, "groupId");
|
||||
var found_device = devices.find(element => {
|
||||
return element.kind == "videoinput" &&
|
||||
element.groupId == devices[i].groupId});
|
||||
assert_true(undefined === found_device);
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}, 'groupId is correctly supported by getUserMedia() for video devices');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,57 @@
|
||||
<!doctype html>
|
||||
<title>MediaStreamTrack applyConstraints</title>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
'use strict'
|
||||
|
||||
// https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-applyconstraints
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaDevices.getUserMedia({ video: true })
|
||||
.then(t.step_func(stream => {
|
||||
return stream.getVideoTracks()[0].applyConstraints(
|
||||
{ groupId: { exact: "INVALID" } }).then(
|
||||
t.unreached_func('Accepted invalid groupID'),
|
||||
t.step_func(e => {
|
||||
assert_equals(e.name, 'OverconstrainedError');
|
||||
assert_equals(e.constraint, 'groupId');
|
||||
}));
|
||||
}));
|
||||
}, 'applyConstraints rejects invalid groupID');
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaDevices.getUserMedia({ video: true })
|
||||
.then(t.step_func(stream => {
|
||||
var track = stream.getVideoTracks()[0];
|
||||
var groupId = track.getSettings().groupId;
|
||||
return track.applyConstraints({ groupId: "INVALID" }).then(
|
||||
t.step_func(() => {
|
||||
assert_equals(track.getSettings().groupId, groupId);
|
||||
}));
|
||||
}));
|
||||
}, 'applyConstraints accepts invalid ideal groupID, does not change setting');
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaDevices.getUserMedia({ video: true })
|
||||
.then(t.step_func(stream => {
|
||||
var track = stream.getVideoTracks()[0];
|
||||
var groupId = track.getSettings().groupId;
|
||||
return navigator.mediaDevices.enumerateDevices().then(devices => {
|
||||
var anotherDevice = devices.find(device => {
|
||||
return device.kind == "videoinput" && device.groupId != groupId;
|
||||
});
|
||||
if (anotherDevice !== undefined) {
|
||||
return track.applyConstraints(
|
||||
{ groupId: { exact: anotherDevice.groupId } }).then(
|
||||
t.unreached_func(),
|
||||
t.step_func(e => {
|
||||
assert_equals(e.name, 'OverconstrainedError');
|
||||
assert_equals(e.constraint, 'groupId');
|
||||
}));
|
||||
}
|
||||
});
|
||||
}));
|
||||
}, 'applyConstraints rejects attempt to switch device using groupId');
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user