| 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(position) | |
| 9 { | |
| 10 if (position.message) console.log("Error " + position.message) | |
| 11 else console.log("Latitude: " + position.coords.latitude + " Longitude:
" + position.coords.longitude); | |
| 12 } | |
| 13 | |
| 14 function testFailed() | |
| 15 { | |
| 16 console.log("Unexpected error occured. Test failed."); | |
| 17 } | |
| 18 | |
| 19 var mockLatitude = 100; | |
| 20 var mockLongitude = 200; | |
| 21 var mockAccuracy = 94; | |
| 22 | |
| 23 internals.setGeolocationPosition(document, mockLatitude, mockLongitude, mock
Accuracy); | |
| 24 navigator.geolocation.getCurrentPosition(testSuccess, testFailed); | |
| 25 } | |
| 26 | |
| 27 function setup() | |
| 28 { | |
| 29 if (window.internals) { | |
| 30 internals.setGeolocationClientMock(document); | |
| 31 internals.setGeolocationPermission(document, true); | |
| 32 } | |
| 33 } | |
| 34 | |
| 35 function test() | |
| 36 { | |
| 37 InspectorTest.runTestSuite([ | |
| 38 function setUp(next) | |
| 39 { | |
| 40 InspectorTest.evaluateInPage("setup()", next); | |
| 41 }, | |
| 42 | |
| 43 function setOverride(next) | |
| 44 { | |
| 45 InspectorTest.addConsoleSniffer(next); | |
| 46 // Invalid position params | |
| 47 GeolocationAgent.setGeolocationOverride(false, 0, 0); | |
| 48 GeolocationAgent.setGeolocationOverride(0, null, 0); | |
| 49 GeolocationAgent.setGeolocationOverride(0, 0, "test"); | |
| 50 InspectorTest.evaluateInPage("testLocationMock()", next); | |
| 51 }, | |
| 52 | |
| 53 function clearOverride(next) | |
| 54 { | |
| 55 GeolocationAgent.clearGeolocationOverride(next); | |
| 56 } | |
| 57 ]); | |
| 58 } | |
| 59 </script> | |
| 60 </head> | |
| 61 <body onload="runTest()"> | |
| 62 <p> | |
| 63 Tests that geolocation emulation with latitude and longitude works as expected. | |
| 64 </p> | |
| 65 </body> | |
| 66 </html> | |
| OLD | NEW |