| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Media Session IDL tests</title> |
| 6 <link rel="help" href="https://wicg.github.io/mediasession/"/> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script src="/resources/WebIDLParser.js"></script> |
| 10 <script src="/resources/idlharness.js"></script> |
| 11 </head> |
| 12 <body> |
| 13 <h1>Media Session IDL tests</h1> |
| 14 |
| 15 <pre id='untested_idl' style='display:none'> |
| 16 [PrimaryGlobal] |
| 17 interface Window { |
| 18 }; |
| 19 |
| 20 interface Navigator { |
| 21 }; |
| 22 </pre> |
| 23 |
| 24 <pre id='idl'> |
| 25 [Exposed=Window] |
| 26 partial interface Navigator { |
| 27 [SameObject] readonly attribute MediaSession mediaSession; |
| 28 }; |
| 29 |
| 30 enum MediaSessionPlaybackState { |
| 31 "none", |
| 32 "paused", |
| 33 "playing" |
| 34 }; |
| 35 |
| 36 enum MediaSessionAction { |
| 37 "play", |
| 38 "pause", |
| 39 "seekbackward", |
| 40 "seekforward", |
| 41 "previoustrack", |
| 42 "nexttrack", |
| 43 }; |
| 44 |
| 45 callback MediaSessionActionHandler = void(); |
| 46 |
| 47 [Exposed=Window] |
| 48 interface MediaSession { |
| 49 attribute MediaMetadata? metadata; |
| 50 |
| 51 attribute MediaSessionPlaybackState playbackState; |
| 52 |
| 53 void setActionHandler(MediaSessionAction action, MediaSessionActionHandler? ha
ndler); |
| 54 }; |
| 55 |
| 56 [Constructor(optional MediaMetadataInit init), Exposed=Window] |
| 57 interface MediaMetadata { |
| 58 attribute DOMString title; |
| 59 attribute DOMString artist; |
| 60 attribute DOMString album; |
| 61 attribute FrozenArray<MediaImage> artwork; |
| 62 }; |
| 63 |
| 64 dictionary MediaMetadataInit { |
| 65 DOMString title = ""; |
| 66 DOMString artist = ""; |
| 67 DOMString album = ""; |
| 68 sequence<MediaImage> artwork = []; |
| 69 }; |
| 70 |
| 71 dictionary MediaImage { |
| 72 required USVString src; |
| 73 DOMString sizes = ""; |
| 74 DOMString type = ""; |
| 75 }; |
| 76 </pre> |
| 77 <script> |
| 78 var idl_array = new IdlArray(); |
| 79 idl_array.add_untested_idls(document.getElementById("untested_idl").textContent)
; |
| 80 idl_array.add_idls(document.getElementById("idl").textContent); |
| 81 idl_array.add_objects({ |
| 82 MediaMetadata: [new MediaMetadata()], |
| 83 Navigator: ["navigator"] |
| 84 }); |
| 85 idl_array.test(); |
| 86 </script> |
| 87 <div id="log"></div> |
| 88 </body> |
| 89 </html> |
| OLD | NEW |