mirror of
https://github.com/servo/servo.git
synced 2025-09-11 07:28:19 +01:00
Update web-platform-tests to revision 60220357131c65146444da1f54624d5b54d0975d
This commit is contained in:
parent
c45192614c
commit
775b784f79
2144 changed files with 58115 additions and 29658 deletions
|
@ -1,3 +1,4 @@
|
|||
spec: https://w3c.github.io/mediacapture-main/
|
||||
suggested_reviewers:
|
||||
- agouaillard
|
||||
- alvestrand
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia: Non-Interactive test for mediaDevices APIs</title>
|
||||
<link rel="author" title="Dr Alex Gouaillard" href="mailto:agouaillard@gmail.com"/>
|
||||
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#mediadevices">
|
||||
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#mediadevices-interface-extensions">
|
||||
<meta name='assert' content='Check the mediaDevices APIs.'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks for the presence of the
|
||||
<code>navigator.mediaDevices.getUserMedia</code> method.</p>
|
||||
<div id='log'></div>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/WebIDLParser.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test(async () => {
|
||||
const main = await fetch('/interfaces/mediacapture-main.idl').then(r => r.text());
|
||||
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
|
||||
const html = await fetch('/interfaces/html.idl').then(r => r.text());
|
||||
|
||||
var idl_array = new IdlArray();
|
||||
idl_array.add_idls(main);
|
||||
idl_array.add_dependency_idls(html);
|
||||
idl_array.add_dependency_idls(dom);
|
||||
idl_array.add_objects({
|
||||
Navigator: ["navigator"],
|
||||
MediaDevices: ["navigator.mediaDevices"]
|
||||
});
|
||||
idl_array.test();
|
||||
}, 'Test driver')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,64 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>enumerateDevices: test that enumerateDevices is present</title>
|
||||
<link rel="author" title="Dr Alex Gouaillard" href="mailto:agouaillard@gmail.com"/>
|
||||
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#methods-2">
|
||||
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#device-info">
|
||||
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-MediaDeviceKind">
|
||||
<meta name='assert' content='Check that the enumerateDevices() method is present.'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks for the presence of the
|
||||
<code>navigator.mediaDevices.enumerateDevices()</code> method.</p>
|
||||
<div id='log'></div>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/WebIDLParser.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
promise_test(async () => {
|
||||
const idl = await fetch(`/interfaces/mediacapture-main.idl`).then(r => r.text());
|
||||
const dom = await fetch(`/interfaces/dom.idl`).then(r => r.text());
|
||||
const html = await fetch(`/interfaces/html.idl`).then(r => r.text());
|
||||
|
||||
const MDI_idl = new IdlArray();
|
||||
MDI_idl.add_idls(idl);
|
||||
MDI_idl.add_dependency_idls(html);
|
||||
MDI_idl.add_dependency_idls(dom);
|
||||
|
||||
assert_true(undefined !== navigator.mediaDevices.enumerateDevices,
|
||||
"navigator.mediaDevices.enumerateDevices exists");
|
||||
|
||||
return navigator.mediaDevices.enumerateDevices()
|
||||
.then(function(list) {
|
||||
if( list.length > 0 ) {
|
||||
var kind = list[0].kind;
|
||||
if (kind == "audioinput" ||
|
||||
kind == "videoinput") {
|
||||
MDI_idl.add_objects({InputDeviceInfo: [list[0]]});
|
||||
} else if (kind == "audiooutput" ) {
|
||||
MDI_idl.add_objects({MediaDeviceInfo: [list[0]]});
|
||||
}
|
||||
}
|
||||
|
||||
for(const media of list) {
|
||||
if (media.kind == "audioinput" ||
|
||||
media.kind == "videoinput") {
|
||||
// TODO -- Check InputDeviceInfo IDL, getCapabilities()
|
||||
} else if (media.kind == "audiooutput" ) {
|
||||
// TODO -- pass
|
||||
} else {
|
||||
assert_unreached("media.kind should be one of 'audioinput', 'videoinput', or 'audiooutput'.")
|
||||
}
|
||||
}
|
||||
|
||||
MDI_idl.test();
|
||||
});
|
||||
}, "Test MediaDevices.enumerateDevices call and result. Types only.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,52 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>MediaStreamTrack IDL tests</title>
|
||||
<link rel="help" href="https://w3c.github.io/mediacapture-main/#media-stream-track-interface-definition">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/WebIDLParser.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script>
|
||||
function idl_test([dom_idl, stream]) {
|
||||
const idl_array = new IdlArray();
|
||||
|
||||
idl_array.add_untested_idls(dom_idl);
|
||||
idl_array.add_untested_idls('interface EventHandler {};');
|
||||
idl_array.add_idls("interface MediaStreamTrack : EventTarget {\
|
||||
readonly attribute DOMString kind;\
|
||||
readonly attribute DOMString id;\
|
||||
readonly attribute DOMString label;\
|
||||
attribute boolean enabled;\
|
||||
readonly attribute boolean muted;\
|
||||
attribute EventHandler onmute;\
|
||||
attribute EventHandler onunmute;\
|
||||
readonly attribute MediaStreamTrackState readyState;\
|
||||
attribute EventHandler onended;\
|
||||
attribute EventHandler onoverconstrained;\
|
||||
MediaStreamTrack clone ();\
|
||||
void stop ();\
|
||||
MediaTrackCapabilities getCapabilities ();\
|
||||
MediaTrackConstraints getConstraints ();\
|
||||
MediaTrackSettings getSettings ();\
|
||||
Promise<void> applyConstraints (optional MediaTrackConstraints constraints);\
|
||||
};\
|
||||
\
|
||||
enum MediaStreamTrackState {\
|
||||
\"live\",\
|
||||
\"ended\"\
|
||||
};");
|
||||
|
||||
self.track = stream.getTracks()[0];
|
||||
idl_array.add_objects({MediaStreamTrack: ["track"]});
|
||||
|
||||
idl_array.test();
|
||||
}
|
||||
|
||||
promise_test(() => {
|
||||
return Promise.all([
|
||||
fetch("/interfaces/dom.idl").then(response => response.text()),
|
||||
navigator.mediaDevices.getUserMedia({audio: true}),
|
||||
]).then(idl_test);
|
||||
}, "Test driver")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,60 @@
|
|||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
'use strict';
|
||||
|
||||
// https://w3c.github.io/mediacapture-main/
|
||||
|
||||
|
||||
promise_test(async () => {
|
||||
const srcs = ['mediacapture-streams','dom','html'];
|
||||
const [idl, dom, html] = await Promise.all(
|
||||
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
|
||||
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(idl);
|
||||
idl_array.add_dependency_idls(html);
|
||||
idl_array.add_dependency_idls(dom);
|
||||
|
||||
let input, media;
|
||||
// Errors will be surfaced in idlharness.js's test_object below.
|
||||
try {
|
||||
const list = await navigator.mediaDevices.enumerateDevices();
|
||||
for (const item of list) {
|
||||
switch (item.kind) {
|
||||
case 'audioinput':
|
||||
case 'videoinput':
|
||||
input = item;
|
||||
case 'audiooutput':
|
||||
media = item;
|
||||
default:
|
||||
assert_unreached(
|
||||
'media.kind should be one of "audioinput", "videoinput", or "audiooutput".');
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
let track, trackEvent;
|
||||
try {
|
||||
const stream = await navigator.mediaDevices.getUserMedia({audio: true});
|
||||
track = stream.getTracks()[0];
|
||||
trackEvent = new MediaStreamTrackEvent("type", {
|
||||
track: track,
|
||||
});
|
||||
} catch (e) { throw e}
|
||||
|
||||
if (input) {
|
||||
idl_array.add_objects({ InputDeviceInfo: [input] });
|
||||
} else {
|
||||
idl_array.add_objects({ MediaDeviceInfo: [media] });
|
||||
}
|
||||
idl_array.add_objects({
|
||||
MediaStream: ['new MediaStream()'],
|
||||
Navigator: ['navigator'],
|
||||
MediaDevices: ['navigator.mediaDevices'],
|
||||
MediaStreamTrack: [track],
|
||||
MediaStreamTrackEvent: [trackEvent],
|
||||
OverconstrainedErrorEvent: ['new OverconstrainedErrorEvent("type", {})'],
|
||||
});
|
||||
idl_array.test();
|
||||
}, 'mediacapture-streams interfaces.');
|
Loading…
Add table
Add a link
Reference in a new issue