Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Geolocation / script-tests / position-string.js
blob3c332f66f15017b723070a0e135717cd5650e369
1 description("Tests formatting of position.toString().");
3 var mockLatitude = 51.478;
4 var mockLongitude = -0.166;
5 var mockAccuracy = 100.0;
7 if (!window.testRunner || !window.internals)
8 debug('This test can not run without testRunner or internals');
10 internals.setGeolocationClientMock(document);
11 internals.setGeolocationPermission(document, true);
12 internals.setGeolocationPosition(document,
13 mockLatitude,
14 mockLongitude,
15 mockAccuracy);
17 var position;
18 navigator.geolocation.getCurrentPosition(function(p) {
19 // shouldBe can't use local variables yet.
20 position = p;
21 shouldBe('position.coords.latitude', 'mockLatitude');
22 shouldBe('position.coords.longitude', 'mockLongitude');
23 shouldBe('position.coords.accuracy', 'mockAccuracy');
24 shouldBe('position.toString()', '"[object Geoposition]"');
25 shouldBe('position.coords.toString()', '"[object Coordinates]"');
26 finishJSTest();
27 }, function(e) {
28 testFailed('Error callback invoked unexpectedly');
29 finishJSTest();
30 });
32 window.jsTestIsAsync = true;