mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1139254 - Use MockRegistrar in chrome. r=gps
This commit is contained in:
parent
94bf301376
commit
e83a3a1a7c
@ -7,28 +7,14 @@ var MANIFESTS = [
|
||||
do_get_file("data/test_bug519468.manifest")
|
||||
];
|
||||
|
||||
Components.utils.import("resource://testing-common/MockRegistrar.jsm");
|
||||
// Stub in the locale service so we can control what gets returned as the OS locale setting
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
let stubOSLocale = null;
|
||||
|
||||
stubID = Components.ID("9d09d686-d913-414c-a1e6-4be8652d7d93");
|
||||
localeContractID = "@mozilla.org/intl/nslocaleservice;1";
|
||||
|
||||
StubLocaleService = {
|
||||
classDescription: "Stub version of Locale service for testing",
|
||||
classID: stubID,
|
||||
contractID: localeContractID,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsILocaleService, Ci.nsISupports, Ci.nsIFactory]),
|
||||
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
return this.QueryInterface(iid);
|
||||
},
|
||||
lockFactory: function (lock) {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsILocaleService, Ci.nsISupports]),
|
||||
|
||||
getLocaleComponentForUserAgent: function SLS_getLocaleComponentForUserAgent()
|
||||
{
|
||||
@ -36,14 +22,7 @@ StubLocaleService = {
|
||||
}
|
||||
}
|
||||
|
||||
let registrar = Components.manager.nsIComponentRegistrar;
|
||||
// Save original factory.
|
||||
let localeCID = registrar.contractIDToCID(localeContractID)
|
||||
let originalFactory =
|
||||
Components.manager.getClassObject(Components.classes[localeContractID],
|
||||
Components.interfaces.nsIFactory);
|
||||
|
||||
registrar.registerFactory(stubID, "Unit test Locale Service", localeContractID, StubLocaleService);
|
||||
MockRegistrar.register("@mozilla.org/intl/nslocaleservice;1", StubLocaleService);
|
||||
|
||||
// Now fire up the test
|
||||
do_test_pending()
|
||||
|
Loading…
Reference in New Issue
Block a user