3 <script src="../http/tests/inspector/inspector-test.js"></script>
6 var mockLatitude = 51.478;
7 var mockLongitude = -0.166;
8 var mockAccuracy = 100;
10 if (window.testRunner) {
11 testRunner.setGeolocationPermission(true);
12 testRunner.setMockGeolocationPosition(mockLatitude,
16 debug('This test can not be run without the LayoutTestController');
19 function getGeolocation()
21 function printLocation(pos)
23 console.log('lat: ' + pos.coords.latitude + ', long: ' + pos.coords.longitude);
25 function printError(err)
27 console.log('Error: ' + err.code);
29 watch = navigator.geolocation.watchPosition(printLocation, printError, [])
33 navigator.geolocation.clearWatch(watch);
38 function callbackComplete()
40 InspectorTest.completeTest();
44 InspectorTest.evaluateInPage("clearWatch()", callbackComplete);
48 PageAgent.clearGeolocationOverride();
49 setTimeout(callback, 1);
53 PageAgent.setGeolocationOverride();
54 setTimeout(clearData, 1);
56 function setPosition()
58 PageAgent.setGeolocationOverride(43.476093, -80.540299, 150);
59 setTimeout(setError, 1);
61 InspectorTest.evaluateInPage("getGeolocation()", setPosition);
65 <body onload="runTest()">