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

Side by Side 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 unified diff | Download patch
OLDNEW
1 description("Tests that the PositionOptions.maximumAge parameter is correctly ap plied."); 1 description("Tests that the PositionOptions.maximumAge parameter is correctly ap plied.");
2 2
3 var mockLatitude = 51.478; 3 var mockLatitude = 51.478;
4 var mockLongitude = -0.166; 4 var mockLongitude = -0.166;
5 var mockAccuracy = 100.0; 5 var mockAccuracy = 100.0;
6 6
7 var mockMessage = 'test'; 7 var mockMessage = 'test';
8 8
9 var position; 9 var position;
10 var error; 10 var error;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 finishJSTest(); 52 finishJSTest();
53 }); 53 });
54 } 54 }
55 55
56 function testNonZeroMaximumAge() { 56 function testNonZeroMaximumAge() {
57 // Update the mock service to report an error. 57 // Update the mock service to report an error.
58 internals.setGeolocationPositionUnavailableError(document, mockMessage); 58 internals.setGeolocationPositionUnavailableError(document, mockMessage);
59 // The maximumAge is non-zero, so we expect the cached position, not the err or from the service. 59 // The maximumAge is non-zero, so we expect the cached position, not the err or from the service.
60 navigator.geolocation.getCurrentPosition(function(p) { 60 navigator.geolocation.getCurrentPosition(function(p) {
61 checkPosition(p); 61 checkPosition(p);
62 testNegativeValueMaximumAge();
63 }, function(e) {
64 testFailed('Error callback invoked unexpectedly');
65 finishJSTest();
66 }, {maximumAge: 1000});
67 }
68
69 function testNegativeValueMaximumAge() {
70 // Update the position provided by the mock service.
71 internals.setGeolocationPosition(document, ++mockLatitude, ++mockLongitude, ++mockAccuracy);
72 // The maximumAge is same as zero, so we expect the updated position from th e service.
73 navigator.geolocation.getCurrentPosition(function(p) {
74 checkPosition(p);
75 testOverSignedIntMaximumAge();
76 }, function(e) {
77 testFailed('Error callback invoked unexpectedly');
78 finishJSTest();
79 }, {maximumAge: -1000});
80 }
81
82 function testOverSignedIntMaximumAge() {
83 // Update the mock service to report an error.
84 internals.setGeolocationPositionUnavailableError(document, mockMessage);
Michael van Ouwerkerk 2014/05/15 11:01:47 I understand now... this is a non-fatal error so t
85 // The maximumAge is non-zero, so we expect the cached position, not the err or from the service.
86 navigator.geolocation.getCurrentPosition(function(p) {
87 checkPosition(p);
88 testOverUnsignedIntMaximumAge();
89 }, function(e) {
90 testFailed('Error callback invoked unexpectedly');
91 finishJSTest();
92 }, {maximumAge: 2147483648});
93 }
94
95 function testOverUnsignedIntMaximumAge() {
96 // Update the mock service to report an error.
97 internals.setGeolocationPositionUnavailableError(document, mockMessage);
98 // The maximumAge is max-value of unsigned, so we expect the cached position , not the error from the service.
99 navigator.geolocation.getCurrentPosition(function(p) {
100 checkPosition(p);
62 testZeroMaximumAgeError(); 101 testZeroMaximumAgeError();
63 }, function(e) { 102 }, function(e) {
64 testFailed('Error callback invoked unexpectedly'); 103 testFailed('Error callback invoked unexpectedly');
65 finishJSTest(); 104 finishJSTest();
66 }, {maximumAge: 1000}); 105 }, {maximumAge: 4294967296});
67 } 106 }
68 107
69 function testZeroMaximumAgeError() { 108 function testZeroMaximumAgeError() {
70 // The default maximumAge is zero, so we expect the error from the service. 109 // The default maximumAge is zero, so we expect the error from the service.
71 navigator.geolocation.getCurrentPosition(function(p) { 110 navigator.geolocation.getCurrentPosition(function(p) {
72 testFailed('Success callback invoked unexpectedly'); 111 testFailed('Success callback invoked unexpectedly');
73 finishJSTest(); 112 finishJSTest();
74 }, function(e) { 113 }, function(e) {
75 checkError(e); 114 checkError(e);
76 finishJSTest(); 115 finishJSTest();
77 }); 116 });
78 } 117 }
79 118
80 window.jsTestIsAsync = true; 119 window.jsTestIsAsync = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698