Chromium Code Reviews| 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); |
|
Michael van Ouwerkerk
2014/05/15 11:01:47
I understand now... this is a non-fatal error so t
|
| + // 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) { |