1 const Cc = Components.classes;
2 const Ci = Components.interfaces;
4 const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
5 const providerContract = "@mozilla.org/geolocation/provider;1";
7 const categoryName = "geolocation-provider";
10 QueryInterface: function eventsink_qi(iid) {
11 if (iid.equals(Components.interfaces.nsISupports) ||
12 iid.equals(Components.interfaces.nsIFactory) ||
13 iid.equals(Components.interfaces.nsIGeolocationProvider))
15 throw Components.results.NS_ERROR_NO_INTERFACE;
17 createInstance: function eventsink_ci(outer, iid) {
19 throw Components.results.NS_ERROR_NO_AGGREGATION;
20 return this.QueryInterface(iid);
22 lockFactory: function eventsink_lockf(lock) {
23 throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
29 shutdown: function() {
31 setHighAccuracy: function(enable) {
32 this._isHigh = enable;
34 this._seenHigh = true;
35 do_send_remote_message('high_acc_enabled');
44 // XPCShell does not get a profile by default. The geolocation service
45 // depends on the settings service which uses IndexedDB and IndexedDB
46 // needs a place where it can store databases.
49 Components.manager.nsIComponentRegistrar.registerFactory(providerCID,
50 "Unit test geo provider", providerContract, provider);
51 var catMan = Components.classes["@mozilla.org/categorymanager;1"]
52 .getService(Components.interfaces.nsICategoryManager);
53 catMan.nsICategoryManager.addCategoryEntry(categoryName, "unit test",
54 providerContract, false, true);
56 var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
57 prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
58 prefs.setBoolPref("geo.wifi.scan", false);
60 run_test_in_child("test_geolocation_reset_accuracy.js", check_results);
63 function check_results()
65 // check the provider was set to high accuracy during the test
66 do_check_true(provider._seenHigh);
67 // check the provider is not currently set to high accuracy
68 do_check_false(provider._isHigh);