mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 09:19:28 +00:00
Bug 1168743 - test changes - Only use env vars in the test updater and general app update cleanup. r=mhowell
This commit is contained in:
parent
61a8d4f0c1
commit
da8d36cca8
@ -327,6 +327,16 @@ int NS_main(int argc, NS_tchar **argv)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!NS_tstrcmp(argv[1], NS_T("is-process-running"))) {
|
||||
#ifdef XP_WIN
|
||||
LPCWSTR application = argv[2];
|
||||
return (ERROR_NOT_FOUND == IsProcessRunning(application)) ? 0 : 1;
|
||||
#else
|
||||
// Not implemented on non-Windows platforms
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (NS_tchdir(argv[1]) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
|
||||
gPrefToCheck = PREFBRANCH_APP_UPDATE_NEVER + Services.appinfo.version;
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_CHECKING
|
||||
|
@ -19,7 +19,7 @@
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
|
||||
gPrefToCheck = PREFBRANCH_APP_UPDATE_NEVER + Services.appinfo.version;
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_CHECKING
|
||||
|
@ -19,7 +19,7 @@
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
|
||||
gPrefToCheck = PREFBRANCH_APP_UPDATE_NEVER + Services.appinfo.version;
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_FOUND_BASIC,
|
||||
|
@ -78,12 +78,12 @@ function testXHRLoad(aEvent) {
|
||||
let cert = channel.securityInfo.QueryInterface(Ci.nsISSLStatusProvider).
|
||||
SSLStatus.QueryInterface(Ci.nsISSLStatus).serverCert;
|
||||
CERT_ATTRS.forEach(function(aCertAttrName) {
|
||||
Services.prefs.setCharPref(PREF_APP_UPDATE_CERTS_BRANCH + "1." +
|
||||
Services.prefs.setCharPref(PREFBRANCH_APP_UPDATE_CERTS + "1." +
|
||||
aCertAttrName, cert[aCertAttrName]);
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, true);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES, false);
|
||||
|
||||
let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams();
|
||||
gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL);
|
||||
|
@ -78,12 +78,12 @@ function testXHRLoad(aEvent) {
|
||||
let cert = channel.securityInfo.QueryInterface(Ci.nsISSLStatusProvider).
|
||||
SSLStatus.QueryInterface(Ci.nsISSLStatus).serverCert;
|
||||
CERT_ATTRS.forEach(function(aCertAttrName) {
|
||||
Services.prefs.setCharPref(PREF_APP_UPDATE_CERTS_BRANCH + "1." +
|
||||
Services.prefs.setCharPref(PREFBRANCH_APP_UPDATE_CERTS + "1." +
|
||||
aCertAttrName, cert[aCertAttrName]);
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES, true);
|
||||
|
||||
let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams();
|
||||
gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL);
|
||||
|
@ -35,7 +35,7 @@ function runTest() {
|
||||
"Invalid Attribute Name");
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CERT_ERRORS, 1);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES, false);
|
||||
|
||||
let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams();
|
||||
gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL);
|
||||
|
@ -36,7 +36,7 @@ function runTest() {
|
||||
"Invalid Attribute Name");
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CERT_ERRORS, 1);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES, true);
|
||||
|
||||
let url = URL_HTTPS_UPDATE_XML + "?noUpdates=1";
|
||||
gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL);
|
||||
|
@ -36,7 +36,7 @@ function runTest() {
|
||||
"Invalid Attribute Name");
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CERT_ERRORS, 1);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES, true);
|
||||
|
||||
let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams();
|
||||
gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL);
|
||||
|
@ -33,7 +33,7 @@ function runTest() {
|
||||
Services.prefs.setCharPref(PREF_APP_UPDATE_CERT_INVALID_ATTR_NAME,
|
||||
"Invalid Attribute Name");
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES, true);
|
||||
|
||||
let url = URL_HTTPS_UPDATE_XML + "?noUpdates=1";
|
||||
gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL);
|
||||
|
@ -33,7 +33,7 @@ function runTest() {
|
||||
Services.prefs.setCharPref(PREF_APP_UPDATE_CERT_INVALID_ATTR_NAME,
|
||||
"Invalid Attribute Name");
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES, true);
|
||||
|
||||
let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams();
|
||||
gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL);
|
||||
|
@ -43,7 +43,7 @@ function runTest() {
|
||||
|
||||
function getWriteTestFile() {
|
||||
let file = getAppBaseDir();
|
||||
file.append(FILE_PERMS_TEST);
|
||||
file.append(FILE_UPDATE_TEST);
|
||||
file.QueryInterface(Ci.nsILocalFileWin);
|
||||
if (file.exists()) {
|
||||
file.fileAttributesWin |= file.WFA_READWRITE;
|
||||
|
@ -42,7 +42,7 @@ function runTest() {
|
||||
|
||||
function getWriteTestFile() {
|
||||
let file = getAppBaseDir();
|
||||
file.append(FILE_PERMS_TEST);
|
||||
file.append(FILE_UPDATE_TEST);
|
||||
file.QueryInterface(Ci.nsILocalFileWin);
|
||||
if (file.exists()) {
|
||||
file.fileAttributesWin |= file.WFA_READWRITE;
|
||||
|
@ -64,7 +64,7 @@ function runTest() {
|
||||
ok(!file.exists(), file.path + " should not exist");
|
||||
|
||||
file = dir.clone();
|
||||
file.append(FILE_UPDATE_ARCHIVE);
|
||||
file.append(FILE_UPDATE_MAR);
|
||||
ok(!file.exists(), file.path + " should not exist");
|
||||
|
||||
cleanupRestoreUpdaterBackup();
|
||||
|
@ -990,6 +990,10 @@ function resetPrefs() {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_LOG);
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SILENT)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_SILENT);
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CERT_ERRORS)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_CERT_ERRORS);
|
||||
}
|
||||
@ -1014,13 +1018,13 @@ function resetPrefs() {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN);
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CERT_CHECKATTRS)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_CERT_CHECKATTRS);
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_CERT_CHECKATTRIBUTES);
|
||||
}
|
||||
|
||||
try {
|
||||
CERT_ATTRS.forEach(function(aCertAttrName) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_CERTS_BRANCH + "1." +
|
||||
Services.prefs.clearUserPref(PREFBRANCH_APP_UPDATE_CERTS + "1." +
|
||||
aCertAttrName);
|
||||
});
|
||||
}
|
||||
@ -1028,14 +1032,10 @@ function resetPrefs() {
|
||||
}
|
||||
|
||||
try {
|
||||
Services.prefs.deleteBranch(PREF_APP_UPDATE_NEVER_BRANCH);
|
||||
Services.prefs.deleteBranch(PREFBRANCH_APP_UPDATE_NEVER);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SILENT)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_SILENT);
|
||||
}
|
||||
}
|
||||
|
||||
function setupTimer(aTestTimeout) {
|
||||
|
@ -7,36 +7,38 @@
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const PREF_APP_UPDATE_AUTO = "app.update.auto";
|
||||
const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors";
|
||||
const PREF_APP_UPDATE_BACKGROUNDMAXERRORS = "app.update.backgroundMaxErrors";
|
||||
const PREF_APP_UPDATE_CERTS_BRANCH = "app.update.certs.";
|
||||
const PREF_APP_UPDATE_CERT_CHECKATTRS = "app.update.cert.checkAttributes";
|
||||
const PREF_APP_UPDATE_CERT_ERRORS = "app.update.cert.errors";
|
||||
const PREF_APP_UPDATE_CERT_MAXERRORS = "app.update.cert.maxErrors";
|
||||
const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
|
||||
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
|
||||
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
|
||||
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
|
||||
const PREF_APP_UPDATE_LOG = "app.update.log";
|
||||
const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never.";
|
||||
const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED = "app.update.notifiedUnsupported";
|
||||
const PREF_APP_UPDATE_PROMPTWAITTIME = "app.update.promptWaitTime";
|
||||
const PREF_APP_UPDATE_SERVICE_ENABLED = "app.update.service.enabled";
|
||||
const PREF_APP_UPDATE_SILENT = "app.update.silent";
|
||||
const PREF_APP_UPDATE_STAGING_ENABLED = "app.update.staging.enabled";
|
||||
const PREF_APP_UPDATE_URL = "app.update.url";
|
||||
const PREF_APP_UPDATE_URL_DETAILS = "app.update.url.details";
|
||||
const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override";
|
||||
const PREF_APP_UPDATE_SOCKET_ERRORS = "app.update.socket.maxErrors";
|
||||
const PREF_APP_UPDATE_RETRY_TIMEOUT = "app.update.socket.retryTimeout";
|
||||
const PREF_APP_UPDATE_AUTO = "app.update.auto";
|
||||
const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors";
|
||||
const PREF_APP_UPDATE_BACKGROUNDMAXERRORS = "app.update.backgroundMaxErrors";
|
||||
const PREF_APP_UPDATE_CERT_CHECKATTRIBUTES = "app.update.cert.checkAttributes";
|
||||
const PREF_APP_UPDATE_CERT_ERRORS = "app.update.cert.errors";
|
||||
const PREF_APP_UPDATE_CERT_MAXERRORS = "app.update.cert.maxErrors";
|
||||
const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
|
||||
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
|
||||
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
|
||||
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
|
||||
const PREF_APP_UPDATE_LOG = "app.update.log";
|
||||
const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED = "app.update.notifiedUnsupported";
|
||||
const PREF_APP_UPDATE_PROMPTWAITTIME = "app.update.promptWaitTime";
|
||||
const PREF_APP_UPDATE_RETRYTIMEOUT = "app.update.socket.retryTimeout";
|
||||
const PREF_APP_UPDATE_SERVICE_ENABLED = "app.update.service.enabled";
|
||||
const PREF_APP_UPDATE_SILENT = "app.update.silent";
|
||||
const PREF_APP_UPDATE_SOCKET_MAXERRORS = "app.update.socket.maxErrors";
|
||||
const PREF_APP_UPDATE_STAGING_ENABLED = "app.update.staging.enabled";
|
||||
const PREF_APP_UPDATE_URL = "app.update.url";
|
||||
const PREF_APP_UPDATE_URL_DETAILS = "app.update.url.details";
|
||||
const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override";
|
||||
|
||||
const PREF_APP_UPDATE_CERT_INVALID_ATTR_NAME = PREF_APP_UPDATE_CERTS_BRANCH +
|
||||
const PREFBRANCH_APP_UPDATE_CERTS = "app.update.certs.";
|
||||
const PREFBRANCH_APP_UPDATE_NEVER = "app.update.never.";
|
||||
|
||||
const PREF_APP_UPDATE_CERT_INVALID_ATTR_NAME = PREFBRANCH_APP_UPDATE_CERTS +
|
||||
"1.invalidName";
|
||||
|
||||
const PREF_APP_PARTNER_BRANCH = "app.partner.";
|
||||
const PREF_DISTRIBUTION_ID = "distribution.id";
|
||||
const PREF_DISTRIBUTION_VERSION = "distribution.version";
|
||||
const PREFBRANCH_APP_PARTNER = "app.partner.";
|
||||
const PREF_DISTRIBUTION_ID = "distribution.id";
|
||||
const PREF_DISTRIBUTION_VERSION = "distribution.version";
|
||||
const PREF_TOOLKIT_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
|
||||
|
||||
const NS_APP_PROFILE_DIR_STARTUP = "ProfDS";
|
||||
const NS_APP_USER_PROFILE_50_DIR = "ProfD";
|
||||
@ -54,18 +56,18 @@ const DIR_TOBEDELETED = "tobedeleted";
|
||||
const DIR_UPDATES = "updates";
|
||||
const DIR_UPDATED = IS_MACOSX ? "Updated.app" : "updated";
|
||||
|
||||
const FILE_ACTIVE_UPDATE_XML = "active-update.xml";
|
||||
const FILE_APPLICATION_INI = "application.ini";
|
||||
const FILE_BACKUP_LOG = "backup-update.log";
|
||||
const FILE_LAST_LOG = "last-update.log";
|
||||
const FILE_PERMS_TEST = "update.test";
|
||||
const FILE_UPDATER_INI = "updater.ini";
|
||||
const FILE_UPDATES_DB = "updates.xml";
|
||||
const FILE_UPDATE_ACTIVE = "active-update.xml";
|
||||
const FILE_UPDATE_ARCHIVE = "update.mar";
|
||||
const FILE_UPDATE_LOG = "update.log";
|
||||
const FILE_BACKUP_UPDATE_LOG = "backup-update.log";
|
||||
const FILE_LAST_UPDATE_LOG = "last-update.log";
|
||||
const FILE_UPDATE_SETTINGS_INI = "update-settings.ini";
|
||||
const FILE_UPDATE_SETTINGS_INI_BAK = "update-settings.ini.bak";
|
||||
const FILE_UPDATER_INI = "updater.ini";
|
||||
const FILE_UPDATES_XML = "updates.xml";
|
||||
const FILE_UPDATE_LOG = "update.log";
|
||||
const FILE_UPDATE_MAR = "update.mar";
|
||||
const FILE_UPDATE_STATUS = "update.status";
|
||||
const FILE_UPDATE_TEST = "update.test";
|
||||
const FILE_UPDATE_VERSION = "update.version";
|
||||
|
||||
const UPDATE_SETTINGS_CONTENTS = "[Settings]\n" +
|
||||
@ -73,10 +75,7 @@ const UPDATE_SETTINGS_CONTENTS = "[Settings]\n" +
|
||||
|
||||
const PR_RDWR = 0x04;
|
||||
const PR_CREATE_FILE = 0x08;
|
||||
const PR_APPEND = 0x10;
|
||||
const PR_TRUNCATE = 0x20;
|
||||
const PR_SYNC = 0x40;
|
||||
const PR_EXCL = 0x80;
|
||||
|
||||
const DEFAULT_UPDATE_VERSION = "999999.0";
|
||||
|
||||
@ -87,9 +86,7 @@ Services.scriptloader.loadSubScript(DATA_URI_SPEC + "sharedUpdateXML.js", this);
|
||||
const PERMS_FILE = FileUtils.PERMS_FILE;
|
||||
const PERMS_DIRECTORY = FileUtils.PERMS_DIRECTORY;
|
||||
|
||||
const MODE_RDONLY = FileUtils.MODE_RDONLY;
|
||||
const MODE_WRONLY = FileUtils.MODE_WRONLY;
|
||||
const MODE_RDWR = FileUtils.MODE_RDWR;
|
||||
const MODE_CREATE = FileUtils.MODE_CREATE;
|
||||
const MODE_APPEND = FileUtils.MODE_APPEND;
|
||||
const MODE_TRUNCATE = FileUtils.MODE_TRUNCATE;
|
||||
@ -201,7 +198,7 @@ function setUpdateURLOverride(aURL) {
|
||||
*/
|
||||
function getUpdatesXMLFile(aIsActiveUpdate) {
|
||||
let file = getUpdatesRootDir();
|
||||
file.append(aIsActiveUpdate ? FILE_UPDATE_ACTIVE : FILE_UPDATES_DB);
|
||||
file.append(aIsActiveUpdate ? FILE_ACTIVE_UPDATE_XML : FILE_UPDATES_XML);
|
||||
return file;
|
||||
}
|
||||
|
||||
@ -349,7 +346,9 @@ function readFile(aFile) {
|
||||
if (!aFile.exists()) {
|
||||
return null;
|
||||
}
|
||||
fis.init(aFile, MODE_RDONLY, PERMS_FILE, 0);
|
||||
// Specifying -1 for ioFlags will open the file with the default of PR_RDONLY.
|
||||
// Specifying -1 for perm will open the file with the default of 0.
|
||||
fis.init(aFile, -1, -1, Ci.nsIFileInputStream.CLOSE_ON_EOF);
|
||||
let sis = Cc["@mozilla.org/scriptableinputstream;1"].
|
||||
createInstance(Ci.nsIScriptableInputStream);
|
||||
sis.init(fis);
|
||||
@ -366,9 +365,12 @@ function readFile(aFile) {
|
||||
* @return The contents of the file as a string.
|
||||
*/
|
||||
function readFileBytes(aFile) {
|
||||
debugDump("attempting to read file, path: " + aFile.path);
|
||||
let fis = Cc["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Ci.nsIFileInputStream);
|
||||
fis.init(aFile, -1, -1, false);
|
||||
// Specifying -1 for ioFlags will open the file with the default of PR_RDONLY.
|
||||
// Specifying -1 for perm will open the file with the default of 0.
|
||||
fis.init(aFile, -1, -1, Ci.nsIFileInputStream.CLOSE_ON_EOF);
|
||||
let bis = Cc["@mozilla.org/binaryinputstream;1"].
|
||||
createInstance(Ci.nsIBinaryInputStream);
|
||||
bis.setInputStream(fis);
|
||||
|
@ -40,7 +40,6 @@ const STATE_FAILED_READ_ERROR = STATE_FAILED + ": 6";
|
||||
const STATE_FAILED_WRITE_ERROR = STATE_FAILED + ": 7";
|
||||
const STATE_FAILED_CHANNEL_MISMATCH_ERROR = STATE_FAILED + ": 22";
|
||||
const STATE_FAILED_VERSION_DOWNGRADE_ERROR = STATE_FAILED + ": 23";
|
||||
const STATE_FAILED_WRITE_ERROR_FILE_COPY = STATE_FAILED + ": 61";
|
||||
|
||||
/**
|
||||
* Constructs a string representing a remote update xml file.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -70,8 +70,10 @@ FINAL_TARGET_FILES += [
|
||||
'data/complete.exe',
|
||||
'data/complete.mar',
|
||||
'data/complete.png',
|
||||
'data/complete_log_success',
|
||||
'data/complete_log_success_gonk',
|
||||
'data/complete_log_success_gonk_stage',
|
||||
'data/complete_log_success_mac',
|
||||
'data/complete_log_success_win',
|
||||
'data/complete_mac.mar',
|
||||
'data/complete_precomplete',
|
||||
'data/complete_precomplete_mac',
|
||||
@ -82,16 +84,20 @@ FINAL_TARGET_FILES += [
|
||||
'data/partial.exe',
|
||||
'data/partial.mar',
|
||||
'data/partial.png',
|
||||
'data/partial_log_failure',
|
||||
'data/partial_log_failure_gonk',
|
||||
'data/partial_log_failure_mac',
|
||||
'data/partial_log_success',
|
||||
'data/partial_log_failure_win',
|
||||
'data/partial_log_success_gonk',
|
||||
'data/partial_log_success_gonk_stage',
|
||||
'data/partial_log_success_mac',
|
||||
'data/partial_log_success_win',
|
||||
'data/partial_mac.mar',
|
||||
'data/partial_precomplete',
|
||||
'data/partial_precomplete_mac',
|
||||
'data/partial_removed-files',
|
||||
'data/partial_removed-files_mac',
|
||||
'data/partial_update_manifest',
|
||||
'data/replace_log_success',
|
||||
'data/shared.js',
|
||||
'data/sharedUpdateXML.js',
|
||||
'data/simple.mar',
|
||||
|
@ -15,27 +15,22 @@ function run_test() {
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeStatusFile(STATE_SUCCEEDED);
|
||||
|
||||
let dir = getUpdatesDir();
|
||||
let log = dir.clone();
|
||||
log.append(DIR_PATCH);
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
let log = getUpdateLog(FILE_UPDATE_LOG);
|
||||
writeFile(log, "Last Update Log");
|
||||
|
||||
standardInit();
|
||||
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = dir.clone();
|
||||
log.append(FILE_LAST_LOG);
|
||||
log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.equal(readFile(log), "Last Update Log",
|
||||
"the last update log contents" + MSG_SHOULD_EQUAL);
|
||||
|
||||
log = dir.clone();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
dir.append(DIR_PATCH);
|
||||
let dir = getUpdatesPatchDir();
|
||||
Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
|
||||
|
||||
doTestFinish();
|
||||
|
@ -15,37 +15,30 @@ function run_test() {
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeStatusFile(STATE_SUCCEEDED);
|
||||
|
||||
let dir = getUpdatesDir();
|
||||
let log = dir.clone();
|
||||
log.append(FILE_LAST_LOG);
|
||||
let log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
writeFile(log, "Backup Update Log");
|
||||
|
||||
log = dir.clone();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
writeFile(log, "To Be Deleted Backup Update Log");
|
||||
|
||||
log = dir.clone();
|
||||
log.append(DIR_PATCH);
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
log = getUpdateLog(FILE_UPDATE_LOG);
|
||||
writeFile(log, "Last Update Log");
|
||||
|
||||
standardInit();
|
||||
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = dir.clone();
|
||||
log.append(FILE_LAST_LOG);
|
||||
log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.equal(readFile(log), "Last Update Log",
|
||||
"the last update log contents" + MSG_SHOULD_EQUAL);
|
||||
|
||||
log = dir.clone();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.equal(readFile(log), "Backup Update Log",
|
||||
"the backup update log contents" + MSG_SHOULD_EQUAL);
|
||||
|
||||
dir.append(DIR_PATCH);
|
||||
let dir = getUpdatesPatchDir();
|
||||
Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
|
||||
|
||||
doTestFinish();
|
||||
|
@ -227,8 +227,8 @@ function run_test_pt1() {
|
||||
// Test disconnecting during an update
|
||||
function run_test_pt2() {
|
||||
gIncrementalDownloadErrorType = 0;
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_SOCKET_ERRORS, 2);
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_RETRY_TIMEOUT, 0);
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_SOCKET_MAXERRORS, 2);
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_RETRYTIMEOUT, 0);
|
||||
setResponseBody("MD5", MD5_HASH_SIMPLE_MAR);
|
||||
|
||||
let expectedResult;
|
||||
|
@ -2,4 +2,6 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
const IS_SERVICE_TEST = false;
|
||||
|
||||
load("../data/xpcshellUtilsAUS.js");
|
||||
|
@ -6,7 +6,7 @@
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
|
||||
debugDump("testing addition of a successful update to " + FILE_UPDATES_DB +
|
||||
debugDump("testing addition of a successful update to " + FILE_UPDATES_XML +
|
||||
" and verification of update properties including the format " +
|
||||
"prior to bug 530872");
|
||||
|
||||
|
@ -171,9 +171,9 @@ function run_test_pt7() {
|
||||
let url = URL_PREFIX + "%CHANNEL%/";
|
||||
debugDump("testing url constructed with %CHANNEL% - " + url);
|
||||
setUpdateURLOverride(url);
|
||||
gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner1",
|
||||
gDefaultPrefBranch.setCharPref(PREFBRANCH_APP_PARTNER + "test_partner1",
|
||||
"test_partner1");
|
||||
gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner2",
|
||||
gDefaultPrefBranch.setCharPref(PREFBRANCH_APP_PARTNER + "test_partner2",
|
||||
"test_partner2");
|
||||
gUpdateChecker.checkForUpdates(updateCheckListener, true);
|
||||
}
|
||||
|
@ -31,8 +31,6 @@ skip-if = toolkit != 'gonk'
|
||||
[uiSilentPref.js]
|
||||
skip-if = toolkit == 'gonk'
|
||||
reason = custom nsIUpdatePrompt
|
||||
;skip-if = toolkit == 'gonk'
|
||||
;reason = custom nsIUpdatePrompt
|
||||
[uiUnsupportedAlreadyNotified.js]
|
||||
skip-if = toolkit == 'gonk'
|
||||
reason = custom nsIUpdatePrompt
|
||||
|
@ -2,4 +2,6 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
const IS_SERVICE_TEST = false;
|
||||
|
||||
load("../data/xpcshellUtilsAUS.js");
|
||||
|
@ -7,79 +7,36 @@
|
||||
* apply it.
|
||||
*/
|
||||
|
||||
const START_STATE = STATE_PENDING;
|
||||
const END_STATE = STATE_PENDING;
|
||||
const STATE_AFTER_STAGE = STATE_PENDING;
|
||||
|
||||
function run_test() {
|
||||
if (MOZ_APP_NAME == "xulrunner") {
|
||||
logTestInfo("Unable to run this test on xulrunner");
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
createUpdaterINI(false);
|
||||
|
||||
if (IS_WIN) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
|
||||
}
|
||||
|
||||
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
let patches = getLocalPatchString(null, null, null, null, null, "true",
|
||||
START_STATE);
|
||||
let updates = getLocalUpdateString(patches, null, null, null, null, null,
|
||||
null, null, null, null, null, null,
|
||||
"true", channel);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeVersionFile(getAppVersion());
|
||||
writeStatusFile(START_STATE);
|
||||
|
||||
reloadUpdateManagerData();
|
||||
Assert.ok(!!gUpdateManager.activeUpdate,
|
||||
"the active update should be defined");
|
||||
|
||||
lockDirectory(getAppBaseDir());
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
resetEnvironment();
|
||||
createUpdateInProgressLockFile(getAppBaseDir());
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if staging the update has failed.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
// Don't proceed until the update has failed, and reset to pending.
|
||||
if (gUpdateManager.activeUpdate.state != END_STATE) {
|
||||
if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"active update status state to equal: " +
|
||||
END_STATE +
|
||||
", current state: " + gUpdateManager.activeUpdate.state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
do_timeout(TEST_CHECK_TIMEOUT, finishTest);
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
Assert.equal(readStatusState(), END_STATE,
|
||||
"the status state" + MSG_SHOULD_EQUAL);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
unlockDirectory(getAppBaseDir());
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
removeUpdateInProgressLockFile(getAppBaseDir());
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(PERFORMING_STAGED_UPDATE);
|
||||
checkUpdateLogContains(ERR_UPDATE_IN_PROGRESS);
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -7,244 +7,69 @@
|
||||
* apply it.
|
||||
*/
|
||||
|
||||
const START_STATE = STATE_PENDING;
|
||||
const END_STATE = STATE_APPLIED;
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (MOZ_APP_NAME == "xulrunner") {
|
||||
logTestInfo("Unable to run this test on xulrunner");
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
createUpdaterINI(true);
|
||||
|
||||
if (IS_WIN) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
|
||||
}
|
||||
|
||||
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
let patches = getLocalPatchString(null, null, null, null, null, "true",
|
||||
START_STATE);
|
||||
let updates = getLocalUpdateString(patches, null, null, null, null, null,
|
||||
null, null, null, null, null, null,
|
||||
"true", channel);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeVersionFile(getAppVersion());
|
||||
writeStatusFile(START_STATE);
|
||||
|
||||
reloadUpdateManagerData();
|
||||
Assert.ok(!!gUpdateManager.activeUpdate,
|
||||
"the active update should be defined");
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, undefined);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
setAppBundleModTime();
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function customLaunchAppToApplyUpdate() {
|
||||
debugDump("start - locking installation directory");
|
||||
const LPCWSTR = ctypes.char16_t.ptr;
|
||||
const DWORD = ctypes.uint32_t;
|
||||
const LPVOID = ctypes.voidptr_t;
|
||||
const GENERIC_READ = 0x80000000;
|
||||
const FILE_SHARE_READ = 1;
|
||||
const FILE_SHARE_WRITE = 2;
|
||||
const OPEN_EXISTING = 3;
|
||||
const FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
|
||||
const INVALID_HANDLE_VALUE = LPVOID(0xffffffff);
|
||||
let kernel32 = ctypes.open("kernel32");
|
||||
let CreateFile = kernel32.declare("CreateFileW", ctypes.default_abi,
|
||||
LPVOID, LPCWSTR, DWORD, DWORD,
|
||||
LPVOID, DWORD, DWORD, LPVOID);
|
||||
gHandle = CreateFile(getAppBaseDir().path, GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, LPVOID(0),
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, LPVOID(0));
|
||||
Assert.notEqual(gHandle.toString(), INVALID_HANDLE_VALUE.toString(),
|
||||
"the handle should not equal INVALID_HANDLE_VALUE");
|
||||
kernel32.close();
|
||||
debugDump("finish - locking installation directory");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished being staged.
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the active update's state is the expected value.
|
||||
if (gUpdateManager.activeUpdate.state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"active update status state to equal: " +
|
||||
END_STATE +
|
||||
", current state: " + gUpdateManager.activeUpdate.state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update" +
|
||||
"status file state to equal: " +
|
||||
END_STATE +
|
||||
", current status state: " + state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the last update log has been created.
|
||||
let log;
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
log = getUpdatesDir();
|
||||
} else {
|
||||
log = getStageDirFile(null, true);
|
||||
log.append(DIR_UPDATES);
|
||||
}
|
||||
log.append(FILE_LAST_LOG);
|
||||
if (!log.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
|
||||
"to be created. Path: " + log.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
|
||||
log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
} else {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
}
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
|
||||
Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
} else {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
}
|
||||
|
||||
log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
// Switch the application to the staged application that was updated by
|
||||
// launching the application.
|
||||
do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
lockDirectory(getAppBaseDir().path);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdateUsingApp(STATE_SUCCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Called after the call to runUpdateUsingApp finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateFinished;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateFinished();
|
||||
}
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function finishCheckUpdateFinished() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != STATE_SUCCEEDED) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"update status file state to equal: " +
|
||||
STATE_SUCCEEDED +
|
||||
", current status state: " + state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the application was switched out with the staged update
|
||||
// successfully.
|
||||
let updatedDir = getStageDirFile(null, true);
|
||||
if (updatedDir.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
|
||||
"directory to not exist. Path: " + updatedDir.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_WIN) {
|
||||
// Don't proceed until the updater binary is no longer in use.
|
||||
let updater = getUpdatesPatchDir();
|
||||
updater.append(FILE_UPDATER_BIN);
|
||||
if (updater.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"updater binary to no longer be in use");
|
||||
}
|
||||
try {
|
||||
updater.remove(false);
|
||||
} catch (e) {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkPostUpdateRunningFile(true);
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
|
||||
standardInit();
|
||||
|
||||
let update = gUpdateManager.getUpdateAt(0);
|
||||
Assert.equal(update.state, STATE_SUCCEEDED,
|
||||
"the update state" + MSG_SHOULD_EQUAL);
|
||||
|
||||
let updatesDir = getUpdatesPatchDir();
|
||||
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(updatesDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(updatesDir.path));
|
||||
|
||||
let log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
let log = getUpdateLog(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -7,226 +7,68 @@
|
||||
* apply it.
|
||||
*/
|
||||
|
||||
const START_STATE = STATE_PENDING;
|
||||
const END_STATE = STATE_APPLIED;
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (MOZ_APP_NAME == "xulrunner") {
|
||||
logTestInfo("Unable to run this test on xulrunner");
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
createUpdaterINI(false);
|
||||
|
||||
if (IS_WIN) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
|
||||
}
|
||||
|
||||
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
let patches = getLocalPatchString(null, null, null, null, null, "true",
|
||||
START_STATE);
|
||||
let updates = getLocalUpdateString(patches, null, null, null, null, null,
|
||||
null, null, null, null, null, null,
|
||||
"true", channel);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeVersionFile(getAppVersion());
|
||||
writeStatusFile(START_STATE);
|
||||
|
||||
reloadUpdateManagerData();
|
||||
Assert.ok(!!gUpdateManager.activeUpdate,
|
||||
"the active update should be defined");
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, true);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
setAppBundleModTime();
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished being staged.
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the active update's state is the expected value.
|
||||
if (gUpdateManager.activeUpdate.state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"active update status state to equal: " +
|
||||
END_STATE +
|
||||
", current state: " + gUpdateManager.activeUpdate.state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
|
||||
"status state to equal: " +
|
||||
END_STATE +
|
||||
", current status state: " + state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the last update log has been created.
|
||||
let log;
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
log = getUpdatesDir();
|
||||
} else {
|
||||
log = getStageDirFile(null, true);
|
||||
log.append(DIR_UPDATES);
|
||||
}
|
||||
log.append(FILE_LAST_LOG);
|
||||
if (!log.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
|
||||
"to be created. Path: " + log.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
|
||||
log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
} else {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
}
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
|
||||
Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
} else {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
}
|
||||
|
||||
log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
// Switch the application to the staged application that was updated by
|
||||
// launching the application.
|
||||
do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdateUsingApp(STATE_SUCCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Called after the call to runUpdateUsingApp finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateApplied;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateApplied();
|
||||
}
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function finishCheckUpdateApplied() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != STATE_SUCCEEDED) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"update status file state to equal: " +
|
||||
STATE_SUCCEEDED +
|
||||
", current status state: " + state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the application was switched out with the staged update
|
||||
// successfully.
|
||||
let updatedDir = getStageDirFile(null, true);
|
||||
if (updatedDir.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
|
||||
"directory to not exist. Path: " + updatedDir.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_WIN) {
|
||||
// Don't proceed until the updater binary is no longer in use.
|
||||
let updater = getUpdatesPatchDir();
|
||||
updater.append(FILE_UPDATER_BIN);
|
||||
if (updater.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"updater binary to no longer be in use");
|
||||
}
|
||||
try {
|
||||
updater.remove(false);
|
||||
} catch (e) {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkPostUpdateRunningFile(true);
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
gSwitchApp = true;
|
||||
checkUpdateLogContents();
|
||||
gSwitchApp = false;
|
||||
|
||||
standardInit();
|
||||
|
||||
let update = gUpdateManager.getUpdateAt(0);
|
||||
Assert.equal(update.state, STATE_SUCCEEDED,
|
||||
"the update state" + MSG_SHOULD_EQUAL);
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
|
||||
let updatesDir = getUpdatesPatchDir();
|
||||
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(updatesDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(updatesDir.path));
|
||||
|
||||
let log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
let log = getUpdateLog(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
} else {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
}
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -7,126 +7,55 @@
|
||||
* apply it.
|
||||
*/
|
||||
|
||||
const START_STATE = STATE_PENDING;
|
||||
const END_STATE = STATE_SUCCEEDED;
|
||||
|
||||
function run_test() {
|
||||
if (MOZ_APP_NAME == "xulrunner") {
|
||||
logTestInfo("Unable to run this test on xulrunner");
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
createUpdaterINI();
|
||||
setAppBundleModTime();
|
||||
|
||||
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
let patches = getLocalPatchString(null, null, null, null, null, "true",
|
||||
START_STATE);
|
||||
let updates = getLocalUpdateString(patches, null, null, null, null, null,
|
||||
null, null, null, null, null, null,
|
||||
"true", channel);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeVersionFile(getAppVersion());
|
||||
writeStatusFile(START_STATE);
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateFinished;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateFinished();
|
||||
}
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdateUsingApp(STATE_SUCCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to runUpdateUsingApp finishes.
|
||||
*/
|
||||
function finishCheckUpdateFinished() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
|
||||
"status state to equal: " + END_STATE +
|
||||
", current status state: " + state);
|
||||
} else {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the update log has been created.
|
||||
let log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
if (!log.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
|
||||
"to be created. Path: " + log.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_WIN) {
|
||||
// Don't proceed until the updater binary is no longer in use.
|
||||
let updater = getUpdatesPatchDir();
|
||||
updater.append(FILE_UPDATER_BIN);
|
||||
if (updater.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded while waiting for updater binary to no longer be " +
|
||||
"in use");
|
||||
}
|
||||
try {
|
||||
updater.remove(false);
|
||||
} catch (e) {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
|
||||
standardInit();
|
||||
|
||||
let update = gUpdateManager.getUpdateAt(0);
|
||||
Assert.equal(update.state, END_STATE,
|
||||
"the update state" + MSG_SHOULD_EQUAL);
|
||||
|
||||
let updatesDir = getUpdatesPatchDir();
|
||||
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(updatesDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(updatesDir.path));
|
||||
|
||||
log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
let log = getUpdateLog(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
|
||||
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -4,46 +4,59 @@
|
||||
|
||||
/* Application in use complete MAR file staged patch apply failure test */
|
||||
|
||||
const START_STATE = STATE_APPLIED;
|
||||
const END_STATE = STATE_PENDING;
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Launch the callback helper application so it is in use during the update.
|
||||
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
callbackAppProcess.init(callbackApp);
|
||||
callbackAppProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
createUpdaterINI(false);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, START_STATE, null);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, END_STATE, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,19 +4,78 @@
|
||||
|
||||
/* Application in use complete MAR file staged patch apply success test */
|
||||
|
||||
const START_STATE = STATE_PENDING;
|
||||
const STATE_AFTER_STAGE = STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestFiles[gTestFiles.length - 1].originalContents = null;
|
||||
gTestFiles[gTestFiles.length - 1].compareContents = "FromComplete\n";
|
||||
gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, true);
|
||||
}
|
||||
|
||||
createUpdaterINI(false);
|
||||
setAppBundleModTime();
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
setupSymLinks();
|
||||
runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkSymLinks();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
standardInit();
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup symlinks for the test.
|
||||
*/
|
||||
function setupSymLinks() {
|
||||
// The tests don't support symlinks on gonk.
|
||||
if (IS_UNIX && !IS_TOOLKIT_GONK) {
|
||||
removeSymlink();
|
||||
@ -35,101 +94,14 @@ function run_test() {
|
||||
comparePerms : 0o666
|
||||
});
|
||||
}
|
||||
|
||||
// Launch the callback helper application so it is in use during the update
|
||||
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
|
||||
callbackApp.permissions = PERMS_DIRECTORY;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
callbackAppProcess.init(callbackApp);
|
||||
callbackAppProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
checkPostUpdateRunningFile(false);
|
||||
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
do_timeout(TEST_CHECK_TIMEOUT, function() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the symlinks for the test.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateApplied;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateApplied();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateApplied() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
setupHelperFinish();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
function checkSymLinks() {
|
||||
// The tests don't support symlinks on gonk.
|
||||
if (IS_UNIX && !IS_TOOLKIT_GONK) {
|
||||
checkSymlink();
|
||||
}
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
}
|
||||
|
||||
function runHelperProcess(args) {
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let process = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
process.init(helperBin);
|
||||
debugDump("Running " + helperBin.path + " " + args.join(" "));
|
||||
process.run(true, args, args.length);
|
||||
Assert.equal(process.exitValue, 0,
|
||||
"the helper process exit value should be 0");
|
||||
}
|
||||
|
||||
function createSymlink() {
|
||||
let args = ["setup-symlink", "moz-foo", "moz-bar", "target",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
getApplyDirFile(DIR_RESOURCES + "link", false).permissions = 0o666;
|
||||
|
||||
args = ["setup-symlink", "moz-foo2", "moz-bar2", "target2",
|
||||
getApplyDirFile().path +"/" + DIR_RESOURCES + "link2", "change-perm"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
||||
function removeSymlink() {
|
||||
let args = ["remove-symlink", "moz-foo", "moz-bar", "target",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
args = ["remove-symlink", "moz-foo2", "moz-bar2", "target2",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link2"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
||||
function checkSymlink() {
|
||||
let args = ["check-symlink",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
@ -5,37 +5,50 @@
|
||||
/* Application in use complete MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Launch the callback helper application so it is in use during the update.
|
||||
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
|
||||
callbackApp.permissions = PERMS_DIRECTORY;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
callbackAppProcess.init(callbackApp);
|
||||
callbackAppProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
setAppBundleModTime();
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,25 +4,50 @@
|
||||
|
||||
/* Replace app binary complete MAR file staged patch apply success test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
gCallbackBinFile = "exe0.exe";
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,25 +4,50 @@
|
||||
|
||||
/* Patch app binary partial MAR file staged patch apply success test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
gCallbackBinFile = "exe0.exe";
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,18 +5,36 @@
|
||||
/* Replace app binary complete MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
gCallbackBinFile = "exe0.exe";
|
||||
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,18 +5,36 @@
|
||||
/* Patch app binary partial MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
gCallbackBinFile = "exe0.exe";
|
||||
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -6,30 +6,34 @@
|
||||
/* General Partial MAR File Patch Apply Failure Test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestFiles[11].originalFile = "partial.png";
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
createUpdaterINI();
|
||||
setAppBundleModTime();
|
||||
|
||||
// Note that on platforms where we use execv, we cannot trust the return code.
|
||||
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE,
|
||||
checkUpdateFinished);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
function setupUpdaterTestFinished() {
|
||||
// If execv is used the updater process will turn into the callback process
|
||||
// and the updater's return code will be that of the callback process.
|
||||
runUpdate(STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, false,
|
||||
(USE_EXECV ? 0 : 1), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkAppBundleModTime();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,44 +4,59 @@
|
||||
|
||||
/* File in use complete MAR file staged patch apply failure test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let fileInUseBin = getApplyDirFile(gTestFiles[13].relPathDir +
|
||||
gTestFiles[13].fileName);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName,
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,44 +4,59 @@
|
||||
|
||||
/* File in use partial MAR file staged patch apply failure test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let fileInUseBin = getApplyDirFile(gTestFiles[11].relPathDir +
|
||||
gTestFiles[11].fileName);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName,
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,35 +5,50 @@
|
||||
/* File in use complete MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let fileInUseBin = getApplyDirFile(gTestFiles[13].relPathDir +
|
||||
gTestFiles[13].fileName);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName,
|
||||
false);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContains(ERR_BACKUP_DISCARD);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,35 +5,50 @@
|
||||
/* File in use partial MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let fileInUseBin = getApplyDirFile(gTestFiles[11].relPathDir +
|
||||
gTestFiles[11].fileName);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName,
|
||||
false);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContains(ERR_BACKUP_DISCARD);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,45 +5,43 @@
|
||||
/* File locked complete MAR file patch apply failure test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Exclusively lock an existing file so it is in use during the update.
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
|
||||
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
|
||||
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
|
||||
// Strip off the first two directories so the path has to be from the helper's
|
||||
// working directory.
|
||||
let lockFileRelPath = gTestFiles[3].relPathDir.split("/");
|
||||
if (IS_MACOSX) {
|
||||
lockFileRelPath = lockFileRelPath.slice(2);
|
||||
}
|
||||
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
|
||||
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
lockFileProcess.init(helperBin);
|
||||
lockFileProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateFinished);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperLockFile(gTestFiles[3]);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_FAILED_WRITE_ERROR, false, 1, true);
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,45 +5,43 @@
|
||||
/* File locked partial MAR file patch apply failure test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
// Exclusively lock an existing file so it is in use during the update.
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
|
||||
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
|
||||
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
|
||||
// Strip off the first two directories so the path has to be from the helper's
|
||||
// working directory.
|
||||
let lockFileRelPath = gTestFiles[2].relPathDir.split("/");
|
||||
if (IS_MACOSX) {
|
||||
lockFileRelPath = lockFileRelPath.slice(2);
|
||||
}
|
||||
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
|
||||
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
lockFileProcess.init(helperBin);
|
||||
lockFileProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(1, STATE_FAILED_READ_ERROR, checkUpdateFinished);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperLockFile(gTestFiles[2]);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_FAILED_READ_ERROR, false, 1, true);
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,53 +4,60 @@
|
||||
|
||||
/* File locked complete MAR file staged patch apply failure test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_PENDING : STATE_APPLYING;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Exclusively lock an existing file so it is in use during the update.
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
|
||||
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
|
||||
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
|
||||
// Strip off the first two directories so the path has to be from the helper's
|
||||
// working directory.
|
||||
let lockFileRelPath = gTestFiles[3].relPathDir.split("/");
|
||||
if (IS_MACOSX) {
|
||||
lockFileRelPath = lockFileRelPath.slice(2);
|
||||
}
|
||||
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
|
||||
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
lockFileProcess.init(helperBin);
|
||||
lockFileProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperLockFile(gTestFiles[3]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
// Files aren't checked after staging since this test locks a file which
|
||||
// prevents reading the file.
|
||||
checkUpdateLogContains(ERR_ENSURE_COPY);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_FAILED_WRITE_ERROR, false, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_BACKUP_CREATE_7);
|
||||
checkUpdateLogContains(STATE_FAILED_WRITE_ERROR + "\n" + CALL_QUIT);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,53 +4,59 @@
|
||||
|
||||
/* File locked partial MAR file staged patch apply failure test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_PENDING : STATE_APPLYING;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
// Exclusively lock an existing file so it is in use during the update.
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
|
||||
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
|
||||
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
|
||||
// Strip off the first two directories so the path has to be from the helper's
|
||||
// working directory.
|
||||
let lockFileRelPath = gTestFiles[2].relPathDir.split("/");
|
||||
if (IS_MACOSX) {
|
||||
lockFileRelPath = lockFileRelPath.slice(2);
|
||||
}
|
||||
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
|
||||
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
lockFileProcess.init(helperBin);
|
||||
lockFileProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperLockFile(gTestFiles[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
// Files aren't checked after staging since this test locks a file which
|
||||
// prevents reading the file.
|
||||
checkUpdateLogContains(ERR_ENSURE_COPY);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_FAILED_READ_ERROR, false, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
|
||||
checkUpdateLogContains(STATE_FAILED_READ_ERROR + "\n" + CALL_QUIT);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,53 +5,59 @@
|
||||
/* File in use inside removed dir complete MAR file staged patch apply failure
|
||||
test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir +
|
||||
gTestDirs[4].subDirs[0] +
|
||||
gTestDirs[4].subDirFiles[0]);
|
||||
// Remove the empty file created for the test so the helper application can
|
||||
// replace it.
|
||||
fileInUseBin.remove(false);
|
||||
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir +
|
||||
gTestDirs[4].subDirs[0]);
|
||||
helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] +
|
||||
gTestDirs[4].subDirFiles[0], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,52 +5,58 @@
|
||||
/* File in use inside removed dir partial MAR file staged patch apply failure
|
||||
test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
let fileInUseBin = getApplyDirFile(gTestDirs[2].relPathDir +
|
||||
gTestDirs[2].files[0]);
|
||||
// Remove the empty file created for the test so the helper application can
|
||||
// replace it.
|
||||
fileInUseBin.remove(false);
|
||||
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let fileInUseDir = getApplyDirFile(gTestDirs[2].relPathDir);
|
||||
helperBin.copyTo(fileInUseDir, gTestDirs[2].files[0]);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,45 +5,50 @@
|
||||
/* File in use inside removed dir complete MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir +
|
||||
gTestDirs[4].subDirs[0] +
|
||||
gTestDirs[4].subDirFiles[0]);
|
||||
// Remove the empty file created for the test so the helper application can
|
||||
// replace it.
|
||||
fileInUseBin.remove(false);
|
||||
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir +
|
||||
gTestDirs[4].subDirs[0]);
|
||||
helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] +
|
||||
gTestDirs[4].subDirFiles[0], true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContains(ERR_BACKUP_DISCARD);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,43 +5,49 @@
|
||||
/* File in use inside removed dir partial MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
let fileInUseBin = getApplyDirFile(gTestDirs[2].relPathDir +
|
||||
gTestDirs[2].files[0]);
|
||||
// Remove the empty file created for the test so the helper application can
|
||||
// replace it.
|
||||
fileInUseBin.remove(false);
|
||||
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let fileInUseDir = getApplyDirFile(gTestDirs[2].relPathDir);
|
||||
helperBin.copyTo(fileInUseDir, gTestDirs[2].files[0]);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContains(ERR_BACKUP_DISCARD);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,28 +5,33 @@
|
||||
|
||||
/* General Partial MAR File Staged Patch Apply Failure Test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_PENDING : STATE_APPLYING;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestFiles[11].originalFile = "partial.png";
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
createUpdaterINI(true);
|
||||
|
||||
runUpdate(1, STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, checkUpdateFinished);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_LOADSOURCEFILE_FAILED);
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -5,15 +5,65 @@
|
||||
|
||||
/* General Complete MAR File Staged Patch Apply Test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestFiles[gTestFiles.length - 1].originalContents = null;
|
||||
gTestFiles[gTestFiles.length - 1].compareContents = "FromComplete\n";
|
||||
gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
setupDistributionDir();
|
||||
setupSymLinks();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkSymLinks();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
checkDistributionDir();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the state of the distribution directory for the test.
|
||||
*/
|
||||
function setupDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
// Create files in the old distribution directory location to verify that
|
||||
// the directory and its contents are removed when there is a distribution
|
||||
@ -23,10 +73,24 @@ function run_test() {
|
||||
testFile = getApplyDirFile(DIR_MACOS + "distribution/test1/testFile", true);
|
||||
writeFile(testFile, "test\n");
|
||||
}
|
||||
}
|
||||
|
||||
createUpdaterINI(false);
|
||||
setAppBundleModTime();
|
||||
/**
|
||||
* Checks the state of the distribution directory for the test.
|
||||
*/
|
||||
function checkDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
checkUpdateLogContains(REMOVE_OLD_DIST_DIR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup symlinks for the test.
|
||||
*/
|
||||
function setupSymLinks() {
|
||||
// Don't test symlinks on Mac OS X in this test since it tends to timeout.
|
||||
// It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js
|
||||
// The tests don't support symlinks on gonk.
|
||||
@ -47,91 +111,14 @@ function run_test() {
|
||||
comparePerms : 0o666
|
||||
});
|
||||
}
|
||||
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
checkPostUpdateRunningFile(false);
|
||||
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
do_timeout(TEST_CHECK_TIMEOUT, function() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the symlinks for the test.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateApplied;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateApplied();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateApplied() {
|
||||
checkPostUpdateRunningFile(true);
|
||||
|
||||
if (IS_MACOSX) {
|
||||
let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
checkUpdateLogContains("removing old distribution directory");
|
||||
}
|
||||
|
||||
function checkSymLinks() {
|
||||
// The tests don't support symlinks on gonk.
|
||||
if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) {
|
||||
checkSymlink();
|
||||
}
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
}
|
||||
|
||||
function runHelperProcess(args) {
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let process = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
process.init(helperBin);
|
||||
debugDump("Running " + helperBin.path + " " + args.join(" "));
|
||||
process.run(true, args, args.length);
|
||||
Assert.equal(process.exitValue, 0,
|
||||
"the helper process exit value should be 0");
|
||||
}
|
||||
|
||||
function createSymlink() {
|
||||
let args = ["setup-symlink", "moz-foo", "moz-bar", "target",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
getApplyDirFile(DIR_RESOURCES + "link", false).permissions = 0o666;
|
||||
|
||||
args = ["setup-symlink", "moz-foo2", "moz-bar2", "target2",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link2", "change-perm"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
||||
function removeSymlink() {
|
||||
let args = ["remove-symlink", "moz-foo", "moz-bar", "target",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
args = ["remove-symlink", "moz-foo2", "moz-bar2", "target2",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link2"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
||||
function checkSymlink() {
|
||||
let args = ["check-symlink",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
@ -5,16 +5,64 @@
|
||||
|
||||
/* General Partial MAR File Staged Patch Apply Test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestFiles[gTestFiles.length - 2].originalContents = null;
|
||||
gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n";
|
||||
gTestFiles[gTestFiles.length - 2].comparePerms = 0o644;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
preventDistributionFiles();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
setupDistributionDir();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true, false, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true, true);
|
||||
checkDistributionDir();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the state of the distribution directory for the test.
|
||||
*/
|
||||
function setupDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
// Create files in the old distribution directory location to verify that
|
||||
// the directory and its contents are moved to the new location on update.
|
||||
@ -23,67 +71,34 @@ function run_test() {
|
||||
testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
|
||||
writeFile(testFile, "test\n");
|
||||
}
|
||||
|
||||
createUpdaterINI(false);
|
||||
setAppBundleModTime();
|
||||
|
||||
runUpdate(0, STATE_APPLIED, null);
|
||||
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
|
||||
checkPostUpdateRunningFile(false);
|
||||
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
do_timeout(TEST_CHECK_TIMEOUT, function() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the distribution directory.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateApplied;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateApplied();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateApplied() {
|
||||
checkPostUpdateRunningFile(true);
|
||||
|
||||
function checkDistributionDir() {
|
||||
let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
|
||||
if (IS_MACOSX) {
|
||||
Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(distributionDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(distributionDir.path));
|
||||
|
||||
let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
|
||||
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(testFile.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(testFile.path));
|
||||
|
||||
testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
|
||||
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(testFile.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(testFile.path));
|
||||
|
||||
distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
|
||||
checkUpdateLogContains("Moving old distribution directory to new location");
|
||||
checkUpdateLogContains(MOVE_OLD_DIST_DIR);
|
||||
} else {
|
||||
debugDump("testing that files aren't added with an add-if instruction " +
|
||||
"when the file's destination directory doesn't exist");
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
}
|
||||
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
}
|
||||
|
@ -6,11 +6,47 @@
|
||||
/* General Complete MAR File Patch Apply Test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
preventDistributionFiles();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
setupDistributionDir();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS, false, false, true);
|
||||
checkDistributionDir();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the state of the distribution directory for the test.
|
||||
*/
|
||||
function setupDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
// Create files in the old distribution directory location to verify that
|
||||
// the directory and its contents are moved to the new location on update.
|
||||
@ -19,54 +55,34 @@ function run_test() {
|
||||
testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
|
||||
writeFile(testFile, "test\n");
|
||||
}
|
||||
|
||||
createUpdaterINI();
|
||||
setAppBundleModTime();
|
||||
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the distribution directory.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateFinished;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateFinished() {
|
||||
function checkDistributionDir() {
|
||||
let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
|
||||
if (IS_MACOSX) {
|
||||
Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(distributionDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(distributionDir.path));
|
||||
|
||||
let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
|
||||
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(testFile.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(testFile.path));
|
||||
|
||||
testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
|
||||
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(testFile.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(testFile.path));
|
||||
|
||||
distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
|
||||
checkUpdateLogContains("Moving old distribution directory to new location");
|
||||
checkUpdateLogContains(MOVE_OLD_DIST_DIR);
|
||||
} else {
|
||||
debugDump("testing that files aren't added with an add-if instruction " +
|
||||
"when the file's destination directory doesn't exist");
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
}
|
||||
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
}
|
||||
|
@ -6,7 +6,9 @@
|
||||
/* General Partial MAR File Patch Apply Test */
|
||||
|
||||
function run_test() {
|
||||
setupTestCommon();
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestFiles[gTestFiles.length - 1].originalContents = null;
|
||||
gTestFiles[gTestFiles.length - 1].compareContents = "FromPartial\n";
|
||||
@ -15,7 +17,41 @@ function run_test() {
|
||||
gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n";
|
||||
gTestFiles[gTestFiles.length - 2].comparePerms = 0o644;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
setupDistributionDir();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
|
||||
checkDistributionDir();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the state of the distribution directory for the test.
|
||||
*/
|
||||
function setupDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
// Create files in the old distribution directory location to verify that
|
||||
// the directory and its contents are removed when there is a distribution
|
||||
@ -25,40 +61,16 @@ function run_test() {
|
||||
testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
|
||||
writeFile(testFile, "test\n");
|
||||
}
|
||||
|
||||
createUpdaterINI(true);
|
||||
setAppBundleModTime();
|
||||
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the distribution directory.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateFinished;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateFinished() {
|
||||
function checkDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
checkUpdateLogContains("removing old distribution directory");
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
checkUpdateLogContains(REMOVE_OLD_DIST_DIR);
|
||||
}
|
||||
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
}
|
||||
|
@ -10,30 +10,32 @@ function run_test() {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
// We don't actually care if the MAR has any data, we only care about the
|
||||
// application return code and update.status result.
|
||||
gTestFiles = gTestFilesCommon;
|
||||
gTestDirs = [];
|
||||
setupUpdaterTest(FILE_OLD_VERSION_MAR);
|
||||
|
||||
createUpdaterINI(true);
|
||||
|
||||
// Apply the MAR
|
||||
// Note that if execv is used, the updater process will turn into the
|
||||
// callback process, so its return code will be that of the callback
|
||||
// app.
|
||||
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_VERSION_DOWNGRADE_ERROR,
|
||||
checkUpdateApplied);
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_OLD_VERSION_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
doTestFinish();
|
||||
function setupUpdaterTestFinished() {
|
||||
// If execv is used the updater process will turn into the callback process
|
||||
// and the updater's return code will be that of the callback process.
|
||||
runUpdateUsingUpdater(STATE_FAILED_VERSION_DOWNGRADE_ERROR, false,
|
||||
(USE_EXECV ? 0 : 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdateUsingUpdater finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(STATE_FAILED_VERSION_DOWNGRADE_ERROR);
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -10,30 +10,32 @@ function run_test() {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
// We don't actually care if the MAR has any data, we only care about the
|
||||
// application return code and update.status result.
|
||||
gTestFiles = gTestFilesCommon;
|
||||
gTestDirs = [];
|
||||
setupUpdaterTest(FILE_WRONG_CHANNEL_MAR);
|
||||
|
||||
createUpdaterINI();
|
||||
|
||||
// Apply the MAR
|
||||
// Note that if execv is used, the updater process will turn into the
|
||||
// callback process, so its return code will be that of the callback
|
||||
// app.
|
||||
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_CHANNEL_MISMATCH_ERROR,
|
||||
checkUpdateApplied);
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_WRONG_CHANNEL_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
doTestFinish();
|
||||
function setupUpdaterTestFinished() {
|
||||
// If execv is used the updater process will turn into the callback process
|
||||
// and the updater's return code will be that of the callback process.
|
||||
runUpdateUsingUpdater(STATE_FAILED_CHANNEL_MISMATCH_ERROR, false,
|
||||
(USE_EXECV ? 0 : 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdateUsingUpdater finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(STATE_FAILED_CHANNEL_MISMATCH_ERROR);
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -15,7 +15,11 @@ tail =
|
||||
[marSuccessPartial.js]
|
||||
[marFailurePartial.js]
|
||||
[marStageSuccessComplete.js]
|
||||
skip-if = toolkit == 'gonk' && debug == true
|
||||
reason = bug 1179091
|
||||
[marStageSuccessPartial.js]
|
||||
skip-if = toolkit == 'gonk' && debug == true
|
||||
reason = bug 1179091
|
||||
[marVersionDowngrade.js]
|
||||
skip-if = toolkit == 'gonk'
|
||||
reason = mar signing
|
||||
@ -45,7 +49,6 @@ skip-if = os != 'win'
|
||||
skip-if = os != 'win'
|
||||
[marFileLockedStageFailureComplete_win.js]
|
||||
skip-if = os != 'win'
|
||||
run-sequentially = Bug 1156446
|
||||
[marFileLockedStageFailurePartial_win.js]
|
||||
skip-if = os != 'win'
|
||||
[marFileInUseSuccessComplete_win.js]
|
||||
|
@ -5,29 +5,31 @@
|
||||
/* Bootstrap the tests using the service by installing our own version of the service */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest(true)) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
// We don't actually care if the MAR has any data, we only care about the
|
||||
// application return code and update.status result.
|
||||
gTestFiles = gTestFilesCommon;
|
||||
gTestDirs = [];
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, null);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED, false);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdateUsingService(STATE_SUCCEEDED, false, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to runUpdateUsingService finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
|
||||
// We need to check the service log even though this is a bootstrap
|
||||
// because the app bin could be in use by this test by the time the next
|
||||
// test runs.
|
||||
checkCallbackServiceLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -24,9 +24,7 @@ function run_test() {
|
||||
updaterBin.path + " signature.");
|
||||
|
||||
// Bypass the manifest and run as invoker
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
env.set("__COMPAT_LAYER", "RunAsInvoker");
|
||||
gEnv.set("__COMPAT_LAYER", "RunAsInvoker");
|
||||
|
||||
let dummyInstallPath = "---";
|
||||
let maintenanceServiceBinArgs = ["check-cert", dummyInstallPath,
|
||||
|
@ -2,4 +2,6 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
const IS_SERVICE_TEST = true;
|
||||
|
||||
load("../data/xpcshellUtilsAUS.js");
|
||||
|
@ -7,83 +7,36 @@
|
||||
* apply it.
|
||||
*/
|
||||
|
||||
const START_STATE = STATE_PENDING_SVC;
|
||||
const END_STATE = STATE_PENDING;
|
||||
const STATE_AFTER_STAGE = STATE_PENDING;
|
||||
|
||||
function run_test() {
|
||||
if (MOZ_APP_NAME == "xulrunner") {
|
||||
logTestInfo("Unable to run this test on xulrunner");
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldRunServiceTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
createUpdaterINI(false);
|
||||
|
||||
if (IS_WIN) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
|
||||
}
|
||||
|
||||
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
let patches = getLocalPatchString(null, null, null, null, null, "true",
|
||||
START_STATE);
|
||||
let updates = getLocalUpdateString(patches, null, null, null, null, null,
|
||||
null, null, null, null, null, null,
|
||||
"true", channel);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeVersionFile(getAppVersion());
|
||||
writeStatusFile(START_STATE);
|
||||
|
||||
reloadUpdateManagerData();
|
||||
Assert.ok(!!gUpdateManager.activeUpdate,
|
||||
"the active update should be defined");
|
||||
|
||||
lockDirectory(getAppBaseDir());
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
resetEnvironment();
|
||||
createUpdateInProgressLockFile(getAppBaseDir());
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if staging the update has failed.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
// Don't proceed until the update has failed, and reset to pending.
|
||||
if (gUpdateManager.activeUpdate.state != END_STATE) {
|
||||
if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"active update status state to equal: " +
|
||||
END_STATE +
|
||||
", current state: " + gUpdateManager.activeUpdate.state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
do_timeout(TEST_CHECK_TIMEOUT, finishTest);
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
Assert.equal(readStatusState(), END_STATE,
|
||||
"the status state" + MSG_SHOULD_EQUAL);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
unlockDirectory(getAppBaseDir());
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
removeUpdateInProgressLockFile(getAppBaseDir());
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(PERFORMING_STAGED_UPDATE);
|
||||
checkUpdateLogContains(ERR_UPDATE_IN_PROGRESS);
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -7,248 +7,69 @@
|
||||
* apply it.
|
||||
*/
|
||||
|
||||
const START_STATE = STATE_PENDING_SVC;
|
||||
const END_STATE = STATE_APPLIED_SVC;
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (MOZ_APP_NAME == "xulrunner") {
|
||||
logTestInfo("Unable to run this test on xulrunner");
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldRunServiceTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
createUpdaterINI(true);
|
||||
|
||||
if (IS_WIN) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
|
||||
}
|
||||
|
||||
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
let patches = getLocalPatchString(null, null, null, null, null, "true",
|
||||
START_STATE);
|
||||
let updates = getLocalUpdateString(patches, null, null, null, null, null,
|
||||
null, null, null, null, null, null,
|
||||
"true", channel);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeVersionFile(getAppVersion());
|
||||
writeStatusFile(START_STATE);
|
||||
|
||||
reloadUpdateManagerData();
|
||||
Assert.ok(!!gUpdateManager.activeUpdate,
|
||||
"the active update should be defined");
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, undefined);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
setAppBundleModTime();
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function customLaunchAppToApplyUpdate() {
|
||||
debugDump("start - locking installation directory");
|
||||
const LPCWSTR = ctypes.char16_t.ptr;
|
||||
const DWORD = ctypes.uint32_t;
|
||||
const LPVOID = ctypes.voidptr_t;
|
||||
const GENERIC_READ = 0x80000000;
|
||||
const FILE_SHARE_READ = 1;
|
||||
const FILE_SHARE_WRITE = 2;
|
||||
const OPEN_EXISTING = 3;
|
||||
const FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
|
||||
const INVALID_HANDLE_VALUE = LPVOID(0xffffffff);
|
||||
let kernel32 = ctypes.open("kernel32");
|
||||
let CreateFile = kernel32.declare("CreateFileW", ctypes.default_abi,
|
||||
LPVOID, LPCWSTR, DWORD, DWORD,
|
||||
LPVOID, DWORD, DWORD, LPVOID);
|
||||
gHandle = CreateFile(getAppBaseDir().path, GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, LPVOID(0),
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, LPVOID(0));
|
||||
Assert.notEqual(gHandle.toString(), INVALID_HANDLE_VALUE.toString(),
|
||||
"the handle should not equal INVALID_HANDLE_VALUE");
|
||||
kernel32.close();
|
||||
debugDump("finish - locking installation directory");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished being staged.
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the active update's state is the expected value.
|
||||
if (gUpdateManager.activeUpdate.state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"active update status state to equal: " +
|
||||
END_STATE +
|
||||
", current state: " + gUpdateManager.activeUpdate.state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update" +
|
||||
"status file state to equal: " +
|
||||
END_STATE +
|
||||
", current status state: " + state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the last update log has been created.
|
||||
let log;
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
log = getUpdatesDir();
|
||||
} else {
|
||||
log = getStageDirFile(null, true);
|
||||
log.append(DIR_UPDATES);
|
||||
}
|
||||
log.append(FILE_LAST_LOG);
|
||||
if (!log.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
|
||||
"to be created. Path: " + log.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
|
||||
log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
} else {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
}
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
|
||||
Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
} else {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
}
|
||||
|
||||
log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
// Switch the application to the staged application that was updated by
|
||||
// launching the application.
|
||||
do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
lockDirectory(getAppBaseDir().path);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdateUsingApp(STATE_SUCCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Called after the call to runUpdateUsingApp finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateFinished;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateFinished();
|
||||
}
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function finishCheckUpdateFinished() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != STATE_SUCCEEDED) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"update status file state to equal: " +
|
||||
STATE_SUCCEEDED +
|
||||
", current status state: " + state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the application was switched out with the staged update
|
||||
// successfully.
|
||||
let updatedDir = getStageDirFile(null, true);
|
||||
if (updatedDir.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
|
||||
"directory to not exist. Path: " + updatedDir.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_WIN) {
|
||||
// Don't proceed until the updater binary is no longer in use.
|
||||
let updater = getUpdatesPatchDir();
|
||||
updater.append(FILE_UPDATER_BIN);
|
||||
if (updater.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"updater binary to no longer be in use");
|
||||
}
|
||||
try {
|
||||
updater.remove(false);
|
||||
} catch (e) {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkPostUpdateRunningFile(true);
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
|
||||
standardInit();
|
||||
|
||||
let update = gUpdateManager.getUpdateAt(0);
|
||||
Assert.equal(update.state, STATE_SUCCEEDED,
|
||||
"the update state" + MSG_SHOULD_EQUAL);
|
||||
|
||||
let updatesDir = getUpdatesPatchDir();
|
||||
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(updatesDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(updatesDir.path));
|
||||
|
||||
let log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
let log = getUpdateLog(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -7,230 +7,68 @@
|
||||
* apply it.
|
||||
*/
|
||||
|
||||
const START_STATE = STATE_PENDING_SVC;
|
||||
const END_STATE = STATE_APPLIED_SVC;
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (MOZ_APP_NAME == "xulrunner") {
|
||||
logTestInfo("Unable to run this test on xulrunner");
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldRunServiceTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
createUpdaterINI(false);
|
||||
|
||||
if (IS_WIN) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
|
||||
}
|
||||
|
||||
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
let patches = getLocalPatchString(null, null, null, null, null, "true",
|
||||
START_STATE);
|
||||
let updates = getLocalUpdateString(patches, null, null, null, null, null,
|
||||
null, null, null, null, null, null,
|
||||
"true", channel);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeVersionFile(getAppVersion());
|
||||
writeStatusFile(START_STATE);
|
||||
|
||||
reloadUpdateManagerData();
|
||||
Assert.ok(!!gUpdateManager.activeUpdate,
|
||||
"the active update should be defined");
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, true);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
setAppBundleModTime();
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished being staged.
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the active update's state is the expected value.
|
||||
if (gUpdateManager.activeUpdate.state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"active update status state to equal: " +
|
||||
END_STATE +
|
||||
", current state: " + gUpdateManager.activeUpdate.state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
|
||||
"status state to equal: " +
|
||||
END_STATE +
|
||||
", current status state: " + state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the last update log has been created.
|
||||
let log;
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
log = getUpdatesDir();
|
||||
} else {
|
||||
log = getStageDirFile(null, true);
|
||||
log.append(DIR_UPDATES);
|
||||
}
|
||||
log.append(FILE_LAST_LOG);
|
||||
if (!log.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
|
||||
"to be created. Path: " + log.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
|
||||
return;
|
||||
}
|
||||
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
|
||||
log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
} else {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
}
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
|
||||
Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
} else {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
}
|
||||
|
||||
log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
|
||||
// Switch the application to the staged application that was updated by
|
||||
// launching the application.
|
||||
do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdateUsingApp(STATE_SUCCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Called after the call to runUpdateUsingApp finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateApplied;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateApplied();
|
||||
}
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function finishCheckUpdateApplied() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != STATE_SUCCEEDED) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"update status file state to equal: " +
|
||||
STATE_SUCCEEDED +
|
||||
", current status state: " + state);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the application was switched out with the staged update
|
||||
// successfully.
|
||||
let updatedDir = getStageDirFile(null, true);
|
||||
if (updatedDir.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
|
||||
"directory to not exist. Path: " + updatedDir.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_WIN) {
|
||||
// Don't proceed until the updater binary is no longer in use.
|
||||
let updater = getUpdatesPatchDir();
|
||||
updater.append(FILE_UPDATER_BIN);
|
||||
if (updater.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
|
||||
"updater binary to no longer be in use");
|
||||
}
|
||||
try {
|
||||
updater.remove(false);
|
||||
} catch (e) {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkPostUpdateRunningFile(true);
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
gSwitchApp = true;
|
||||
checkUpdateLogContents();
|
||||
gSwitchApp = false;
|
||||
|
||||
standardInit();
|
||||
|
||||
let update = gUpdateManager.getUpdateAt(0);
|
||||
Assert.equal(update.state, STATE_SUCCEEDED,
|
||||
"the update state" + MSG_SHOULD_EQUAL);
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
|
||||
let updatesDir = getUpdatesPatchDir();
|
||||
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(updatesDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(updatesDir.path));
|
||||
|
||||
let log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
let log = getUpdateLog(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
} else {
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
}
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -7,130 +7,55 @@
|
||||
* apply it.
|
||||
*/
|
||||
|
||||
const START_STATE = STATE_PENDING_SVC;
|
||||
const END_STATE = STATE_SUCCEEDED;
|
||||
|
||||
function run_test() {
|
||||
if (MOZ_APP_NAME == "xulrunner") {
|
||||
logTestInfo("Unable to run this test on xulrunner");
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldRunServiceTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
createUpdaterINI();
|
||||
setAppBundleModTime();
|
||||
|
||||
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
let patches = getLocalPatchString(null, null, null, null, null, "true",
|
||||
START_STATE);
|
||||
let updates = getLocalUpdateString(patches, null, null, null, null, null,
|
||||
null, null, null, null, null, null,
|
||||
"true", channel);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeVersionFile(getAppVersion());
|
||||
writeStatusFile(START_STATE);
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(START_STATE, END_STATE);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateFinished;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateFinished();
|
||||
}
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdateUsingApp(STATE_SUCCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to runUpdateUsingApp finishes.
|
||||
*/
|
||||
function finishCheckUpdateFinished() {
|
||||
gTimeoutRuns++;
|
||||
// Don't proceed until the update's status state is the expected value.
|
||||
let state = readStatusState();
|
||||
if (state != END_STATE) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
|
||||
"status state to equal: " + END_STATE +
|
||||
", current status state: " + state);
|
||||
} else {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't proceed until the update log has been created.
|
||||
let log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
if (!log.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
|
||||
"to be created. Path: " + log.path);
|
||||
}
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_WIN) {
|
||||
// Don't proceed until the updater binary is no longer in use.
|
||||
let updater = getUpdatesPatchDir();
|
||||
updater.append(FILE_UPDATER_BIN);
|
||||
if (updater.exists()) {
|
||||
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
|
||||
do_throw("Exceeded while waiting for updater binary to no longer be " +
|
||||
"in use");
|
||||
}
|
||||
try {
|
||||
updater.remove(false);
|
||||
} catch (e) {
|
||||
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
|
||||
standardInit();
|
||||
|
||||
let update = gUpdateManager.getUpdateAt(0);
|
||||
Assert.equal(update.state, END_STATE,
|
||||
"the update state" + MSG_SHOULD_EQUAL);
|
||||
|
||||
let updatesDir = getUpdatesPatchDir();
|
||||
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(updatesDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(updatesDir.path));
|
||||
|
||||
log = getUpdatesPatchDir();
|
||||
log.append(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
let log = getUpdateLog(FILE_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_LAST_LOG);
|
||||
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
|
||||
log = getUpdateLog(FILE_LAST_UPDATE_LOG);
|
||||
Assert.ok(log.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(log.path));
|
||||
|
||||
log = getUpdatesDir();
|
||||
log.append(FILE_BACKUP_LOG);
|
||||
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
log = getUpdateLog(FILE_BACKUP_UPDATE_LOG);
|
||||
Assert.ok(!log.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
|
||||
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -4,56 +4,59 @@
|
||||
|
||||
/* Application in use complete MAR file staged patch apply failure test */
|
||||
|
||||
const START_STATE = STATE_PENDING_SVC;
|
||||
const END_STATE = STATE_PENDING;
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Launch the callback helper application so it is in use during the update.
|
||||
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
callbackAppProcess.init(callbackApp);
|
||||
callbackAppProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
createUpdaterINI(false);
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(START_STATE, STATE_APPLIED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, END_STATE, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,45 +5,50 @@
|
||||
/* Application in use complete MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Launch the callback helper application so it is in use during the update.
|
||||
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
|
||||
callbackApp.permissions = PERMS_DIRECTORY;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
callbackAppProcess.init(callbackApp);
|
||||
callbackAppProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
setAppBundleModTime();
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,35 +4,50 @@
|
||||
|
||||
/* Replace app binary complete MAR file staged patch apply success test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
gCallbackBinFile = "exe0.exe";
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,35 +4,50 @@
|
||||
|
||||
/* Patch app binary partial MAR file staged patch apply success test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
gCallbackBinFile = "exe0.exe";
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,26 +5,36 @@
|
||||
/* Replace app binary complete MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
gCallbackBinFile = "exe0.exe";
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,26 +5,36 @@
|
||||
/* Patch app binary partial MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
gCallbackBinFile = "exe0.exe";
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -6,37 +6,34 @@
|
||||
/* General Partial MAR File Patch Apply Failure Test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestFiles[11].originalFile = "partial.png";
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
createUpdaterINI();
|
||||
setAppBundleModTime();
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC,
|
||||
STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
function setupUpdaterTestFinished() {
|
||||
// If execv is used the updater process will turn into the callback process
|
||||
// and the updater's return code will be that of the callback process.
|
||||
runUpdate(STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, false,
|
||||
(USE_EXECV ? 0 : 1), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkAppBundleModTime();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,54 +4,59 @@
|
||||
|
||||
/* File in use complete MAR file staged patch apply failure test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let fileInUseBin = getApplyDirFile(gTestFiles[13].relPathDir +
|
||||
gTestFiles[13].fileName);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName,
|
||||
false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,54 +4,59 @@
|
||||
|
||||
/* File in use partial MAR file staged patch apply failure test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let fileInUseBin = getApplyDirFile(gTestFiles[11].relPathDir +
|
||||
gTestFiles[11].fileName);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName,
|
||||
false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,43 +5,50 @@
|
||||
/* File in use complete MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let fileInUseBin = getApplyDirFile(gTestFiles[13].relPathDir +
|
||||
gTestFiles[13].fileName);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName,
|
||||
false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContains(ERR_BACKUP_DISCARD);
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,43 +5,50 @@
|
||||
/* File in use partial MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let fileInUseBin = getApplyDirFile(gTestFiles[11].relPathDir +
|
||||
gTestFiles[11].fileName);
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName,
|
||||
false);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContains(ERR_BACKUP_DISCARD);
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,53 +5,43 @@
|
||||
/* File locked complete MAR file patch apply failure test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Exclusively lock an existing file so it is in use during the update.
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
|
||||
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
|
||||
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
|
||||
// Strip off the first two directories so the path has to be from the helper's
|
||||
// working directory.
|
||||
let lockFileRelPath = gTestFiles[3].relPathDir.split("/");
|
||||
if (IS_MACOSX) {
|
||||
lockFileRelPath = lockFileRelPath.slice(2);
|
||||
}
|
||||
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
|
||||
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
lockFileProcess.init(helperBin);
|
||||
lockFileProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperLockFile(gTestFiles[3]);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_FAILED_WRITE_ERROR, false, 1, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,53 +5,43 @@
|
||||
/* File locked partial MAR file patch apply failure test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
// Exclusively lock an existing file so it is in use during the update.
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
|
||||
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
|
||||
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
|
||||
// Strip off the first two directories so the path has to be from the helper's
|
||||
// working directory.
|
||||
let lockFileRelPath = gTestFiles[2].relPathDir.split("/");
|
||||
if (IS_MACOSX) {
|
||||
lockFileRelPath = lockFileRelPath.slice(2);
|
||||
}
|
||||
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
|
||||
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
lockFileProcess.init(helperBin);
|
||||
lockFileProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperLockFile(gTestFiles[2]);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_READ_ERROR);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_FAILED_READ_ERROR, false, 1, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,63 +4,60 @@
|
||||
|
||||
/* File locked complete MAR file staged patch apply failure test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_PENDING : STATE_APPLYING;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
// Exclusively lock an existing file so it is in use during the update.
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
|
||||
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
|
||||
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
|
||||
// Strip off the first two directories so the path has to be from the helper's
|
||||
// working directory.
|
||||
let lockFileRelPath = gTestFiles[3].relPathDir.split("/");
|
||||
if (IS_MACOSX) {
|
||||
lockFileRelPath = lockFileRelPath.slice(2);
|
||||
}
|
||||
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
|
||||
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
lockFileProcess.init(helperBin);
|
||||
lockFileProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperLockFile(gTestFiles[3]);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
// Files aren't checked after staging since this test locks a file which
|
||||
// prevents reading the file.
|
||||
checkUpdateLogContains(ERR_ENSURE_COPY);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_FAILED_WRITE_ERROR, false, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_BACKUP_CREATE_7);
|
||||
checkUpdateLogContains(STATE_FAILED_WRITE_ERROR + "\n" + CALL_QUIT);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -4,63 +4,59 @@
|
||||
|
||||
/* File locked partial MAR file staged patch apply failure test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_PENDING : STATE_APPLYING;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
// Exclusively lock an existing file so it is in use during the update.
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
|
||||
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
|
||||
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
|
||||
// Strip off the first two directories so the path has to be from the helper's
|
||||
// working directory.
|
||||
let lockFileRelPath = gTestFiles[2].relPathDir.split("/");
|
||||
if (IS_MACOSX) {
|
||||
lockFileRelPath = lockFileRelPath.slice(2);
|
||||
}
|
||||
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
|
||||
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
lockFileProcess.init(helperBin);
|
||||
lockFileProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperLockFile(gTestFiles[2]);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
// Files aren't checked after staging since this test locks a file which
|
||||
// prevents reading the file.
|
||||
checkUpdateLogContains(ERR_ENSURE_COPY);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_FAILED_READ_ERROR, false, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
|
||||
checkUpdateLogContains(STATE_FAILED_READ_ERROR + "\n" + CALL_QUIT);
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,64 +5,59 @@
|
||||
/* File in use inside removed dir complete MAR file staged patch apply failure
|
||||
test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir +
|
||||
gTestDirs[4].subDirs[0] +
|
||||
gTestDirs[4].subDirFiles[0]);
|
||||
// Remove the empty file created for the test so the helper application can
|
||||
// replace it.
|
||||
fileInUseBin.remove(false);
|
||||
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir +
|
||||
gTestDirs[4].subDirs[0]);
|
||||
helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] +
|
||||
gTestDirs[4].subDirFiles[0], true);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,62 +5,58 @@
|
||||
/* File in use inside removed dir partial MAR file staged patch apply failure
|
||||
test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
let fileInUseBin = getApplyDirFile(gTestDirs[2].relPathDir +
|
||||
gTestDirs[2].files[0]);
|
||||
// Remove the empty file created for the test so the helper application can
|
||||
// replace it.
|
||||
fileInUseBin.remove(false);
|
||||
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let fileInUseDir = getApplyDirFile(gTestDirs[2].relPathDir);
|
||||
helperBin.copyTo(fileInUseDir, gTestDirs[2].files[0]);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
runUpdate(1, STATE_PENDING, checkUpdateApplied);
|
||||
runUpdate(STATE_PENDING, true, 1, false);
|
||||
}
|
||||
|
||||
function checkUpdateApplied() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
setTestFilesAndDirsForFailure();
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_RENAME_FILE);
|
||||
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,53 +5,50 @@
|
||||
/* File in use inside removed dir complete MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
|
||||
let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir +
|
||||
gTestDirs[4].subDirs[0] +
|
||||
gTestDirs[4].subDirFiles[0]);
|
||||
// Remove the empty file created for the test so the helper application can
|
||||
// replace it.
|
||||
fileInUseBin.remove(false);
|
||||
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir +
|
||||
gTestDirs[4].subDirs[0]);
|
||||
helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] +
|
||||
gTestDirs[4].subDirFiles[0], true);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContains(ERR_BACKUP_DISCARD);
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,51 +5,49 @@
|
||||
/* File in use inside removed dir partial MAR file patch apply success test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
let fileInUseBin = getApplyDirFile(gTestDirs[2].relPathDir +
|
||||
gTestDirs[2].files[0]);
|
||||
// Remove the empty file created for the test so the helper application can
|
||||
// replace it.
|
||||
fileInUseBin.remove(false);
|
||||
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let fileInUseDir = getApplyDirFile(gTestDirs[2].relPathDir);
|
||||
helperBin.copyTo(fileInUseDir, gTestDirs[2].files[0]);
|
||||
|
||||
// Launch an existing file so it is in use during the update.
|
||||
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
|
||||
HELPER_SLEEP_TIMEOUT];
|
||||
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
fileInUseProcess.init(fileInUseBin);
|
||||
fileInUseProcess.run(false, args, args.length);
|
||||
|
||||
setupAppFilesAsync();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true);
|
||||
}
|
||||
|
||||
function doUpdate() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
/**
|
||||
* Called after the call to waitForHelperSleep finishes.
|
||||
*/
|
||||
function waitForHelperSleepFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
setupHelperFinish();
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
waitForHelperExit();
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
/**
|
||||
* Called after the call to waitForHelperExit finishes.
|
||||
*/
|
||||
function waitForHelperExitFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContains(ERR_BACKUP_DISCARD);
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
@ -5,37 +5,33 @@
|
||||
|
||||
/* General Partial MAR File Staged Patch Apply Failure Test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_PENDING : STATE_APPLYING;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestFiles[11].originalFile = "partial.png";
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setTestFilesAndDirsForFailure();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
|
||||
createUpdaterINI(true);
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC,
|
||||
STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateFailure(getApplyDirFile);
|
||||
checkUpdateLogContains(ERR_LOADSOURCEFILE_FAILED);
|
||||
waitForFilesInUse();
|
||||
}
|
||||
|
@ -5,19 +5,65 @@
|
||||
|
||||
/* General Complete MAR File Staged Patch Apply Test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestFiles[gTestFiles.length - 1].originalContents = null;
|
||||
gTestFiles[gTestFiles.length - 1].compareContents = "FromComplete\n";
|
||||
gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
setupDistributionDir();
|
||||
setupSymLinks();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
checkSymLinks();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true);
|
||||
checkDistributionDir();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the state of the distribution directory for the test.
|
||||
*/
|
||||
function setupDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
// Create files in the old distribution directory location to verify that
|
||||
// the directory and its contents are removed when there is a distribution
|
||||
@ -27,10 +73,24 @@ function run_test() {
|
||||
testFile = getApplyDirFile(DIR_MACOS + "distribution/test1/testFile", true);
|
||||
writeFile(testFile, "test\n");
|
||||
}
|
||||
}
|
||||
|
||||
createUpdaterINI(false);
|
||||
setAppBundleModTime();
|
||||
/**
|
||||
* Checks the state of the distribution directory for the test.
|
||||
*/
|
||||
function checkDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
checkUpdateLogContains(REMOVE_OLD_DIST_DIR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup symlinks for the test.
|
||||
*/
|
||||
function setupSymLinks() {
|
||||
// Don't test symlinks on Mac OS X in this test since it tends to timeout.
|
||||
// It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js
|
||||
// The tests don't support symlinks on gonk.
|
||||
@ -51,97 +111,14 @@ function run_test() {
|
||||
comparePerms : 0o666
|
||||
});
|
||||
}
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
checkPostUpdateRunningFile(false);
|
||||
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
do_timeout(TEST_CHECK_TIMEOUT, function() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the symlinks for the test.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateApplied;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateApplied();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateApplied() {
|
||||
checkPostUpdateRunningFile(true);
|
||||
|
||||
if (IS_MACOSX) {
|
||||
let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
checkUpdateLogContains("removing old distribution directory");
|
||||
}
|
||||
|
||||
function checkSymLinks() {
|
||||
// The tests don't support symlinks on gonk.
|
||||
if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) {
|
||||
checkSymlink();
|
||||
}
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
}
|
||||
|
||||
function runHelperProcess(args) {
|
||||
let helperBin = getTestDirFile(FILE_HELPER_BIN);
|
||||
let process = Cc["@mozilla.org/process/util;1"].
|
||||
createInstance(Ci.nsIProcess);
|
||||
process.init(helperBin);
|
||||
debugDump("Running " + helperBin.path + " " + args.join(" "));
|
||||
process.run(true, args, args.length);
|
||||
Assert.equal(process.exitValue, 0,
|
||||
"the helper process exit value should be 0");
|
||||
}
|
||||
|
||||
function createSymlink() {
|
||||
let args = ["setup-symlink", "moz-foo", "moz-bar", "target",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
getApplyDirFile(DIR_RESOURCES + "link", false).permissions = 0o666;
|
||||
|
||||
args = ["setup-symlink", "moz-foo2", "moz-bar2", "target2",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link2", "change-perm"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
||||
function removeSymlink() {
|
||||
let args = ["remove-symlink", "moz-foo", "moz-bar", "target",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
args = ["remove-symlink", "moz-foo2", "moz-bar2", "target2",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link2"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
||||
function checkSymlink() {
|
||||
let args = ["check-symlink",
|
||||
getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
|
||||
runHelperProcess(args);
|
||||
}
|
||||
|
@ -5,20 +5,64 @@
|
||||
|
||||
/* General Partial MAR File Staged Patch Apply Test */
|
||||
|
||||
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gStageUpdate = true;
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestFiles[gTestFiles.length - 2].originalContents = null;
|
||||
gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n";
|
||||
gTestFiles[gTestFiles.length - 2].comparePerms = 0o644;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
preventDistributionFiles();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
setupDistributionDir();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
stageUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to stageUpdate finishes.
|
||||
*/
|
||||
function stageUpdateFinished() {
|
||||
checkPostUpdateRunningFile(false);
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true, false, true);
|
||||
// Switch the application to the staged application that was updated.
|
||||
runUpdate(STATE_SUCCEEDED, true, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
|
||||
checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true, true);
|
||||
checkDistributionDir();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the state of the distribution directory for the test.
|
||||
*/
|
||||
function setupDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
// Create files in the old distribution directory location to verify that
|
||||
// the directory and its contents are moved to the new location on update.
|
||||
@ -27,73 +71,34 @@ function run_test() {
|
||||
testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
|
||||
writeFile(testFile, "test\n");
|
||||
}
|
||||
|
||||
createUpdaterINI(false);
|
||||
setAppBundleModTime();
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
|
||||
}
|
||||
|
||||
function checkUpdateFinished() {
|
||||
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
|
||||
checkPostUpdateRunningFile(false);
|
||||
|
||||
// Switch the application to the staged application that was updated.
|
||||
gStageUpdate = false;
|
||||
gSwitchApp = true;
|
||||
do_timeout(TEST_CHECK_TIMEOUT, function() {
|
||||
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the distribution directory.
|
||||
*/
|
||||
function checkUpdateApplied() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateApplied;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateApplied();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateApplied() {
|
||||
checkPostUpdateRunningFile(true);
|
||||
|
||||
function checkDistributionDir() {
|
||||
let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
|
||||
if (IS_MACOSX) {
|
||||
Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(distributionDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(distributionDir.path));
|
||||
|
||||
let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
|
||||
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(testFile.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(testFile.path));
|
||||
|
||||
testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
|
||||
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(testFile.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(testFile.path));
|
||||
|
||||
distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
|
||||
checkUpdateLogContains("Moving old distribution directory to new location");
|
||||
checkUpdateLogContains(MOVE_OLD_DIST_DIR);
|
||||
} else {
|
||||
debugDump("testing that files aren't added with an add-if instruction " +
|
||||
"when the file's destination directory doesn't exist");
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
}
|
||||
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
|
||||
standardInit();
|
||||
checkCallbackAppLog();
|
||||
}
|
||||
|
@ -6,15 +6,47 @@
|
||||
/* General Complete MAR File Patch Apply Test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesCompleteSuccess;
|
||||
gTestDirs = gTestDirsCompleteSuccess;
|
||||
preventDistributionFiles();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR);
|
||||
setupDistributionDir();
|
||||
setupUpdaterTest(FILE_COMPLETE_MAR, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS, false, false, true);
|
||||
checkDistributionDir();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the state of the distribution directory for the test.
|
||||
*/
|
||||
function setupDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
// Create files in the old distribution directory location to verify that
|
||||
// the directory and its contents are moved to the new location on update.
|
||||
@ -23,58 +55,34 @@ function run_test() {
|
||||
testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
|
||||
writeFile(testFile, "test\n");
|
||||
}
|
||||
|
||||
createUpdaterINI();
|
||||
setAppBundleModTime();
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the distribution directory.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateFinished;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateFinished() {
|
||||
function checkDistributionDir() {
|
||||
let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
|
||||
if (IS_MACOSX) {
|
||||
Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(distributionDir.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(distributionDir.path));
|
||||
|
||||
let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
|
||||
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(testFile.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(testFile.path));
|
||||
|
||||
testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
|
||||
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
|
||||
Assert.ok(testFile.exists(),
|
||||
MSG_SHOULD_EXIST + getMsgPath(testFile.path));
|
||||
|
||||
distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
|
||||
checkUpdateLogContains("Moving old distribution directory to new location");
|
||||
checkUpdateLogContains(MOVE_OLD_DIST_DIR);
|
||||
} else {
|
||||
debugDump("testing that files aren't added with an add-if instruction " +
|
||||
"when the file's destination directory doesn't exist");
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
}
|
||||
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true);
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
}
|
||||
|
@ -6,11 +6,9 @@
|
||||
/* General Partial MAR File Patch Apply Test */
|
||||
|
||||
function run_test() {
|
||||
if (!shouldRunServiceTest()) {
|
||||
if (!setupTestCommon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupTestCommon();
|
||||
gTestFiles = gTestFilesPartialSuccess;
|
||||
gTestFiles[gTestFiles.length - 1].originalContents = null;
|
||||
gTestFiles[gTestFiles.length - 1].compareContents = "FromPartial\n";
|
||||
@ -19,7 +17,41 @@ function run_test() {
|
||||
gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n";
|
||||
gTestFiles[gTestFiles.length - 2].comparePerms = 0o644;
|
||||
gTestDirs = gTestDirsPartialSuccess;
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR);
|
||||
setupDistributionDir();
|
||||
setupUpdaterTest(FILE_PARTIAL_MAR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to setupUpdaterTest finishes.
|
||||
*/
|
||||
function setupUpdaterTestFinished() {
|
||||
runUpdate(STATE_SUCCEEDED, false, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to runUpdate finishes.
|
||||
*/
|
||||
function runUpdateFinished() {
|
||||
checkPostUpdateAppLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the call to checkPostUpdateAppLog finishes.
|
||||
*/
|
||||
function checkPostUpdateAppLogFinished() {
|
||||
checkAppBundleModTime();
|
||||
standardInit();
|
||||
checkPostUpdateRunningFile(true);
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
|
||||
checkDistributionDir();
|
||||
checkCallbackLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the state of the distribution directory for the test.
|
||||
*/
|
||||
function setupDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
// Create files in the old distribution directory location to verify that
|
||||
// the directory and its contents are removed when there is a distribution
|
||||
@ -29,44 +61,16 @@ function run_test() {
|
||||
testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
|
||||
writeFile(testFile, "test\n");
|
||||
}
|
||||
|
||||
createUpdaterINI(true);
|
||||
setAppBundleModTime();
|
||||
|
||||
setupAppFilesAsync();
|
||||
}
|
||||
|
||||
function setupAppFilesFinished() {
|
||||
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post update binary was properly launched for the platforms that
|
||||
* support launching post update process.
|
||||
* Checks the state of the distribution directory.
|
||||
*/
|
||||
function checkUpdateFinished() {
|
||||
if (IS_WIN || IS_MACOSX) {
|
||||
gCheckFunc = finishCheckUpdateFinished;
|
||||
checkPostUpdateAppLog();
|
||||
} else {
|
||||
finishCheckUpdateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the update has finished and if it has finished performs checks for
|
||||
* the test.
|
||||
*/
|
||||
function finishCheckUpdateFinished() {
|
||||
function checkDistributionDir() {
|
||||
if (IS_MACOSX) {
|
||||
let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
|
||||
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
|
||||
checkUpdateLogContains("removing old distribution directory");
|
||||
Assert.ok(!distributionDir.exists(),
|
||||
MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path));
|
||||
checkUpdateLogContains(REMOVE_OLD_DIST_DIR);
|
||||
}
|
||||
|
||||
checkAppBundleModTime();
|
||||
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
|
||||
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
|
||||
standardInit();
|
||||
checkCallbackServiceLog();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user