OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <title>Background Fetch IDL tests</title> | 5 <title>Background Fetch IDL tests</title> |
6 <script src=/resources/testharness.js></script> | 6 <script src=/resources/testharness.js></script> |
7 <script src=/resources/testharnessreport.js></script> | 7 <script src=/resources/testharnessreport.js></script> |
8 <script src=/resources/WebIDLParser.js></script> | 8 <script src=/resources/WebIDLParser.js></script> |
9 <script src=/resources/idlharness.js></script> | 9 <script src=/resources/idlharness.js></script> |
10 </head> | 10 </head> |
11 <body> | 11 <body> |
12 <!-- Setup --> | 12 <!-- Setup --> |
13 <script type=text/plain id='untested_idl'> | 13 <script type=text/plain id='untested_idl'> |
14 interface ServiceWorkerGlobalScope { | |
15 }; | |
16 interface ServiceWorkerRegistration { | 14 interface ServiceWorkerRegistration { |
17 }; | 15 }; |
18 </script> | 16 </script> |
19 <script type=text/plain id='idl_for_testing'> | 17 <script type=text/plain id='idl_for_testing'> |
20 partial interface ServiceWorkerGlobalScope { | |
21 attribute EventHandler onbackgroundfetched; | |
22 attribute EventHandler onbackgroundfetchfail; | |
23 attribute EventHandler onbackgroundfetchabort; | |
24 attribute EventHandler onbackgroundfetchclick; | |
25 }; | |
26 | |
27 partial interface ServiceWorkerRegistration { | 18 partial interface ServiceWorkerRegistration { |
28 readonly attribute BackgroundFetchManager backgroundFetch; | 19 readonly attribute BackgroundFetchManager backgroundFetch; |
29 }; | 20 }; |
30 | 21 |
31 [Exposed=(Window,Worker)] | 22 [Exposed=(Window,Worker)] |
32 interface BackgroundFetchManager { | 23 interface BackgroundFetchManager { |
33 Promise<BackgroundFetchRegistration> fetch(DOMString tag, | 24 // TODO(awdf) Add fetch & get methods. |
34 (RequestInfo or sequence<RequestInfo>) requests, | 25 |
35 optional BackgroundFetchOptions options); | 26 // TODO(awdf) getTags returned promise should contain a FrozenArray. |
36 Promise<BackgroundFetchRegistration?> get(DOMString tag); | 27 Promise<DOMString> getTags(); |
37 Promise<sequence<DOMString>> getTags(); | |
38 }; | 28 }; |
39 | |
40 dictionary IconDefinition { | |
41 DOMString src; | |
42 DOMString sizes; | |
43 DOMString type; | |
44 }; | |
45 | |
46 dictionary BackgroundFetchOptions { | |
47 sequence<IconDefinition> icons; | |
48 DOMString title; | |
49 long totalDownloadSize; | |
50 }; | |
51 | |
52 [Exposed=(Window,Worker)] | |
53 interface BackgroundFetchActiveFetches : BackgroundFetchFetches { | |
54 readonly attribute Promise<Response> responseReady; | |
55 }; | |
56 | |
57 [Exposed=(Window,Worker)] | |
58 interface BackgroundFetchRegistration { | |
59 readonly attribute DOMString tag; | |
60 readonly attribute FrozenArray<IconDefinition> icons; | |
61 readonly attribute long totalDownloadSize; | |
62 readonly attribute DOMString title; | |
63 readonly attribute FrozenArray<BackgroundFetchActiveFetches> fetches; | |
64 | |
65 void abort(); | |
66 }; | |
67 | |
68 [Exposed=(Window,Worker)] | |
69 interface BackgroundFetchFetches { | |
70 readonly attribute Request request; | |
71 }; | |
72 | |
73 </script> | 29 </script> |
74 | 30 |
75 <!-- Tests --> | 31 <!-- Tests --> |
76 <script> | 32 <script> |
77 var idl_array = new IdlArray(); | 33 var idl_array = new IdlArray(); |
78 idl_array.add_untested_idls( | 34 idl_array.add_untested_idls( |
79 document.getElementById('untested_idl').textContent); | 35 document.getElementById('untested_idl').textContent); |
80 idl_array.add_idls( | 36 idl_array.add_idls( |
81 document.getElementById('idl_for_testing').textContent); | 37 document.getElementById('idl_for_testing').textContent); |
82 idl_array.test(); | 38 idl_array.test(); |
83 | 39 |
84 </script> | 40 </script> |
85 </body> | 41 </body> |
86 </html> | 42 </html> |
OLD | NEW |