OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>Gyroscope Sensor IDL tests</title> |
| 4 <link rel="author" title="Intel" href="http://www.intel.com"> |
| 5 <link rel="help" href="https://www.w3.org/TR/gyroscope/"> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 <script src="/resources/WebIDLParser.js"></script> |
| 9 <script src="/resources/idlharness.js"></script> |
| 10 <style> |
| 11 pre { |
| 12 display: none; |
| 13 } |
| 14 </style> |
| 15 <div id="log"></div> |
| 16 |
| 17 <pre id="idl"> |
| 18 interface Event { |
| 19 }; |
| 20 |
| 21 interface EventTarget { |
| 22 }; |
| 23 |
| 24 interface EventHandler { |
| 25 }; |
| 26 |
| 27 interface Error { |
| 28 }; |
| 29 |
| 30 dictionary EventInit { |
| 31 }; |
| 32 </pre> |
| 33 |
| 34 <pre id="generic-idl"> |
| 35 [SecureContext] |
| 36 interface Sensor : EventTarget { |
| 37 readonly attribute SensorState state; |
| 38 readonly attribute SensorReading? reading; |
| 39 void start(); |
| 40 void stop(); |
| 41 attribute EventHandler onchange; |
| 42 attribute EventHandler onactivate; |
| 43 attribute EventHandler onerror; |
| 44 }; |
| 45 |
| 46 dictionary SensorOptions { |
| 47 double? frequency; |
| 48 }; |
| 49 |
| 50 enum SensorState { |
| 51 "idle", |
| 52 "activating", |
| 53 "activated", |
| 54 "errored" |
| 55 }; |
| 56 |
| 57 [SecureContext] |
| 58 interface SensorReading { |
| 59 readonly attribute DOMHighResTimeStamp timeStamp; |
| 60 }; |
| 61 |
| 62 [SecureContext, Constructor(DOMString type, SensorErrorEventInit errorEventInitD
ict)] |
| 63 interface SensorErrorEvent : Event { |
| 64 readonly attribute Error error; |
| 65 }; |
| 66 |
| 67 dictionary SensorErrorEventInit : EventInit { |
| 68 required Error error; |
| 69 }; |
| 70 |
| 71 </pre> |
| 72 |
| 73 <pre id="gyroscope-idl"> |
| 74 [Constructor(optional SensorOptions sensorOptions)] |
| 75 interface Gyroscope : Sensor { |
| 76 readonly attribute GyroscopeReading? reading; |
| 77 }; |
| 78 |
| 79 [Constructor(GyroscopeReadingInit GyroscopeReadingInit)] |
| 80 interface GyroscopeReading : SensorReading { |
| 81 readonly attribute unrestricted double x; |
| 82 readonly attribute unrestricted double y; |
| 83 readonly attribute unrestricted double z; |
| 84 }; |
| 85 |
| 86 dictionary GyroscopeReadingInit { |
| 87 unrestricted double x = 0; |
| 88 unrestricted double y = 0; |
| 89 unrestricted double z = 0; |
| 90 }; |
| 91 </pre> |
| 92 |
| 93 <script> |
| 94 (function() { |
| 95 "use strict"; |
| 96 var idl_array = new IdlArray(); |
| 97 idl_array.add_untested_idls(document.getElementById('idl').textContent); |
| 98 idl_array.add_untested_idls(document.getElementById('generic-idl').textContent
); |
| 99 idl_array.add_idls(document.getElementById('gyroscope-idl').textContent); |
| 100 |
| 101 idl_array.add_objects({ |
| 102 Gyroscope: ['new Gyroscope();'], |
| 103 GyroscopeReading: ['new GyroscopeReading({x: 0.5, y: 0.5, z: 0.5});'] |
| 104 }); |
| 105 |
| 106 idl_array.test(); |
| 107 })(); |
| 108 </script> |
OLD | NEW |