зеркало из https://github.com/mozilla/gecko-dev.git
(test only change) Bug 493805 - Additional app update test cleanup. r=me
This commit is contained in:
Родитель
460d1168c1
Коммит
c40ee3cb9c
|
@ -52,9 +52,9 @@ const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override";
|
||||||
const PREF_APP_UPDATE_SHOW_INSTALLED_UI = "app.update.showInstalledUI";
|
const PREF_APP_UPDATE_SHOW_INSTALLED_UI = "app.update.showInstalledUI";
|
||||||
|
|
||||||
const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
|
const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
|
||||||
const gUpdateBundle = AUS_Cc["@mozilla.org/intl/stringbundle;1"]
|
const gUpdateBundle = AUS_Cc["@mozilla.org/intl/stringbundle;1"].
|
||||||
.getService(AUS_Ci.nsIStringBundleService)
|
getService(AUS_Ci.nsIStringBundleService).
|
||||||
.createBundle(URI_UPDATES_PROPERTIES);
|
createBundle(URI_UPDATES_PROPERTIES);
|
||||||
|
|
||||||
const STATE_NONE = "null";
|
const STATE_NONE = "null";
|
||||||
const STATE_DOWNLOADING = "downloading";
|
const STATE_DOWNLOADING = "downloading";
|
||||||
|
@ -79,10 +79,9 @@ const PERMS_DIRECTORY = 0755;
|
||||||
const URL_HOST = "http://localhost:4444/"
|
const URL_HOST = "http://localhost:4444/"
|
||||||
const DIR_DATA = "data"
|
const DIR_DATA = "data"
|
||||||
|
|
||||||
var gDirSvc = AUS_Cc["@mozilla.org/file/directory_service;1"]
|
var gDirSvc = AUS_Cc["@mozilla.org/file/directory_service;1"].
|
||||||
.getService(AUS_Ci.nsIProperties);
|
getService(AUS_Ci.nsIProperties);
|
||||||
var gPrefs = AUS_Cc["@mozilla.org/preferences;1"]
|
|
||||||
.getService(AUS_Ci.nsIPrefBranch);
|
|
||||||
var gAUS;
|
var gAUS;
|
||||||
var gUpdateChecker;
|
var gUpdateChecker;
|
||||||
var gUpdateManager;
|
var gUpdateManager;
|
||||||
|
@ -101,6 +100,37 @@ var gUpdates;
|
||||||
var gStatusCode;
|
var gStatusCode;
|
||||||
var gStatusText;
|
var gStatusText;
|
||||||
|
|
||||||
|
|
||||||
|
function getPrefBranch() {
|
||||||
|
return AUS_Cc["@mozilla.org/preferences;1"].getService(AUS_Ci.nsIPrefBranch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nulls out the most commonly used global vars used by tests as appropriate.
|
||||||
|
* This is not in the tail file due to check-interactive executing the tail file
|
||||||
|
* prior to _execute_test();.
|
||||||
|
*/
|
||||||
|
function cleanUp() {
|
||||||
|
gDirSvc.unregisterProvider(dirProvider);
|
||||||
|
|
||||||
|
if (gXHR) {
|
||||||
|
gXHRCallback = null;
|
||||||
|
|
||||||
|
gXHR.responseXML = null;
|
||||||
|
// null out the event handlers to prevent a mFreeCount leak of 1
|
||||||
|
gXHR.onerror = null;
|
||||||
|
gXHR.onload = null;
|
||||||
|
gXHR.onprogress = null;
|
||||||
|
|
||||||
|
gXHR = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
gUpdateManager = null;
|
||||||
|
gUpdateChecker = null;
|
||||||
|
gAUS = null;
|
||||||
|
gTestserver = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the most commonly used global vars used by tests and
|
* Initializes the most commonly used global vars used by tests and
|
||||||
* nsIApplicationUpdateService
|
* nsIApplicationUpdateService
|
||||||
|
@ -108,35 +138,36 @@ var gStatusText;
|
||||||
function startAUS() {
|
function startAUS() {
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1.0", "2.0");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1.0", "2.0");
|
||||||
|
|
||||||
|
var pb = getPrefBranch();
|
||||||
// Don't display UI for a successful installation. Some apps may not set this
|
// Don't display UI for a successful installation. Some apps may not set this
|
||||||
// pref to false like Firefox does.
|
// pref to false like Firefox does.
|
||||||
gPrefs.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, false);
|
pb.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, false);
|
||||||
// Enable Update logging
|
// Enable Update logging
|
||||||
gPrefs.setBoolPref("app.update.log.all", true);
|
pb.setBoolPref("app.update.log.all", true);
|
||||||
// Lessens the noise in the logs when using Update Service logging
|
// Lessens the noise in the logs when using Update Service logging
|
||||||
gPrefs.setBoolPref("app.update.enabled", false);
|
pb.setBoolPref("app.update.enabled", false);
|
||||||
gPrefs.setBoolPref("extensions.blocklist.enabled", false);
|
pb.setBoolPref("extensions.blocklist.enabled", false);
|
||||||
gPrefs.setBoolPref("extensions.update.enabled", false);
|
pb.setBoolPref("extensions.update.enabled", false);
|
||||||
gPrefs.setBoolPref("browser.search.update", false);
|
pb.setBoolPref("browser.search.update", false);
|
||||||
gPrefs.setBoolPref("browser.microsummary.updateGenerators", false);
|
pb.setBoolPref("browser.microsummary.updateGenerators", false);
|
||||||
|
|
||||||
gAUS = AUS_Cc["@mozilla.org/updates/update-service;1"]
|
gAUS = AUS_Cc["@mozilla.org/updates/update-service;1"].
|
||||||
.getService(AUS_Ci.nsIApplicationUpdateService);
|
getService(AUS_Ci.nsIApplicationUpdateService);
|
||||||
var os = AUS_Cc["@mozilla.org/observer-service;1"]
|
var os = AUS_Cc["@mozilla.org/observer-service;1"].
|
||||||
.getService(AUS_Ci.nsIObserverService);
|
getService(AUS_Ci.nsIObserverService);
|
||||||
os.notifyObservers(null, "profile-after-change", null);
|
os.notifyObservers(null, "profile-after-change", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializes nsIUpdateChecker */
|
/* Initializes nsIUpdateChecker */
|
||||||
function startUpdateChecker() {
|
function startUpdateChecker() {
|
||||||
gUpdateChecker = AUS_Cc["@mozilla.org/updates/update-checker;1"]
|
gUpdateChecker = AUS_Cc["@mozilla.org/updates/update-checker;1"].
|
||||||
.createInstance(AUS_Ci.nsIUpdateChecker);
|
createInstance(AUS_Ci.nsIUpdateChecker);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializes nsIUpdateManager */
|
/* Initializes nsIUpdateManager */
|
||||||
function startUpdateManager() {
|
function startUpdateManager() {
|
||||||
gUpdateManager = AUS_Cc["@mozilla.org/updates/update-manager;1"]
|
gUpdateManager = AUS_Cc["@mozilla.org/updates/update-manager;1"].
|
||||||
.getService(AUS_Ci.nsIUpdateManager);
|
getService(AUS_Ci.nsIUpdateManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -386,8 +417,8 @@ function writeStatusFile(aStatus) {
|
||||||
* replaced.
|
* replaced.
|
||||||
*/
|
*/
|
||||||
function writeFile(aFile, aText) {
|
function writeFile(aFile, aText) {
|
||||||
var fos = AUS_Cc["@mozilla.org/network/safe-file-output-stream;1"]
|
var fos = AUS_Cc["@mozilla.org/network/safe-file-output-stream;1"].
|
||||||
.createInstance(AUS_Ci.nsIFileOutputStream);
|
createInstance(AUS_Ci.nsIFileOutputStream);
|
||||||
if (!aFile.exists())
|
if (!aFile.exists())
|
||||||
aFile.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
|
aFile.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
|
||||||
fos.init(aFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
|
fos.init(aFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
|
||||||
|
@ -412,8 +443,8 @@ function writeFile(aFile, aText) {
|
||||||
* @returns The string of text read from the file.
|
* @returns The string of text read from the file.
|
||||||
*/
|
*/
|
||||||
function readFile(aFile) {
|
function readFile(aFile) {
|
||||||
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"]
|
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
|
||||||
.createInstance(AUS_Ci.nsIFileInputStream);
|
createInstance(AUS_Ci.nsIFileInputStream);
|
||||||
if (!aFile.exists())
|
if (!aFile.exists())
|
||||||
return null;
|
return null;
|
||||||
fis.init(aFile, MODE_RDONLY, PERMS_FILE, 0);
|
fis.init(aFile, MODE_RDONLY, PERMS_FILE, 0);
|
||||||
|
@ -456,8 +487,8 @@ function getString(aName) {
|
||||||
* WARNING: unable to post SHUTDOWN message
|
* WARNING: unable to post SHUTDOWN message
|
||||||
*/
|
*/
|
||||||
function toggleOffline(aOffline) {
|
function toggleOffline(aOffline) {
|
||||||
const ioService = AUS_Cc["@mozilla.org/network/io-service;1"]
|
const ioService = AUS_Cc["@mozilla.org/network/io-service;1"].
|
||||||
.getService(AUS_Ci.nsIIOService);
|
getService(AUS_Ci.nsIIOService);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ioService.manageOfflineStatus = !aOffline;
|
ioService.manageOfflineStatus = !aOffline;
|
||||||
|
@ -505,9 +536,9 @@ xhr.prototype = {
|
||||||
_url: null,
|
_url: null,
|
||||||
_method: null,
|
_method: null,
|
||||||
open: function (method, url) {
|
open: function (method, url) {
|
||||||
gXHR.channel.originalURI = AUS_Cc["@mozilla.org/network/io-service;1"]
|
gXHR.channel.originalURI = AUS_Cc["@mozilla.org/network/io-service;1"].
|
||||||
.getService(AUS_Ci.nsIIOService)
|
getService(AUS_Ci.nsIIOService).
|
||||||
.newURI(url, null, null);
|
newURI(url, null, null);
|
||||||
gXHR._method = method; gXHR._url = url;
|
gXHR._method = method; gXHR._url = url;
|
||||||
},
|
},
|
||||||
responseXML: null,
|
responseXML: null,
|
||||||
|
@ -629,58 +660,11 @@ function removeUpdateDirsAndFiles() {
|
||||||
"\nException: " + e + "\n");
|
"\nException: " + e + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
var updatesSubDir = appDir.clone();
|
|
||||||
updatesSubDir.append("updates");
|
|
||||||
updatesSubDir.append("0");
|
|
||||||
if (updatesSubDir.exists()) {
|
|
||||||
file = updatesSubDir.clone();
|
|
||||||
file.append("update.mar");
|
|
||||||
try {
|
|
||||||
if (file.exists())
|
|
||||||
file.remove(false);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
dump("Unable to remove file\npath: " + file.path +
|
|
||||||
"\nException: " + e + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
file = updatesSubDir.clone();
|
|
||||||
file.append("update.status");
|
|
||||||
try {
|
|
||||||
if (file.exists())
|
|
||||||
file.remove(false);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
dump("Unable to remove file\npath: " + file.path +
|
|
||||||
"\nException: " + e + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
file = updatesSubDir.clone();
|
|
||||||
file.append("update.version");
|
|
||||||
try {
|
|
||||||
if (file.exists())
|
|
||||||
file.remove(false);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
dump("Unable to remove file\npath: " + file.path +
|
|
||||||
"\nException: " + e + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
updatesSubDir.remove(true);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
dump("Unable to remove directory\npath: " + updatesSubDir.path +
|
|
||||||
"\nException: " + e + "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This fails sporadically on Mac OS X so wrap it in a try catch
|
// This fails sporadically on Mac OS X so wrap it in a try catch
|
||||||
var updatesDir = appDir.clone();
|
var updatesDir = appDir.clone();
|
||||||
updatesDir.append("updates");
|
updatesDir.append("updates");
|
||||||
try {
|
try {
|
||||||
if (updatesDir.exists())
|
removeDirRecursive(updatesDir);
|
||||||
updatesDir.remove(true);
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dump("Unable to remove directory\npath: " + updatesDir.path +
|
dump("Unable to remove directory\npath: " + updatesDir.path +
|
||||||
|
@ -688,6 +672,37 @@ function removeUpdateDirsAndFiles() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a directory and its children. First it tries nsIFile::Remove(true).
|
||||||
|
* If that fails it will fall back to recursing, setting the appropriate
|
||||||
|
* permissions, and deleting the current entry.
|
||||||
|
* @param dir
|
||||||
|
* A nsIFile for the directory to be deleted
|
||||||
|
*/
|
||||||
|
function removeDirRecursive(aDir) {
|
||||||
|
try {
|
||||||
|
aDir.remove(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
var dirEntries = aDir.directoryEntries;
|
||||||
|
while (dirEntries.hasMoreElements()) {
|
||||||
|
var entry = dirEntries.getNext().QueryInterface(AUS_Ci.nsIFile);
|
||||||
|
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
removeDirRecursive(entry);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
entry.permissions = PERMS_FILE;
|
||||||
|
entry.remove(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aDir.permissions = PERMS_DIRECTORY;
|
||||||
|
aDir.remove(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper for starting the http server used by the tests
|
* Helper for starting the http server used by the tests
|
||||||
* @param aRelativeDirName
|
* @param aRelativeDirName
|
||||||
|
|
|
@ -36,22 +36,5 @@
|
||||||
* ***** END LICENSE BLOCK *****
|
* ***** END LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gDirSvc.unregisterProvider(dirProvider);
|
// Not used since check-interactive executes this prior to _execute_test();
|
||||||
|
// being executed.
|
||||||
if (gXHR) {
|
|
||||||
gXHRCallback = null;
|
|
||||||
|
|
||||||
gXHR.responseXML = null;
|
|
||||||
// null out the event handlers to prevent a mFreeCount leak of 1
|
|
||||||
gXHR.onerror = null;
|
|
||||||
gXHR.onload = null;
|
|
||||||
gXHR.onprogress = null;
|
|
||||||
|
|
||||||
gXHR = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
gUpdateManager = null;
|
|
||||||
gUpdateChecker = null;
|
|
||||||
gAUS = null;
|
|
||||||
gPrefs = null;
|
|
||||||
gTestserver = null;
|
|
||||||
|
|
|
@ -53,4 +53,5 @@ function run_test() {
|
||||||
// Check if the update dir can be written to
|
// Check if the update dir can be written to
|
||||||
dump("Testing: nsIApplicationUpdateService:canUpdate\n");
|
dump("Testing: nsIApplicationUpdateService:canUpdate\n");
|
||||||
do_check_true(gAUS.canUpdate);
|
do_check_true(gAUS.canUpdate);
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,9 @@ var gExpectedCount;
|
||||||
function run_test() {
|
function run_test() {
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
removeUpdateDirsAndFiles();
|
removeUpdateDirsAndFiles();
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE,
|
var pb = getPrefBranch();
|
||||||
URL_HOST + "update.xml");
|
pb.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, URL_HOST + "update.xml");
|
||||||
var defaults = gPrefs.QueryInterface(AUS_Ci.nsIPrefService)
|
var defaults = pb.QueryInterface(AUS_Ci.nsIPrefService).getDefaultBranch(null);
|
||||||
.getDefaultBranch(null);
|
|
||||||
defaults.setCharPref("app.update.channel", "bogus_channel");
|
defaults.setCharPref("app.update.channel", "bogus_channel");
|
||||||
// The mock XMLHttpRequest is MUCH faster
|
// The mock XMLHttpRequest is MUCH faster
|
||||||
overrideXHR(callHandleEvent);
|
overrideXHR(callHandleEvent);
|
||||||
|
@ -58,6 +57,7 @@ function run_test() {
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for testing update counts returned from an update xml
|
// Helper function for testing update counts returned from an update xml
|
||||||
|
@ -82,8 +82,8 @@ function callHandleEvent() {
|
||||||
gXHR.status = 400;
|
gXHR.status = 400;
|
||||||
gXHR.responseText = gResponseBody;
|
gXHR.responseText = gResponseBody;
|
||||||
try {
|
try {
|
||||||
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"]
|
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"].
|
||||||
.createInstance(AUS_Ci.nsIDOMParser);
|
createInstance(AUS_Ci.nsIDOMParser);
|
||||||
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
|
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ function run_test() {
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
removeUpdateDirsAndFiles();
|
removeUpdateDirsAndFiles();
|
||||||
// The mock XMLHttpRequest is MUCH faster
|
// The mock XMLHttpRequest is MUCH faster
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, URL_HOST + "update.xml");
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, URL_HOST + "update.xml");
|
||||||
overrideXHR(callHandleEvent);
|
overrideXHR(callHandleEvent);
|
||||||
startAUS();
|
startAUS();
|
||||||
startUpdateChecker();
|
startUpdateChecker();
|
||||||
|
@ -57,6 +57,7 @@ function run_test() {
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
stop_httpserver(do_test_finished);
|
stop_httpserver(do_test_finished);
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback function used by the custom XMLHttpRequest implemetation to
|
// Callback function used by the custom XMLHttpRequest implemetation to
|
||||||
|
@ -65,8 +66,8 @@ function callHandleEvent() {
|
||||||
gXHR.status = 400;
|
gXHR.status = 400;
|
||||||
gXHR.responseText = gResponseBody;
|
gXHR.responseText = gResponseBody;
|
||||||
try {
|
try {
|
||||||
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"]
|
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"].
|
||||||
.createInstance(AUS_Ci.nsIDOMParser);
|
createInstance(AUS_Ci.nsIDOMParser);
|
||||||
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
|
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
|
|
|
@ -55,14 +55,15 @@ function run_test() {
|
||||||
overrideXHR(callHandleEvent);
|
overrideXHR(callHandleEvent);
|
||||||
startAUS();
|
startAUS();
|
||||||
startUpdateChecker();
|
startUpdateChecker();
|
||||||
gAppInfo = AUS_Cc["@mozilla.org/xre/app-info;1"]
|
gAppInfo = AUS_Cc["@mozilla.org/xre/app-info;1"].
|
||||||
.getService(AUS_Ci.nsIXULAppInfo)
|
getService(AUS_Ci.nsIXULAppInfo).
|
||||||
.QueryInterface(AUS_Ci.nsIXULRuntime);
|
QueryInterface(AUS_Ci.nsIXULRuntime);
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, "run_test_pt1()");
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback function used by the custom XMLHttpRequest implemetation to
|
// Callback function used by the custom XMLHttpRequest implemetation to
|
||||||
|
@ -82,7 +83,7 @@ function run_test_pt1() {
|
||||||
gCheckFunc = check_test_pt1;
|
gCheckFunc = check_test_pt1;
|
||||||
var url = URL_PREFIX + "%PRODUCT%/";
|
var url = URL_PREFIX + "%PRODUCT%/";
|
||||||
dump("Testing: url constructed with %PRODUCT% - " + url + "\n");
|
dump("Testing: url constructed with %PRODUCT% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ function run_test_pt2() {
|
||||||
gCheckFunc = check_test_pt2;
|
gCheckFunc = check_test_pt2;
|
||||||
var url = URL_PREFIX + "%VERSION%/";
|
var url = URL_PREFIX + "%VERSION%/";
|
||||||
dump("Testing: url constructed with %VERSION% - " + url + "\n");
|
dump("Testing: url constructed with %VERSION% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ function run_test_pt3() {
|
||||||
gCheckFunc = check_test_pt3;
|
gCheckFunc = check_test_pt3;
|
||||||
var url = URL_PREFIX + "%BUILD_ID%/";
|
var url = URL_PREFIX + "%BUILD_ID%/";
|
||||||
dump("Testing: url constructed with %BUILD_ID% - " + url + "\n");
|
dump("Testing: url constructed with %BUILD_ID% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ function run_test_pt4() {
|
||||||
gCheckFunc = check_test_pt4;
|
gCheckFunc = check_test_pt4;
|
||||||
var url = URL_PREFIX + "%BUILD_TARGET%/";
|
var url = URL_PREFIX + "%BUILD_TARGET%/";
|
||||||
dump("Testing: url constructed with %BUILD_TARGET% - " + url + "\n");
|
dump("Testing: url constructed with %BUILD_TARGET% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,8 +142,8 @@ function check_test_pt4() {
|
||||||
// Mac universal build should report a different ABI than either macppc
|
// Mac universal build should report a different ABI than either macppc
|
||||||
// or mactel. This is necessary since nsUpdateService.js will set the ABI to
|
// or mactel. This is necessary since nsUpdateService.js will set the ABI to
|
||||||
// Universal-gcc3 for Mac universal builds.
|
// Universal-gcc3 for Mac universal builds.
|
||||||
var macutils = AUS_Cc["@mozilla.org/xpcom/mac-utils;1"]
|
var macutils = AUS_Cc["@mozilla.org/xpcom/mac-utils;1"].
|
||||||
.getService(AUS_Ci.nsIMacUtils);
|
getService(AUS_Ci.nsIMacUtils);
|
||||||
|
|
||||||
if (macutils.isUniversalBinary)
|
if (macutils.isUniversalBinary)
|
||||||
abi = "Universal-gcc3";
|
abi = "Universal-gcc3";
|
||||||
|
@ -153,14 +154,21 @@ function check_test_pt4() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// url constructed with %LOCALE%
|
// url constructed with %LOCALE%
|
||||||
// Bug 446527 added the locale to the updater.ini
|
// Bug 488936 added the locale to the updater.locale file
|
||||||
function run_test_pt5() {
|
function run_test_pt5() {
|
||||||
gCheckFunc = check_test_pt5;
|
gCheckFunc = check_test_pt5;
|
||||||
var url = URL_PREFIX + "%LOCALE%/";
|
var url = URL_PREFIX + "%LOCALE%/";
|
||||||
dump("Testing: url constructed with %LOCALE% - " + url + "\n");
|
dump("Testing: url constructed with %LOCALE% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
|
try {
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
dump("***\n*** The following error is most likely due to a missing " +
|
||||||
|
"update.locale file\n***\n");
|
||||||
|
do_throw(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function check_test_pt5() {
|
function check_test_pt5() {
|
||||||
do_check_eq(getResult(gRequestURL), gInstallationLocale);
|
do_check_eq(getResult(gRequestURL), gInstallationLocale);
|
||||||
|
@ -172,9 +180,9 @@ function run_test_pt6() {
|
||||||
gCheckFunc = check_test_pt6;
|
gCheckFunc = check_test_pt6;
|
||||||
var url = URL_PREFIX + "%CHANNEL%/";
|
var url = URL_PREFIX + "%CHANNEL%/";
|
||||||
dump("Testing: url constructed with %CHANNEL% - " + url + "\n");
|
dump("Testing: url constructed with %CHANNEL% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
var pb = getPrefBranch();
|
||||||
var defaults = gPrefs.QueryInterface(AUS_Ci.nsIPrefService)
|
pb.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
.getDefaultBranch(null);
|
var defaults = pb.QueryInterface(AUS_Ci.nsIPrefService).getDefaultBranch(null);
|
||||||
defaults.setCharPref(PREF_APP_UPDATE_CHANNEL, "bogus_channel");
|
defaults.setCharPref(PREF_APP_UPDATE_CHANNEL, "bogus_channel");
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
@ -189,9 +197,9 @@ function run_test_pt7() {
|
||||||
gCheckFunc = check_test_pt7;
|
gCheckFunc = check_test_pt7;
|
||||||
var url = URL_PREFIX + "%CHANNEL%/";
|
var url = URL_PREFIX + "%CHANNEL%/";
|
||||||
dump("Testing: url constructed with %CHANNEL% - " + url + "\n");
|
dump("Testing: url constructed with %CHANNEL% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
var pb = getPrefBranch();
|
||||||
var defaults = gPrefs.QueryInterface(AUS_Ci.nsIPrefService)
|
pb.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
.getDefaultBranch(null);
|
var defaults = pb.QueryInterface(AUS_Ci.nsIPrefService).getDefaultBranch(null);
|
||||||
defaults.setCharPref(PREF_PARTNER_BRANCH + "bogus_partner1", "bogus_partner1");
|
defaults.setCharPref(PREF_PARTNER_BRANCH + "bogus_partner1", "bogus_partner1");
|
||||||
defaults.setCharPref(PREF_PARTNER_BRANCH + "bogus_partner2", "bogus_partner2");
|
defaults.setCharPref(PREF_PARTNER_BRANCH + "bogus_partner2", "bogus_partner2");
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
|
@ -207,7 +215,7 @@ function run_test_pt8() {
|
||||||
gCheckFunc = check_test_pt8;
|
gCheckFunc = check_test_pt8;
|
||||||
var url = URL_PREFIX + "%PLATFORM_VERSION%/";
|
var url = URL_PREFIX + "%PLATFORM_VERSION%/";
|
||||||
dump("Testing: url constructed with %PLATFORM_VERSION% - " + url + "\n");
|
dump("Testing: url constructed with %PLATFORM_VERSION% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,14 +229,14 @@ function run_test_pt9() {
|
||||||
gCheckFunc = check_test_pt9;
|
gCheckFunc = check_test_pt9;
|
||||||
var url = URL_PREFIX + "%OS_VERSION%/";
|
var url = URL_PREFIX + "%OS_VERSION%/";
|
||||||
dump("Testing: url constructed with %OS_VERSION% - " + url + "\n");
|
dump("Testing: url constructed with %OS_VERSION% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_test_pt9() {
|
function check_test_pt9() {
|
||||||
var osVersion;
|
var osVersion;
|
||||||
var sysInfo = AUS_Cc["@mozilla.org/system-info;1"]
|
var sysInfo = AUS_Cc["@mozilla.org/system-info;1"].
|
||||||
.getService(AUS_Ci.nsIPropertyBag2);
|
getService(AUS_Ci.nsIPropertyBag2);
|
||||||
osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
|
osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
|
||||||
|
|
||||||
if (osVersion) {
|
if (osVersion) {
|
||||||
|
@ -251,9 +259,9 @@ function run_test_pt10() {
|
||||||
gCheckFunc = check_test_pt10;
|
gCheckFunc = check_test_pt10;
|
||||||
var url = URL_PREFIX + "%DISTRIBUTION%/";
|
var url = URL_PREFIX + "%DISTRIBUTION%/";
|
||||||
dump("Testing: url constructed with %DISTRIBUTION% - " + url + "\n");
|
dump("Testing: url constructed with %DISTRIBUTION% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
var pb = getPrefBranch();
|
||||||
var defaults = gPrefs.QueryInterface(AUS_Ci.nsIPrefService)
|
pb.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
.getDefaultBranch(null);
|
var defaults = pb.QueryInterface(AUS_Ci.nsIPrefService).getDefaultBranch(null);
|
||||||
defaults.setCharPref(PREF_APP_DISTRIBUTION, "bogus_distro");
|
defaults.setCharPref(PREF_APP_DISTRIBUTION, "bogus_distro");
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
@ -268,9 +276,9 @@ function run_test_pt11() {
|
||||||
gCheckFunc = check_test_pt11;
|
gCheckFunc = check_test_pt11;
|
||||||
var url = URL_PREFIX + "%DISTRIBUTION_VERSION%/";
|
var url = URL_PREFIX + "%DISTRIBUTION_VERSION%/";
|
||||||
dump("Testing: url constructed with %DISTRIBUTION_VERSION% - " + url + "\n");
|
dump("Testing: url constructed with %DISTRIBUTION_VERSION% - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
var pb = getPrefBranch();
|
||||||
var defaults = gPrefs.QueryInterface(AUS_Ci.nsIPrefService)
|
pb.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
.getDefaultBranch(null);
|
var defaults = pb.QueryInterface(AUS_Ci.nsIPrefService).getDefaultBranch(null);
|
||||||
defaults.setCharPref(PREF_APP_DISTRIBUTION_VERSION, "bogus_distro_version");
|
defaults.setCharPref(PREF_APP_DISTRIBUTION_VERSION, "bogus_distro_version");
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
@ -285,7 +293,7 @@ function run_test_pt12() {
|
||||||
gCheckFunc = check_test_pt12;
|
gCheckFunc = check_test_pt12;
|
||||||
var url = URL_PREFIX;
|
var url = URL_PREFIX;
|
||||||
dump("Testing: url constructed that doesn't have a parameter - " + url + "\n");
|
dump("Testing: url constructed that doesn't have a parameter - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +307,7 @@ function run_test_pt13() {
|
||||||
gCheckFunc = check_test_pt13;
|
gCheckFunc = check_test_pt13;
|
||||||
var url = URL_PREFIX + "?bogus=param";
|
var url = URL_PREFIX + "?bogus=param";
|
||||||
dump("Testing: url constructed that has a parameter - " + url + "\n");
|
dump("Testing: url constructed that has a parameter - " + url + "\n");
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
|
||||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,14 @@ function run_test() {
|
||||||
removeUpdateDirsAndFiles();
|
removeUpdateDirsAndFiles();
|
||||||
startAUS();
|
startAUS();
|
||||||
startUpdateChecker();
|
startUpdateChecker();
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, URL_HOST + "update.xml");
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE,
|
||||||
|
URL_HOST + "update.xml");
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, "run_test_pt1()");
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
stop_httpserver(do_test_finished);
|
stop_httpserver(do_test_finished);
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom error httpd handler used to return error codes we can't simulate
|
// Custom error httpd handler used to return error codes we can't simulate
|
||||||
|
|
|
@ -51,13 +51,15 @@ function run_test() {
|
||||||
removeUpdateDirsAndFiles();
|
removeUpdateDirsAndFiles();
|
||||||
startAUS();
|
startAUS();
|
||||||
startUpdateChecker();
|
startUpdateChecker();
|
||||||
gPrefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, URL_HOST + "update.xml");
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE,
|
||||||
|
URL_HOST + "update.xml");
|
||||||
overrideXHR(callHandleEvent);
|
overrideXHR(callHandleEvent);
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, "run_test_pt1()");
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback function used by the custom XMLHttpRequest implemetation to
|
// Callback function used by the custom XMLHttpRequest implemetation to
|
||||||
|
|
|
@ -42,8 +42,8 @@ function run_test() {
|
||||||
dump("Testing: addition of a successful update to " + FILE_UPDATES_DB +
|
dump("Testing: addition of a successful update to " + FILE_UPDATES_DB +
|
||||||
" and verification of update properties\n");
|
" and verification of update properties\n");
|
||||||
removeUpdateDirsAndFiles();
|
removeUpdateDirsAndFiles();
|
||||||
var defaults = gPrefs.QueryInterface(AUS_Ci.nsIPrefService)
|
var defaults = getPrefBranch().QueryInterface(AUS_Ci.nsIPrefService).
|
||||||
.getDefaultBranch(null);
|
getDefaultBranch(null);
|
||||||
defaults.setCharPref("app.update.channel", "bogus_channel");
|
defaults.setCharPref("app.update.channel", "bogus_channel");
|
||||||
|
|
||||||
var patches = getLocalPatchString(null, null, null, null, null, null,
|
var patches = getLocalPatchString(null, null, null, null, null, null,
|
||||||
|
@ -114,4 +114,5 @@ function run_test() {
|
||||||
do_check_eq(patch.size, "775");
|
do_check_eq(patch.size, "775");
|
||||||
do_check_true(patch.selected);
|
do_check_true(patch.selected);
|
||||||
do_check_eq(patch.state, STATE_FAILED);
|
do_check_eq(patch.state, STATE_FAILED);
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ function run_test() {
|
||||||
dump("Testing: removal of an update download in progress for an older " +
|
dump("Testing: removal of an update download in progress for an older " +
|
||||||
"version of the application on startup - bug 485624\n");
|
"version of the application on startup - bug 485624\n");
|
||||||
removeUpdateDirsAndFiles();
|
removeUpdateDirsAndFiles();
|
||||||
var defaults = gPrefs.QueryInterface(AUS_Ci.nsIPrefService)
|
var defaults = getPrefBranch().QueryInterface(AUS_Ci.nsIPrefService).
|
||||||
.getDefaultBranch(null);
|
getDefaultBranch(null);
|
||||||
defaults.setCharPref("app.update.channel", "bogus_channel");
|
defaults.setCharPref("app.update.channel", "bogus_channel");
|
||||||
|
|
||||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
||||||
|
@ -59,4 +59,5 @@ function run_test() {
|
||||||
|
|
||||||
do_check_eq(gUpdateManager.activeUpdate, null);
|
do_check_eq(gUpdateManager.activeUpdate, null);
|
||||||
do_check_eq(gUpdateManager.updateCount, 0);
|
do_check_eq(gUpdateManager.updateCount, 0);
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ function run_test() {
|
||||||
dump("Testing: resuming an update download in progress for the same " +
|
dump("Testing: resuming an update download in progress for the same " +
|
||||||
"version of the application on startup - bug 485624\n");
|
"version of the application on startup - bug 485624\n");
|
||||||
removeUpdateDirsAndFiles();
|
removeUpdateDirsAndFiles();
|
||||||
var defaults = gPrefs.QueryInterface(AUS_Ci.nsIPrefService)
|
var defaults = getPrefBranch().QueryInterface(AUS_Ci.nsIPrefService).
|
||||||
.getDefaultBranch(null);
|
getDefaultBranch(null);
|
||||||
defaults.setCharPref("app.update.channel", "bogus_channel");
|
defaults.setCharPref("app.update.channel", "bogus_channel");
|
||||||
|
|
||||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
||||||
|
@ -60,4 +60,5 @@ function run_test() {
|
||||||
|
|
||||||
do_check_eq(gUpdateManager.updateCount, 1);
|
do_check_eq(gUpdateManager.updateCount, 1);
|
||||||
do_check_eq(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING);
|
do_check_eq(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING);
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,8 @@ function run_test() {
|
||||||
dump("Unable to remove directory\npath: " + updatesSubDir.path +
|
dump("Unable to remove directory\npath: " + updatesSubDir.path +
|
||||||
"\nException: " + e + "\n");
|
"\nException: " + e + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Launches the updater binary to apply a mar file
|
// Launches the updater binary to apply a mar file
|
||||||
|
@ -144,8 +146,8 @@ function runUpdate(aUpdatesSubDir, aUpdater) {
|
||||||
if (/ /.test(updatesSubDirPath))
|
if (/ /.test(updatesSubDirPath))
|
||||||
updatesSubDirPath = '"' + updatesSubDirPath + '"';
|
updatesSubDirPath = '"' + updatesSubDirPath + '"';
|
||||||
|
|
||||||
var process = AUS_Cc["@mozilla.org/process/util;1"]
|
var process = AUS_Cc["@mozilla.org/process/util;1"].
|
||||||
.createInstance(AUS_Ci.nsIProcess);
|
createInstance(AUS_Ci.nsIProcess);
|
||||||
process.init(updateBin);
|
process.init(updateBin);
|
||||||
var args = [updatesSubDirPath];
|
var args = [updatesSubDirPath];
|
||||||
process.run(true, args, args.length);
|
process.run(true, args, args.length);
|
||||||
|
@ -165,11 +167,11 @@ function getTestFile(aDir, aLeafName) {
|
||||||
|
|
||||||
// Returns the binary contents of a file
|
// Returns the binary contents of a file
|
||||||
function getFileBytes(aFile) {
|
function getFileBytes(aFile) {
|
||||||
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"]
|
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
|
||||||
.createInstance(AUS_Ci.nsIFileInputStream);
|
createInstance(AUS_Ci.nsIFileInputStream);
|
||||||
fis.init(aFile, -1, -1, false);
|
fis.init(aFile, -1, -1, false);
|
||||||
var bis = AUS_Cc["@mozilla.org/binaryinputstream;1"]
|
var bis = AUS_Cc["@mozilla.org/binaryinputstream;1"].
|
||||||
.createInstance(AUS_Ci.nsIBinaryInputStream);
|
createInstance(AUS_Ci.nsIBinaryInputStream);
|
||||||
bis.setInputStream(fis);
|
bis.setInputStream(fis);
|
||||||
var data = bis.readBytes(bis.available());
|
var data = bis.readBytes(bis.available());
|
||||||
bis.close();
|
bis.close();
|
||||||
|
|
|
@ -133,6 +133,7 @@ function run_test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeUpdateDirsAndFiles();
|
removeUpdateDirsAndFiles();
|
||||||
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Launches the updater binary to apply a mar file
|
// Launches the updater binary to apply a mar file
|
||||||
|
@ -155,8 +156,8 @@ function runUpdate(aUpdatesSubDir, aUpdater) {
|
||||||
if (/ /.test(updatesSubDirPath))
|
if (/ /.test(updatesSubDirPath))
|
||||||
updatesSubDirPath = '"' + updatesSubDirPath + '"';
|
updatesSubDirPath = '"' + updatesSubDirPath + '"';
|
||||||
|
|
||||||
var process = AUS_Cc["@mozilla.org/process/util;1"]
|
var process = AUS_Cc["@mozilla.org/process/util;1"].
|
||||||
.createInstance(AUS_Ci.nsIProcess);
|
createInstance(AUS_Ci.nsIProcess);
|
||||||
process.init(updateBin);
|
process.init(updateBin);
|
||||||
var args = [updatesSubDirPath];
|
var args = [updatesSubDirPath];
|
||||||
process.run(true, args, args.length);
|
process.run(true, args, args.length);
|
||||||
|
@ -176,11 +177,11 @@ function getTestFile(aDir, aLeafName) {
|
||||||
|
|
||||||
// Returns the binary contents of a file
|
// Returns the binary contents of a file
|
||||||
function getFileBytes(aFile) {
|
function getFileBytes(aFile) {
|
||||||
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"]
|
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
|
||||||
.createInstance(AUS_Ci.nsIFileInputStream);
|
createInstance(AUS_Ci.nsIFileInputStream);
|
||||||
fis.init(aFile, -1, -1, false);
|
fis.init(aFile, -1, -1, false);
|
||||||
var bis = AUS_Cc["@mozilla.org/binaryinputstream;1"]
|
var bis = AUS_Cc["@mozilla.org/binaryinputstream;1"].
|
||||||
.createInstance(AUS_Ci.nsIBinaryInputStream);
|
createInstance(AUS_Ci.nsIBinaryInputStream);
|
||||||
bis.setInputStream(fis);
|
bis.setInputStream(fis);
|
||||||
var data = bis.readBytes(bis.available());
|
var data = bis.readBytes(bis.available());
|
||||||
bis.close();
|
bis.close();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче