Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: LayoutTests/imported/web-platform-tests/FileAPI/idlharness.html

Issue 1236713002: Import FileAPI tests from web-platform-tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>File API automated IDL tests</title>
6 <link rel="author" title="Intel" href="http://www.intel.com">
7 <link rel="help" href="http://dev.w3.org/2006/webapi/FileAPI/#conformance">
8 <script src="../../../resources/testharness.js"></script>
9 <script src="../../../resources/testharnessreport.js"></script>
10 <script src="../../../resources/WebIDLParser.js"></script>
11 <script src="../../../resources/idlharness.js"></script>
12 </head>
13 <body>
14 <h1>File API automated IDL tests</h1>
15
16 <div id="log"></div>
17
18 <pre id="untested_idl" style="display: none">
19 interface ArrayBuffer {
20 };
21
22 interface ArrayBufferView {
23 };
24
25 interface URL {
26 };
27
28 interface EventTarget {
29 };
30
31 interface Event {
32 };
33
34 [TreatNonCallableAsNull]
35 callback EventHandlerNonNull = any (Event event);
36 typedef EventHandlerNonNull? EventHandler;
37 </pre>
38
39 <pre id="idl" style="display: none">
40 [Constructor,
41 Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blo bParts, optional BlobPropertyBag options), Exposed=Window,Worker]
42 interface Blob {
43
44 readonly attribute unsigned long long size;
45 readonly attribute DOMString type;
46 readonly attribute boolean isClosed;
47
48 //slice Blob into byte-ranged chunks
49
50 Blob slice([Clamp] optional long long start,
51 [Clamp] optional long long end,
52 optional DOMString contentType);
53 void close();
54
55 };
56
57 dictionary BlobPropertyBag {
58 DOMString type = "";
59 };
60
61 [Constructor(sequence<(Blob or DOMString or ArrayBufferView or ArrayBuffer)> fil eBits,
62 [EnsureUTF16] DOMString fileName, optional FilePropertyBag options), Exposed=Win dow,Worker]
63 interface File : Blob {
64
65 readonly attribute DOMString name;
66 readonly attribute long long lastModified;
67
68 };
69
70 dictionary FilePropertyBag {
71
72 DOMString type = "";
73 long long lastModified;
74
75 };
76
77 [Exposed=Window,Worker] interface FileList {
78 getter File? item(unsigned long index);
79 readonly attribute unsigned long length;
80 };
81
82 [Constructor, Exposed=Window,Worker]
83 interface FileReader: EventTarget {
84
85 // async read methods
86 void readAsArrayBuffer(Blob blob);
87 void readAsText(Blob blob, optional DOMString label);
88 void readAsDataURL(Blob blob);
89
90 void abort();
91
92 // states
93 const unsigned short EMPTY = 0;
94 const unsigned short LOADING = 1;
95 const unsigned short DONE = 2;
96
97 readonly attribute unsigned short readyState;
98
99 // File or Blob data
100 readonly attribute (DOMString or ArrayBuffer)? result;
101
102 readonly attribute DOMError? error;
103
104 // event handler attributes
105 attribute EventHandler onloadstart;
106 attribute EventHandler onprogress;
107 attribute EventHandler onload;
108 attribute EventHandler onabort;
109 attribute EventHandler onerror;
110 attribute EventHandler onloadend;
111
112 };
113
114 [Constructor, Exposed=Worker]
115 interface FileReaderSync {
116
117 // Synchronously return strings
118
119 ArrayBuffer readAsArrayBuffer(Blob blob);
120 DOMString readAsText(Blob blob, optional DOMString label);
121 DOMString readAsDataURL(Blob blob);
122 };
123
124 partial interface URL {
125
126 static DOMString createObjectURL(Blob blob);
127 static DOMString createFor(Blob blob);
128 static void revokeObjectURL(DOMString url);
129
130 };
131
132 </pre>
133
134 <form name="uploadData">
135 <input type="file" id="fileChooser">
136 </form>
137
138 <script>
139 var idl_array, file_input;
140
141 setup(function() {
142 file_input = document.querySelector("#fileChooser");
143 idl_array = new IdlArray();
144 idl_array.add_untested_idls(document.getElementById("untested_idl").text Content);
145 idl_array.add_idls(document.getElementById("idl").textContent);
146
147 idl_array.add_objects({
148 Blob: ['new Blob(["TEST"])'],
149 File: ['new File(["myFileBits"], "myFileName")'],
150 FileList: ['file_input.files'],
151 FileReader: ['new FileReader()']
152 });
153 });
154
155 idl_array.test();
156 </script>
157 </body>
158 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698