diff options
Diffstat (limited to 'LayoutTests/fast/dom/Geolocation')
6 files changed, 104 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-expected.txt b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-expected.txt new file mode 100644 index 0000000..bfe4f75 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-expected.txt @@ -0,0 +1,10 @@ +Tests that when a position is available, no callbacks are invoked until permission is allowed. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS Success callback invoked +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed.html b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed.html new file mode 100644 index 0000000..cacdd85 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/delayed-permission-allowed.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-expected.txt b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-expected.txt new file mode 100644 index 0000000..292e2ee --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-expected.txt @@ -0,0 +1,11 @@ +Tests that when a position is available, no callbacks are invoked until permission is denied. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS error.code is error.PERMISSION_DENIED +PASS error.message is "User denied Geolocation" +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-denied.html b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied.html new file mode 100644 index 0000000..0faec6e --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/delayed-permission-denied.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed.js b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed.js new file mode 100644 index 0000000..f4242ca --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed.js @@ -0,0 +1,27 @@ +description("Tests that when a position is available, no callbacks are invoked until permission is allowed."); + +if (window.layoutTestController) + window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); + +function allowPermission() { + permissionSet = true; + if (window.layoutTestController) + layoutTestController.setGeolocationPermission(true); +} + +navigator.geolocation.getCurrentPosition(function() { + if (permissionSet) { + testPassed('Success callback invoked'); + finishJSTest(); + return; + } + testFailed('Success callback invoked unexpectedly'); + finishJSTest(); +}, function() { + testFailed('Error callback invoked unexpectedly'); + finishJSTest(); +}); +window.setTimeout(allowPermission, 100); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied.js b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied.js new file mode 100644 index 0000000..aebd302 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied.js @@ -0,0 +1,30 @@ +description("Tests that when a position is available, no callbacks are invoked until permission is denied."); + +if (window.layoutTestController) + window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); + +function denyPermission() { + permissionSet = true; + if (window.layoutTestController) + layoutTestController.setGeolocationPermission(false); +} + +var error; +navigator.geolocation.getCurrentPosition(function() { + testFailed('Success callback invoked unexpectedly'); + finishJSTest(); +}, function(e) { + if (permissionSet) { + error = e; + shouldBe('error.code', 'error.PERMISSION_DENIED'); + shouldBe('error.message', '"User denied Geolocation"'); + finishJSTest(); + return; + } + testFailed('Error callback invoked unexpectedly'); + finishJSTest(); +}); +window.setTimeout(denyPermission, 100); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; |