mirror of
https://github.com/servo/servo.git
synced 2025-08-30 09:38:19 +01:00
Update web-platform-tests to revision 84af6c875d378944b39d895acdcfc170736b2d3d
This commit is contained in:
parent
d0bd2d5e44
commit
b81cdc75ce
246 changed files with 10836 additions and 1337 deletions
|
@ -37,63 +37,53 @@ test(function () {
|
|||
// 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);
|
||||
}));
|
||||
}
|
||||
}));
|
||||
promise_test(async t => {
|
||||
assert_true(navigator.mediaDevices.getSupportedConstraints()["groupId"],
|
||||
"groupId should be supported");
|
||||
const devices = await navigator.mediaDevices.enumerateDevices();
|
||||
for (const device of devices) {
|
||||
await navigator.mediaDevices.getUserMedia(
|
||||
{video: {groupId: {exact: device.groupId}}}).then(stream => {
|
||||
const found_device = devices.find(({deviceId}) =>
|
||||
deviceId == stream.getTracks()[0].getSettings().deviceId);
|
||||
assert_not_equals(found_device, undefined);
|
||||
assert_equals(found_device.kind, "videoinput");
|
||||
assert_equals(found_device.groupId, device.groupId);
|
||||
}, error => {
|
||||
assert_equals(error.name, "OverconstrainedError");
|
||||
assert_equals(error.constraint, "groupId");
|
||||
const found_device = devices.find(element =>
|
||||
element.kind == "videoinput" && element.groupId == device.groupId);
|
||||
assert_equals(found_device, undefined);
|
||||
});
|
||||
}
|
||||
}, 'groupId is correctly supported by getUserMedia() for video devices');
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaDevices.enumerateDevices()
|
||||
.then(t.step_func(async devices => {
|
||||
for (var i in devices) {
|
||||
await navigator.mediaDevices.getUserMedia(
|
||||
{audio: {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, "audioinput");
|
||||
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 == "audioinput" &&
|
||||
element.groupId == devices[i].groupId});
|
||||
assert_true(undefined === found_device);
|
||||
}));
|
||||
}
|
||||
}));
|
||||
promise_test(async t => {
|
||||
assert_true(navigator.mediaDevices.getSupportedConstraints()["groupId"],
|
||||
"groupId should be supported");
|
||||
const devices = await navigator.mediaDevices.enumerateDevices();
|
||||
for (const device of devices) {
|
||||
await navigator.mediaDevices.getUserMedia(
|
||||
{audio: {groupId: {exact: device.groupId}}}).then(stream => {
|
||||
const found_device = devices.find(({deviceId}) =>
|
||||
deviceId == stream.getTracks()[0].getSettings().deviceId);
|
||||
assert_not_equals(found_device, undefined);
|
||||
assert_equals(found_device.kind, "audioinput");
|
||||
assert_equals(found_device.groupId, device.groupId);
|
||||
}, error => {
|
||||
assert_equals(error.name, "OverconstrainedError");
|
||||
assert_equals(error.constraint, "groupId");
|
||||
const found_device = devices.find(element =>
|
||||
element.kind == "audioinput" && element.groupId == device.groupId);
|
||||
assert_equals(found_device, undefined);
|
||||
});
|
||||
}
|
||||
}, 'groupId is correctly supported by getUserMedia() for audio devices');
|
||||
|
||||
promise_test(async t => {
|
||||
assert_true(navigator.mediaDevices.getSupportedConstraints()["resizeMode"],
|
||||
"resizeMode should be supported");
|
||||
const stream = await navigator.mediaDevices.getUserMedia(
|
||||
{ video: {resizeMode: {exact: 'none'}}});
|
||||
const [track] = stream.getVideoTracks();
|
||||
|
@ -102,6 +92,8 @@ promise_test(async t => {
|
|||
}, 'getUserMedia() supports setting none as resizeMode.');
|
||||
|
||||
promise_test(async t => {
|
||||
assert_true(navigator.mediaDevices.getSupportedConstraints()["resizeMode"],
|
||||
"resizeMode should be supported");
|
||||
const stream = await navigator.mediaDevices.getUserMedia(
|
||||
{ video: {resizeMode: {exact: 'crop-and-scale'}}});
|
||||
const [track] = stream.getVideoTracks();
|
||||
|
@ -110,8 +102,10 @@ promise_test(async t => {
|
|||
}, 'getUserMedia() supports setting crop-and-scale as resizeMode.');
|
||||
|
||||
promise_test(async t => {
|
||||
assert_true(navigator.mediaDevices.getSupportedConstraints()["resizeMode"],
|
||||
"resizeMode should be supported");
|
||||
try {
|
||||
let stream = await navigator.mediaDevices.getUserMedia(
|
||||
const stream = await navigator.mediaDevices.getUserMedia(
|
||||
{ video: {resizeMode: {exact: 'INVALID'}}});
|
||||
t.add_cleanup(() => stream.getVideoTracks()[0].stop());
|
||||
t.unreached_func('getUserMedia() should fail with invalid resizeMode')();
|
||||
|
|
|
@ -17,22 +17,34 @@ correctly set into inactive state when permission is revoked.</p>
|
|||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
var t = async_test("Tests that the video MediaStreamTrack objects are properly ended on permission revocation");
|
||||
t.step(function () {
|
||||
navigator.mediaDevices.getUserMedia({audio: true,video: true}).then(t.step_func(function (stream) {
|
||||
var vidTrack = stream.getVideoTracks()[0];
|
||||
assert_equals(vidTrack.readyState, "live", "The video track object is in live state");
|
||||
var audTrack = stream.getAudioTracks()[0];
|
||||
assert_equals(audTrack.readyState, "live", "The audio track object is in live state");
|
||||
vidTrack.onended = t.step_func(function () {
|
||||
assert_equals(vidTrack.readyState, "ended", "Video track has been ended as expected");
|
||||
assert_equals(audTrack.readyState, "ended", "Audio track has been ended as expected");
|
||||
assert_false(stream.active, "MediaStream has been inactive as expected");
|
||||
t.done();
|
||||
});
|
||||
}), function (error) {}
|
||||
);
|
||||
});
|
||||
'use strict';
|
||||
promise_test(async t => {
|
||||
const stream = await navigator.mediaDevices.getUserMedia({
|
||||
audio: true,
|
||||
video: true,
|
||||
});
|
||||
|
||||
const vidTrack = stream.getVideoTracks()[0];
|
||||
assert_equals(vidTrack.readyState, "live",
|
||||
"The video track object is in live state");
|
||||
const vidEnded = new Promise(r => vidTrack.onended = r);
|
||||
const audTrack = stream.getAudioTracks()[0];
|
||||
assert_equals(audTrack.readyState, "live",
|
||||
"The audio track object is in live state");
|
||||
const audEnded = new Promise(r => audTrack.onended = r);
|
||||
|
||||
await Promise.race([vidEnded, audEnded]);
|
||||
assert_equals(stream.getTracks().filter(t => t.readyState == "ended").length,
|
||||
1, "Only one track is ended after first track's ended event");
|
||||
assert_equals(stream.getTracks().filter(t => t.readyState == "live").length,
|
||||
1, "One track is still live after first track's ended event");
|
||||
assert_true(stream.active, "MediaStream is still active");
|
||||
|
||||
await Promise.all([vidEnded, audEnded]);
|
||||
assert_equals(vidTrack.readyState, "ended", "Video track ended as expected");
|
||||
assert_equals(audTrack.readyState, "ended", "Audio track ended as expected");
|
||||
assert_false(stream.active, "MediaStream has become inactive as expected");
|
||||
}, "Tests that MediaStreamTracks end properly on permission revocation");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -20,4 +20,14 @@ test(() => {
|
|||
const mediaStream = new MediaStream();
|
||||
assert_throws(new TypeError(), () => URL.createObjectURL(mediaStream));
|
||||
}, "Passing MediaStream to URL.createObjectURL() should throw");
|
||||
|
||||
test(() => {
|
||||
const mediaStream = new MediaStream();
|
||||
assert_false("onactive" in mediaStream);
|
||||
}, "MediaStream.onactive should not exist");
|
||||
|
||||
test(() => {
|
||||
const mediaStream = new MediaStream();
|
||||
assert_false("oninactive" in mediaStream);
|
||||
}, "MediaStream.oninactive should not exist");
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue