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