49 const CLASS_ID = Components.ID(
"{12345678-1234-1234-1234-123456789abc}");
53 var
gTestURL =
"http://127.0.0.1:4444/?itemID=%ITEM_ID%&custom1=%CUSTOM1%&custom2=%CUSTOM2%";
64 if (iid.equals(
Ci.nsIFactory) || iid.equals(
Ci.nsISupports))
67 throw Components.results.NS_ERROR_NO_INTERFACE;
71 var bag =
Cc[
"@mozilla.org/hash-property-bag;1"]
72 .createInstance(
Ci.nsIWritablePropertyBag);
73 bag.setProperty(
"CUSTOM1",
"custom_parameter_1");
74 bag.setProperty(
"CUSTOM2",
"custom_parameter_2");
75 return bag.QueryInterface(iid);
82 if (iid.equals(
Ci.nsIObserver) || iid.equals(
Ci.nsISupports))
85 throw Components.results.NS_ERROR_NO_INTERFACE;
89 if (topic ==
"http-on-modify-request") {
90 var channel = subject.QueryInterface(
Ci.nsIChannel);
91 if (channel.originalURI.spec == gExpectedURL) {
92 log(
"got notification,\n exp: " + gExpectedURL +
"\n got: " + channel.originalURI.spec +
"\n");
93 gSeenExpectedURL =
true;
102 createAppInfo(
"xpcshell@tests.mozilla.org",
"XPCShell",
"1",
"1.9");
111 gObserverService.addObserver(observer,
"http-on-modify-request",
false);
114 function shutdownTest()
122 gObserverService.removeObserver(observer,
"http-on-modify-request");
130 var item =
Cc[
"@mozilla.org/updates/item;1"].createInstance(
Ci.nsIUpdateItem);
131 item.init(
"test@mozilla.org",
"1.0",
"app-profile",
"0.0",
"100.0",
"Test extension",
132 null,
null,
"",
null,
null, item.TYPE_EXTENSION,
"xpcshell@tests.mozilla.org");
134 gExpectedURL = gTestURL.replace(/%ITEM_ID%/, item.id)
135 .replace(/%CUSTOM1%/,
"custom_parameter_1")
136 .replace(/%CUSTOM2%/,
"custom_parameter_2");
141 origURL =
prefs.getCharPref(
"extensions.update.url");
144 gPrefs.setCharPref(
"extensions.update.url", gTestURL);
147 gEM.update([item], 1, 2,
null);
150 assertTrue(gSeenExpectedURL,
"gSeenExpectedURL is FALSE");
153 gPrefs.setCharPref(
"extensions.update.url", origURL);
155 gPrefs.clearUserPref(
"extensions.update.url");
sbOSDControlService prototype QueryInterface
function assertTrue(aTest, aMessage)
sbDeviceFirmwareAutoCheckForUpdate prototype observe