| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <script src="../../../resources/js-test-pre.js"></script> |
| description("Tests that Geoposition timestamps are well-formed (non-zero and in the same units as Date.getTime)."); |
| var mockLatitude = 51.478; |
| var mockLongitude = -0.166; |
| var mockAccuracy = 100.0; |
| testRunner.setGeolocationPermission(true); |
| testRunner.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); |
| var now = new Date().getTime(); |
| shouldBeTrue('now != 0'); |
| function checkPosition(p) { |
| shouldBeTrue('then != 0'); |
| shouldBeTrue('now - 1 <= t'); // Avoid rounding errors |
| debug(" now - 1 = " + (now-1)); |
| shouldBeTrue('t <= then + 1'); // Avoid rounding errors |
| navigator.geolocation.getCurrentPosition(checkPosition); |
| window.jsTestIsAsync = true; |
| <script src="../../../resources/js-test-post.js"></script> |