| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>Geolocation API IDL tests</title> |
| <link rel="author" title="Intel" href="http://www.intel.com"> |
| <link rel="help" href="http://www.w3.org/TR/geolocation-API/"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/resources/WebIDLParser.js"></script> |
| <script src="/resources/idlharness.js"></script> |
| |
| <h1>Geolocation API IDL tests</h1> |
| <div id="log"></div> |
| |
| <script type=text/plain class=untested> |
| interface Navigator { |
| }; |
| |
| typedef unsigned long long DOMTimeStamp; |
| </script> |
| |
| <script type=text/plain> |
| partial interface Navigator { |
| readonly attribute Geolocation geolocation; |
| }; |
| |
| [NoInterfaceObject] |
| interface Geolocation { |
| void getCurrentPosition(PositionCallback successCallback, |
| optional PositionErrorCallback errorCallback, |
| optional PositionOptions options); |
| |
| long watchPosition(PositionCallback successCallback, |
| optional PositionErrorCallback errorCallback, |
| optional PositionOptions options); |
| |
| void clearWatch(long watchId); |
| }; |
| |
| callback PositionCallback = void (Position position); |
| |
| callback PositionErrorCallback = void (PositionError positionError); |
| |
| dictionary PositionOptions { |
| boolean enableHighAccuracy = false; |
| [Clamp] unsigned long timeout = 0xFFFFFFFF; |
| [Clamp] unsigned long maximumAge = 0; |
| }; |
| |
| [NoInterfaceObject] |
| interface Position { |
| readonly attribute Coordinates coords; |
| readonly attribute DOMTimeStamp timestamp; |
| }; |
| |
| [NoInterfaceObject] |
| interface Coordinates { |
| readonly attribute double latitude; |
| readonly attribute double longitude; |
| readonly attribute double? altitude; |
| readonly attribute double accuracy; |
| readonly attribute double? altitudeAccuracy; |
| readonly attribute double? heading; |
| readonly attribute double? speed; |
| }; |
| |
| [NoInterfaceObject] |
| interface PositionError { |
| const unsigned short PERMISSION_DENIED = 1; |
| const unsigned short POSITION_UNAVAILABLE = 2; |
| const unsigned short TIMEOUT = 3; |
| readonly attribute unsigned short code; |
| readonly attribute DOMString message; |
| }; |
| </script> |
| |
| <script> |
| "use strict"; |
| var idlArray; |
| setup(function() { |
| idlArray = new IdlArray(); |
| [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) { |
| if (node.className == "untested") { |
| idlArray.add_untested_idls(node.textContent); |
| } else { |
| idlArray.add_idls(node.textContent); |
| } |
| }); |
| idlArray.add_objects({ |
| Navigator: ["navigator"], |
| Geolocation: ["navigator.geolocation"] |
| }); |
| }); |
| idlArray.test(); |
| </script> |
| |