[email protected] | 624675e | 2009-09-10 13:26:40 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 | <html> |
| 3 | <head> |
tkent | c5e88f0 | 2017-02-06 22:47:31 | [diff] [blame] | 4 | <script src="../resources/js-test.js"></script> |
Reilly Grant | be310ab | 2017-07-11 01:51:26 | [diff] [blame] | 5 | <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> |
| 6 | <script src="file:///gen/device/geolocation/public/interfaces/geolocation.mojom.js"></script> |
| 7 | <script src="file:///gen/third_party/WebKit/public/platform/modules/permissions/permission.mojom.js"></script> |
sammc | e668780 | 2016-05-13 04:06:57 | [diff] [blame] | 8 | <script src="resources/geolocation-mock.js"></script> |
[email protected] | 624675e | 2009-09-10 13:26:40 | [diff] [blame] | 9 | </head> |
| 10 | <body> |
tkent | 98122ee | 2017-02-02 07:38:51 | [diff] [blame] | 11 | <script> |
| 12 | description("Tests formatting of position.toString()."); |
| 13 | |
| 14 | var mockLatitude = 51.478; |
| 15 | var mockLongitude = -0.166; |
| 16 | var mockAccuracy = 100.0; |
| 17 | |
| 18 | var position; |
| 19 | |
Reilly Grant | be310ab | 2017-07-11 01:51:26 | [diff] [blame] | 20 | let mock = geolocationMock; |
| 21 | mock.setGeolocationPermission(true); |
| 22 | mock.setGeolocationPosition(mockLatitude, |
| 23 | mockLongitude, |
| 24 | mockAccuracy); |
tkent | 98122ee | 2017-02-02 07:38:51 | [diff] [blame] | 25 | |
Reilly Grant | be310ab | 2017-07-11 01:51:26 | [diff] [blame] | 26 | navigator.geolocation.getCurrentPosition(function(p) { |
| 27 | // shouldBe can't use local variables yet. |
| 28 | position = p; |
| 29 | shouldBe('position.coords.latitude', 'mockLatitude'); |
| 30 | shouldBe('position.coords.longitude', 'mockLongitude'); |
| 31 | shouldBe('position.coords.accuracy', 'mockAccuracy'); |
| 32 | shouldBe('position.toString()', '"[object Position]"'); |
| 33 | shouldBe('position.coords.toString()', '"[object Coordinates]"'); |
| 34 | finishJSTest(); |
| 35 | }, function(e) { |
| 36 | testFailed('Error callback invoked unexpectedly'); |
| 37 | finishJSTest(); |
tkent | 98122ee | 2017-02-02 07:38:51 | [diff] [blame] | 38 | }); |
| 39 | |
| 40 | window.jsTestIsAsync = true; |
| 41 | </script> |
[email protected] | 624675e | 2009-09-10 13:26:40 | [diff] [blame] | 42 | </body> |
| 43 | </html> |