summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-05-26 10:11:43 +0100
committerSteve Block <steveblock@google.com>2010-05-27 11:14:42 +0100
commite78cbe89e6f337f2f1fe40315be88f742b547151 (patch)
treed778000b84a04f24bbad50c7fa66244365e960e9 /LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js
parent7b582e96e4e909ed7dba1e07153d20fbddaec3f7 (diff)
downloadexternal_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.zip
external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.gz
external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.bz2
Merge WebKit at r60074: Initial merge by git
Change-Id: I18a2dc5439e36c928351ea829d8fb4e39b062fc7
Diffstat (limited to 'LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js')
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js
new file mode 100644
index 0000000..9cea5ba
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js
@@ -0,0 +1,37 @@
+description("Tests that when Geolocation permission has been denied prior to a call to a Geolocation method, the error callback is invoked with code PERMISSION_DENIED, when the Geolocation service encounters an error.");
+
+// Prime the Geolocation instance by denying permission.
+window.layoutTestController.setGeolocationPermission(false);
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('');
+ continueTest();
+});
+
+function continueTest()
+{
+ // Make another request, with permission already denied.
+ window.layoutTestController.setMockGeolocationError(0, 'test');
+
+ navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+ }, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ finishJSTest();
+ });
+}
+window.layoutTestController.waitUntilDone();
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;