summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/Geolocation/script-tests/error.js
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/dom/Geolocation/script-tests/error.js')
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/error.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/error.js b/LayoutTests/fast/dom/Geolocation/script-tests/error.js
new file mode 100644
index 0000000..4c818ca
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/error.js
@@ -0,0 +1,25 @@
+description("Tests Geolocation error callback using the mock service.");
+
+var mockCode = 0;
+var mockMessage = "debug";
+
+window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'mockCode');
+ shouldBe('error.message', 'mockMessage');
+ shouldBe('error.UNKNOWN_ERROR', 'undefined');
+ shouldBe('error.PERMISSION_DENIED', '1');
+ shouldBe('error.POSITION_UNAVAILABLE', '2');
+ shouldBe('error.TIMEOUT', '3');
+ finishJSTest();
+});
+window.layoutTestController.waitUntilDone();
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;