Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js

Issue 285673002: Change value type of timeout and maximumAge in PositionOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js b/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js
index 928370894499bdcd5923fd9bcdc349ce7f643a15..4ce320e5c2d0b5a11af6105baa1aa4446335f153 100644
--- a/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js
@@ -59,13 +59,52 @@ function testNonZeroMaximumAge() {
// 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();
+ testNegativeValueMaximumAge();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
finishJSTest();
}, {maximumAge: 1000});
}
+function testNegativeValueMaximumAge() {
+ // Update the position provided by the mock service.
+ internals.setGeolocationPosition(document, ++mockLatitude, ++mockLongitude, ++mockAccuracy);
+ // The maximumAge is same as zero, so we expect the updated position from the service.
+ navigator.geolocation.getCurrentPosition(function(p) {
+ checkPosition(p);
+ testOverSignedIntMaximumAge();
+ }, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ finishJSTest();
+ }, {maximumAge: -1000});
+}
+
+function testOverSignedIntMaximumAge() {
+ // Update the mock service to report an error.
+ internals.setGeolocationPositionUnavailableError(document, 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);
+ testOverUnsignedIntMaximumAge();
+ }, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ finishJSTest();
+ }, {maximumAge: 2147483648});
+}
+
+function testOverUnsignedIntMaximumAge() {
+ // Update the mock service to report an error.
+ internals.setGeolocationPositionUnavailableError(document, mockMessage);
+ // The maximumAge is max-value of unsigned, 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');
+ finishJSTest();
+ }, {maximumAge: 4294967296});
+}
+
function testZeroMaximumAgeError() {
// The default maximumAge is zero, so we expect the error from the service.
navigator.geolocation.getCurrentPosition(function(p) {

Powered by Google App Engine
This is Rietveld 408576698