Chromium Code Reviews| Index: LayoutTests/inspector/geolocation-emulation-tests.html |
| diff --git a/LayoutTests/inspector/geolocation-emulation-tests.html b/LayoutTests/inspector/geolocation-emulation-tests.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5e7a5d1adb2086798f8245a9f4198358611a4e0b |
| --- /dev/null |
| +++ b/LayoutTests/inspector/geolocation-emulation-tests.html |
| @@ -0,0 +1,80 @@ |
| +<html> |
| +<head> |
| +<script src="../http/tests/inspector/inspector-test.js"></script> |
| +<script> |
| + |
| +function overrideGeolocation() |
| +{ |
| + function testSuccess(position) |
| + { |
| + if (position && position.coords) |
| + console.log("Latitude: " + position.coords.latitude + " Longitude: " + position.coords.longitude); |
| + else |
| + console.log("Unexpected error occured. Test failed."); |
| + } |
| + |
| + function testFailed(error) |
| + { |
| + console.log(error.message); |
| + } |
| + |
| + var mockLatitude = 100; |
| + var mockLongitude = 200; |
| + var mockAccuracy = 94; |
| + |
| + if (window.internals) |
| + internals.setGeolocationPosition(document, mockLatitude, mockLongitude, mockAccuracy); |
| + |
| + navigator.geolocation.getCurrentPosition(testSuccess, testFailed); |
| +} |
| + |
| +function setup() |
| +{ |
| + if (window.internals) { |
| + internals.setGeolocationClientMock(document); |
| + internals.setGeolocationPermission(document, true); |
| + } |
| +} |
| + |
| +function test() |
| +{ |
| + InspectorTest.runTestSuite([ |
| + function setUp(next) |
| + { |
| + InspectorTest.addConsoleSniffer(next); |
|
pfeldman
2014/02/24 09:41:36
I don't understand how this sniffer is used. It wi
|
| + InspectorTest.evaluateInPage("setup()", next); |
| + }, |
| + |
| + function testGeolocationUnavailable(next) |
| + { |
| + GeolocationAgent.setGeolocationOverride(); |
| + InspectorTest.evaluateInPage("overrideGeolocation()", next); |
| + }, |
| + |
| + function testOverridenGeolocation(next) |
| + { |
| + GeolocationAgent.setGeolocationOverride(-510, 500, 100); |
| + InspectorTest.evaluateInPage("overrideGeolocation()", next); |
| + }, |
| + |
| + function testClearOverridenGeolocation(next) |
| + { |
| + GeolocationAgent.setGeolocationOverride(-510, 500, 100); |
| + GeolocationAgent.clearGeolocationOverride(); |
| + InspectorTest.evaluateInPage("overrideGeolocation()", next); |
| + }, |
| + |
| + function testInvalidParam(next) |
| + { |
| + GeolocationAgent.setGeolocationOverride(true, 500, 100, next); |
| + } |
| + ]); |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p> |
| +Tests that geolocation emulation with latitude and longitude works as expected. |
| +</p> |
| +</body> |
| +</html> |