forked from web-platform-tests/wpt
/
idlharness.html
40 lines (38 loc) · 1.4 KB
/
idlharness.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Media Recorder IDL test</title>
<link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html">
<link rel="idl" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#idl-index">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<canvas id='canvas' width=10 height=10/>
<script>
promise_test(async () => {
const srcs = ['mediacapture-record', 'mediacapture-main', 'html', 'dom'];
const [idl, main, html, dom] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
var canvas = document.getElementById('canvas');
var context = canvas.getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, 10, 10);
var stream = canvas.captureStream();
var idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(main);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(dom);
idl_array.add_objects({
MediaRecorder: [new MediaRecorder(stream)],
});
idl_array.test();
}, 'mediacapture-record interfaces');
</script>
<div id="log"></div>
</body>
</html>