forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidlharness.html
99 lines (87 loc) · 3.03 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!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/>
<pre id="untested_idl" style="display: none">
interface Event {};
interface EventHandler {};
interface EventTarget {};
interface MediaStream {};
</pre>
<pre id="idl" style="display: none">
// https://w3c.github.io/mediacapture-record/MediaRecorder.html
[Constructor(MediaStream stream, optional MediaRecorderOptions options)]
interface MediaRecorder : EventTarget {
readonly attribute MediaStream stream;
readonly attribute DOMString mimeType;
readonly attribute RecordingState state;
attribute EventHandler onstart;
attribute EventHandler onstop;
attribute EventHandler ondataavailable;
attribute EventHandler onpause;
attribute EventHandler onresume;
attribute EventHandler onerror;
readonly attribute unsigned long videoBitsPerSecond;
readonly attribute unsigned long audioBitsPerSecond;
void start(optional long timeslice);
void stop();
void pause();
void resume();
void requestData();
static boolean isTypeSupported(DOMString type);
};
dictionary MediaRecorderOptions {
DOMString mimeType;
unsigned long audioBitsPerSecond;
unsigned long videoBitsPerSecond;
unsigned long bitsPerSecond;
};
enum RecordingState {
"inactive",
"recording",
"paused"
};
[Constructor(DOMString type, BlobEventInit eventInitDict)]
interface BlobEvent : Event {
[SameObject] readonly attribute Blob data;
readonly attribute DOMHighResTimeStamp timecode;
};
dictionary BlobEventInit {
required Blob data;
DOMHighResTimeStamp timecode;
};
dictionary MediaRecorderErrorEventInit : EventInit {
required DOMException error;
};
[Exposed=Window, Constructor(DOMString type, MediaRecorderErrorEventInit eventInitDict)]
interface MediaRecorderErrorEvent : Event {
[SameObject] readonly attribute DOMException error;
};
</pre>
<script>
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_untested_idls(document.getElementById("untested_idl").textContent);
idl_array.add_idls(document.getElementById("idl").textContent);
idl_array.add_objects({
MediaRecorder: [new MediaRecorder(stream)],
});
idl_array.test();
</script>
<div id="log"></div>
</body>
</html>