зеркало из https://github.com/mozilla/gecko-dev.git
Bug 469715 - Geolocation Coordinates interface. r/sr=jst
This commit is contained in:
Родитель
14a4c6c48e
Коммит
38f73da727
|
@ -49,6 +49,7 @@ GRE_MODULE = 1
|
|||
XPIDLSRCS = \
|
||||
nsIDOMGeoGeolocation.idl \
|
||||
nsIDOMGeoPosition.idl \
|
||||
nsIDOMGeoPositionCoords.idl \
|
||||
nsIDOMGeoPositionCallback.idl \
|
||||
nsIDOMGeoPositionError.idl \
|
||||
nsIDOMGeoPositionErrorCallback.idl \
|
||||
|
|
|
@ -36,16 +36,11 @@
|
|||
|
||||
|
||||
#include "domstubs.idl"
|
||||
#include "nsIDOMGeoPositionCoords.idl"
|
||||
|
||||
[scriptable, uuid(B31702D0-6DAC-4FA0-B93B-F043E71C8F9A)]
|
||||
[scriptable, uuid(76888EB0-5EAB-4BE6-BFE0-489EC4095358)]
|
||||
interface nsIDOMGeoPosition : nsISupports
|
||||
{
|
||||
readonly attribute double latitude;
|
||||
readonly attribute double longitude;
|
||||
readonly attribute double altitude;
|
||||
readonly attribute double accuracy;
|
||||
readonly attribute double altitudeAccuracy;
|
||||
readonly attribute double heading;
|
||||
readonly attribute double speed;
|
||||
readonly attribute nsIDOMGeoPositionCoords coords;
|
||||
readonly attribute DOMTimeStamp timestamp;
|
||||
};
|
||||
|
|
|
@ -3,12 +3,6 @@ const ACCEPT = 0;
|
|||
const ACCEPT_FUZZ = 1;
|
||||
const DECLINE = 2;
|
||||
|
||||
/* Set if testLocationProvider is registered as geolocation provider.
|
||||
* To register, copy testLocationProvider.js to components directory
|
||||
* and remove from directory when done.
|
||||
*/
|
||||
var TEST_PROVIDER = 0;
|
||||
|
||||
// set if there should be a delay before prompt is accepted
|
||||
var DELAYED_PROMPT = 0;
|
||||
|
||||
|
@ -37,15 +31,20 @@ function check_geolocation(location) {
|
|||
|
||||
ok(location, "Check to see if this location is non-null");
|
||||
|
||||
ok("latitude" in location, "Check to see if there is a latitude");
|
||||
ok("longitude" in location, "Check to see if there is a longitude");
|
||||
ok("altitude" in location, "Check to see if there is a altitude");
|
||||
ok("accuracy" in location, "Check to see if there is a accuracy");
|
||||
ok("altitudeAccuracy" in location, "Check to see if there is a alt accuracy");
|
||||
ok("heading" in location, "Check to see if there is a heading");
|
||||
ok("speed" in location, "Check to see if there is a speed");
|
||||
ok("timestamp" in location, "Check to see if there is a timestamp");
|
||||
|
||||
// eventually, coords may be optional (eg, when civic addresses are supported)
|
||||
ok("coords" in location, "Check to see if this location has a coords");
|
||||
|
||||
var coords = location.coords;
|
||||
|
||||
ok("latitude" in coords, "Check to see if there is a latitude");
|
||||
ok("longitude" in coords, "Check to see if there is a longitude");
|
||||
ok("altitude" in coords, "Check to see if there is a altitude");
|
||||
ok("accuracy" in coords, "Check to see if there is a accuracy");
|
||||
ok("altitudeAccuracy" in coords, "Check to see if there is a alt accuracy");
|
||||
ok("heading" in coords, "Check to see if there is a heading");
|
||||
ok("speed" in coords, "Check to see if there is a speed");
|
||||
}
|
||||
|
||||
//TODO: test for fuzzed location when this is implemented
|
||||
|
@ -57,11 +56,6 @@ function check_no_geolocation(location) {
|
|||
ok(!location, "Check to see if this location is null");
|
||||
}
|
||||
|
||||
function checkFlags(flags, value, isExact) {
|
||||
for(var i = 0; i < flags.length; i++)
|
||||
ok(isExact ? flags[i] == value : flags[i] >= value, "ensure callbacks called " + value + " times");
|
||||
}
|
||||
|
||||
function success_callback(position) {
|
||||
if(prompted == 0)
|
||||
ok(0, "Should not call success callback before prompt accepted");
|
||||
|
|
|
@ -34,8 +34,6 @@ for(var i = 0; i < numCallbacks; i++) {
|
|||
}
|
||||
|
||||
function testAccepted() {
|
||||
if(TEST_PROVIDER)
|
||||
checkFlags(callbackCounter, 1, true);
|
||||
removePrompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
@ -56,8 +56,6 @@ function clearWatches() {
|
|||
}
|
||||
|
||||
function testAccepted() {
|
||||
if(TEST_PROVIDER)
|
||||
checkFlags(callbackCounter, num_pos_changes, false);
|
||||
clearWatches();
|
||||
removePrompt();
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -55,8 +55,6 @@ function clearWatches() {
|
|||
}
|
||||
|
||||
function testAccepted() {
|
||||
if(TEST_PROVIDER)
|
||||
checkFlags(callbackCounter, num_pos_changes, false);
|
||||
clearWatches();
|
||||
setTimeout(clearAll, timeout); // now clear flags
|
||||
}
|
||||
|
@ -68,7 +66,6 @@ function clearAll() {
|
|||
}
|
||||
|
||||
function testCleared() {
|
||||
checkFlags(callbackCounter, 0, true);
|
||||
removePrompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче