OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Geolocation On A Secure Origin</title> | 2 <title>Geolocation On A Secure Origin</title> |
3 <script src="/js-test-resources/mojo-helpers.js"></script> | 3 <script src="/js-test-resources/mojo-helpers.js"></script> |
4 <script src="/fast/dom/Geolocation/js-test-resources/geolocation-mock.js"></scri
pt> | 4 <script src="/geolocation-api/js-test-resources/geolocation-mock.js"></script> |
5 <script> | 5 <script> |
6 var mockLatitude = 51.478; | 6 var mockLatitude = 51.478; |
7 var mockLongitude = -0.166; | 7 var mockLongitude = -0.166; |
8 var mockAccuracy = 100.0; | 8 var mockAccuracy = 100.0; |
9 | 9 |
10 if (!window.mojo) | 10 if (!window.mojo) |
11 console.error('This test can not run without mojo'); | 11 console.error('This test can not run without mojo'); |
12 | 12 |
13 geolocationServiceMock.then(mock => { | 13 geolocationServiceMock.then(mock => { |
14 mock.setGeolocationPermission(true); | 14 mock.setGeolocationPermission(true); |
15 mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); | 15 mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); |
16 | 16 |
17 navigator.geolocation.getCurrentPosition( | 17 navigator.geolocation.getCurrentPosition( |
18 function () { | 18 function () { |
19 window.parent.postMessage({ success: true }, "*"); | 19 window.parent.postMessage({ success: true }, "*"); |
20 }, | 20 }, |
21 function (error) { | 21 function (error) { |
22 window.parent.postMessage({ message: error.message }, "*"); | 22 window.parent.postMessage({ message: error.message }, "*"); |
23 }, { maximumAge: 10000 }); | 23 }, { maximumAge: 10000 }); |
24 }); | 24 }); |
25 </script> | 25 </script> |
OLD | NEW |