forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathidlharness.html
123 lines (98 loc) · 3.38 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>File API automated IDL tests</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="http://dev.w3.org/2006/webapi/FileAPI/#conformance">
<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>
<h1>File API automated IDL tests</h1>
<div id="log"></div>
<pre id="untested_idl" style="display: none">
interface ArrayBuffer {
};
interface ArrayBufferView {
};
interface URL {
};
interface EventTarget {
};
interface Event {
};
[TreatNonCallableAsNull]
callback EventHandlerNonNull = any (Event event);
typedef EventHandlerNonNull? EventHandler;
</pre>
<pre id="idl" style="display: none">
interface FileList {
getter File? item(unsigned long index);
readonly attribute unsigned long length;
};
[Constructor,
Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blobParts, optional BlobPropertyBag options)]
interface Blob {
readonly attribute unsigned long long size;
readonly attribute DOMString type;
//slice Blob into byte-ranged chunks
Blob slice(optional long long start,
optional long long end,
optional DOMString contentType);
void close();
};
dictionary BlobPropertyBag {
DOMString type = "";
};
[Constructor(Blob fileBits, DOMString fileName)]
interface File : Blob {
readonly attribute DOMString name;
readonly attribute Date lastModifiedDate;
};
[Constructor]
interface FileReader: EventTarget {
// async read methods
void readAsArrayBuffer(Blob blob);
void readAsText(Blob blob, optional DOMString label);
void readAsDataURL(Blob blob);
void abort();
// states
const unsigned short EMPTY = 0;
const unsigned short LOADING = 1;
const unsigned short DONE = 2;
readonly attribute unsigned short readyState;
// File or Blob data
readonly attribute (DOMString or ArrayBuffer)? result;
readonly attribute DOMError? error;
// event handler attributes
attribute EventHandler onloadstart;
attribute EventHandler onprogress;
attribute EventHandler onload;
attribute EventHandler onabort;
attribute EventHandler onerror;
attribute EventHandler onloadend;
};
partial interface URL {
static DOMString? createObjectURL(Blob blob);
static DOMString? createFor(Blob blob); // static DOMString? createFor()Blob blob);
static void revokeObjectURL(DOMString url);
};
</pre>
<script>
var idl_array;
setup(function() {
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({
Blob: [new Blob(["TEST"])],
FileReader: [new FileReader()]
});
});
idl_array.test();
</script>
</body>
</html>