Initialize Tizen 2.3
[framework/web/webkit-efl.git] / LayoutTests / inspector / geolocation-watchPosition.html
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script>
5
6 var mockLatitude = 51.478;
7 var mockLongitude = -0.166;
8 var mockAccuracy = 100;
9
10 if (window.testRunner) {
11     testRunner.setGeolocationPermission(true);
12     testRunner.setMockGeolocationPosition(mockLatitude,
13                                           mockLongitude,
14                                           mockAccuracy);
15 } else
16     debug('This test can not be run without the LayoutTestController');
17
18 var watch = 0;
19 function getGeolocation()
20 {
21     function printLocation(pos)
22     {
23         console.log('lat: ' + pos.coords.latitude + ', long: ' + pos.coords.longitude);
24     }
25     function printError(err)
26     {
27         console.log('Error: ' + err.code);
28     }
29     watch = navigator.geolocation.watchPosition(printLocation, printError, [])
30 }
31 function clearWatch()
32 {
33     navigator.geolocation.clearWatch(watch);
34 }
35
36 function test()
37 {
38     function callbackComplete()
39     {
40         InspectorTest.completeTest();
41     }
42     function callback()
43     {
44         InspectorTest.evaluateInPage("clearWatch()", callbackComplete);
45     }
46     function clearData()
47     {
48         PageAgent.clearGeolocationOverride();
49         setTimeout(callback, 1);
50     }
51     function setError()
52     {
53         PageAgent.setGeolocationOverride();
54         setTimeout(clearData, 1);
55     }
56     function setPosition()
57     {
58         PageAgent.setGeolocationOverride(43.476093, -80.540299, 150);
59         setTimeout(setError, 1);
60     }
61     InspectorTest.evaluateInPage("getGeolocation()", setPosition);
62 }
63 </script>
64 </head>
65 <body onload="runTest()">
66 <p>
67 </p>
68 </body>
69 </html>