OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
4 <script> | |
5 | |
6 function testLocationMock() | |
7 { | |
8 function testSuccess() | |
9 { | |
10 console.log("Unexpected error occured. Test failed."); | |
11 } | |
12 | |
13 function testFailed() | |
14 { | |
15 console.log("PASSED."); | |
16 } | |
17 | |
18 var mockLatitude = 100; | |
19 var mockLongitude = 200; | |
20 var mockAccuracy = 94; | |
21 | |
22 if (window.internals) { | |
23 internals.setGeolocationPosition(document, mockLatitude, mockLongitude,
mockAccuracy); | |
24 navigator.geolocation.getCurrentPosition(testSuccess, testFailed); | |
25 } | |
26 } | |
27 | |
28 function setup() | |
29 { | |
30 if (window.internals) { | |
31 internals.setGeolocationClientMock(document); | |
32 internals.setGeolocationPermission(document, true); | |
33 } | |
34 } | |
35 | |
36 function test() | |
37 { | |
38 InspectorTest.runTestSuite([ | |
39 function setUp(next) | |
40 { | |
41 InspectorTest.evaluateInPage("setup()", next); | |
42 }, | |
43 | |
44 function setOverride(next) | |
45 { | |
46 InspectorTest.addConsoleSniffer(next); | |
47 GeolocationAgent.setGeolocationOverride(); | |
48 InspectorTest.evaluateInPage("testLocationMock()", next); | |
49 }, | |
50 | |
51 function clearOverride(next) | |
52 { | |
53 GeolocationAgent.clearGeolocationOverride(next); | |
54 } | |
55 ]); | |
56 } | |
57 </script> | |
58 </head> | |
59 <body onload="runTest()"> | |
60 <p> | |
61 Tests that geolocation emulation with latitude and longitude works as expected. | |
62 </p> | |
63 </body> | |
64 </html> | |
OLD | NEW |