blob: 0705ec4120ade174ddffa64ddd2ac5d0ae14f100 [file] [log] [blame]
[email protected]624675e2009-09-10 13:26:401<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<head>
tkentc5e88f02017-02-06 22:47:314<script src="../resources/js-test.js"></script>
Reilly Grantbe310ab2017-07-11 01:51:265<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>
sammce6687802016-05-13 04:06:578<script src="resources/geolocation-mock.js"></script>
[email protected]624675e2009-09-10 13:26:409</head>
10<body>
tkent98122ee2017-02-02 07:38:5111<script>
12description("Tests formatting of position.toString().");
13
14var mockLatitude = 51.478;
15var mockLongitude = -0.166;
16var mockAccuracy = 100.0;
17
18var position;
19
Reilly Grantbe310ab2017-07-11 01:51:2620let mock = geolocationMock;
21mock.setGeolocationPermission(true);
22mock.setGeolocationPosition(mockLatitude,
23 mockLongitude,
24 mockAccuracy);
tkent98122ee2017-02-02 07:38:5125
Reilly Grantbe310ab2017-07-11 01:51:2626navigator.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();
tkent98122ee2017-02-02 07:38:5138});
39
40window.jsTestIsAsync = true;
41</script>
[email protected]624675e2009-09-10 13:26:4042</body>
43</html>