1 const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
2 const providerContract = "@mozilla.org/geolocation/provider;1";
4 const categoryName = "geolocation-provider";
7 QueryInterface: ChromeUtils.generateQI([
9 "nsIGeolocationProvider",
11 createInstance: function eventsink_ci(iid) {
12 return this.QueryInterface(iid);
17 setHighAccuracy(enable) {
18 this._isHigh = enable;
20 this._seenHigh = true;
21 executeSoon(stop_high_accuracy_watch);
28 function successCallback() {
33 function errorCallback() {
42 if (runningInParent) {
43 // XPCShell does not get a profile by default. The geolocation service
44 // depends on the settings service which uses IndexedDB and IndexedDB
45 // needs a place where it can store databases.
48 Components.manager.nsIComponentRegistrar.registerFactory(
50 "Unit test geo provider",
55 Services.catMan.addCategoryEntry(
63 Services.prefs.setBoolPref("geo.provider.network.scan", false);
68 geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsISupports);
69 geolocation.watchPosition(successCallback, errorCallback);
70 watchID2 = geolocation.watchPosition(successCallback, errorCallback, {
71 enableHighAccuracy: true,
74 if (!runningInParent) {
75 do_await_remote_message("high_acc_enabled", stop_high_accuracy_watch);
79 function stop_high_accuracy_watch() {
80 geolocation.clearWatch(watchID2);
85 function check_results() {
86 if (runningInParent) {
87 // check the provider was set to high accuracy during the test
88 Assert.ok(provider._seenHigh);
89 // check the provider is not currently set to high accuracy
90 Assert.ok(!provider._isHigh);