summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-24 11:11:00 +0000
committerSteve Block <steveblock@google.com>2010-03-11 11:40:32 +0000
commit159531f4ce4c04455cd544a7c0f7c1644a50ccbe (patch)
treebd6ac2887510f9da0ee1569b3c29f719ee0326d5 /LayoutTests/fast
parent5d59fc68790cda4c64b9e13133704e8d9c94fe57 (diff)
downloadexternal_webkit-159531f4ce4c04455cd544a7c0f7c1644a50ccbe.zip
external_webkit-159531f4ce4c04455cd544a7c0f7c1644a50ccbe.tar.gz
external_webkit-159531f4ce4c04455cd544a7c0f7c1644a50ccbe.tar.bz2
Update Android to reflect final version submitted to webkit.org for Geolocation maximumAge
See http://trac.webkit.org/changeset/55841 Change-Id: Ib504563b7be40b0ff794cdcc625b07f494bb6483
Diffstat (limited to 'LayoutTests/fast')
-rw-r--r--LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt24
-rw-r--r--LayoutTests/fast/dom/Geolocation/maximum-age.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/maximum-age.js81
3 files changed, 118 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt b/LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt
new file mode 100644
index 0000000..71b1980
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt
@@ -0,0 +1,24 @@
+Tests that the PositionOptions.maximumAge parameter is correctly applied.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+PASS error.code is mockCode
+PASS error.message is mockMessage
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/maximum-age.html b/LayoutTests/fast/dom/Geolocation/maximum-age.html
new file mode 100644
index 0000000..2d871e0
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/maximum-age.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="resources/maximum-age.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/maximum-age.js b/LayoutTests/fast/dom/Geolocation/resources/maximum-age.js
new file mode 100644
index 0000000..f48aa0d
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/maximum-age.js
@@ -0,0 +1,81 @@
+description("Tests that the PositionOptions.maximumAge parameter is correctly applied.");
+
+var mockLatitude = 51.478;
+var mockLongitude = -0.166;
+var mockAccuracy = 100.0;
+
+var mockCode = 1;
+var mockMessage = 'test';
+
+var position;
+var error;
+
+function checkPosition(p) {
+ debug('');
+ position = p;
+ shouldBe('position.coords.latitude', 'mockLatitude');
+ shouldBe('position.coords.longitude', 'mockLongitude');
+ shouldBe('position.coords.accuracy', 'mockAccuracy');
+}
+
+function checkError(e) {
+ debug('');
+ error = e;
+ shouldBe('error.code', 'mockCode');
+ shouldBe('error.message', 'mockMessage');
+}
+
+window.layoutTestController.setGeolocationPermission(true);
+window.layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
+
+// Initialize the cached Position
+navigator.geolocation.getCurrentPosition(function(p) {
+ checkPosition(p);
+ testZeroMaximumAge();
+}, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+});
+
+function testZeroMaximumAge() {
+ // Update the position provided by the mock service.
+ window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
+ // The default maximumAge is zero, so we expect the updated position from the service.
+ navigator.geolocation.getCurrentPosition(function(p) {
+ checkPosition(p);
+ testNonZeroMaximumAge();
+ }, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ });
+}
+
+function testNonZeroMaximumAge() {
+ // Update the mock service to report an error.
+ window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
+ // The maximumAge is non-zero, so we expect the cached position, not the error from the service.
+ navigator.geolocation.getCurrentPosition(function(p) {
+ checkPosition(p);
+ testZeroMaximumAgeError();
+ }, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }, {maximumAge: 1000});
+}
+
+function testZeroMaximumAgeError() {
+ // The default maximumAge is zero, so we expect the error from the service.
+ navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }, function(e) {
+ checkError(e);
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+ });
+}
+
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;