Part 11 - Bug 951662 - fix updates patch dir in use after staging, make the helper sleep timeout consistent across tests, and use STATE_APPLIED instead of STATE_APPLIED_SVC on Windows for non service tests. r=bbondy

This commit is contained in:
Robert Strong 2014-01-12 13:47:29 -08:00
parent da3c1af115
commit 0617dcfc81
49 changed files with 172 additions and 149 deletions

View File

@ -1223,75 +1223,60 @@ function cleanUpUpdatesDir(aBackgroundUpdate) {
// Bail out if we don't have appropriate permissions
try {
var updateDir = getUpdatesDir();
}
catch (e) {
} catch (e) {
return;
}
var e = updateDir.directoryEntries;
while (e.hasMoreElements()) {
var f = e.getNext().QueryInterface(Ci.nsIFile);
// Preserve the last update log file for debugging purposes
if (f.leafName == FILE_UPDATE_LOG) {
var dir;
// Preserve the last update log file for debugging purposes.
let file = updateDir.clone();
file.append(FILE_UPDATE_LOG);
if (file.exists()) {
let dir;
if (aBackgroundUpdate && getUpdateDirNoCreate([]).equals(getAppBaseDir())) {
dir = getUpdatesDirInApplyToDir();
} else {
dir = updateDir.parent;
}
let logFile = dir.clone();
logFile.append(FILE_LAST_LOG);
if (logFile.exists()) {
try {
// If we don't use the update root directory, the log files are written
// inside the application directory. In that case, we want to write
// the log files to the updated directory in the case of background
// updates, so that they would be available when we replace that
// directory with the application directory later on.
if (aBackgroundUpdate && getUpdateDirNoCreate([]).equals(getAppBaseDir())) {
dir = getUpdatesDirInApplyToDir();
} else {
dir = f.parent.parent;
}
var logFile = dir.clone();
logFile.append(FILE_LAST_LOG);
if (logFile.exists()) {
try {
logFile.moveTo(dir, FILE_BACKUP_LOG);
}
catch (e) {
LOG("cleanUpUpdatesDir - failed to rename file " + logFile.path +
" to " + FILE_BACKUP_LOG);
}
}
f.moveTo(dir, FILE_LAST_LOG);
if (aBackgroundUpdate) {
// We're not going to delete any files, so we can just
// bail out of the loop right now.
break;
} else {
continue;
}
logFile.moveTo(dir, FILE_BACKUP_LOG);
} catch (e) {
LOG("cleanUpUpdatesDir - failed to rename file " + logFile.path +
" to " + FILE_BACKUP_LOG);
}
catch (e) {
LOG("cleanUpUpdatesDir - failed to move file " + f.path + " to " +
dir.path + " and rename it to " + FILE_LAST_LOG);
}
} else if (aBackgroundUpdate) {
// Don't delete any files when an update has been staged, as
// we need to keep them around in case we would have to fall
// back to applying the update on application restart.
continue;
}
try {
file.moveTo(dir, FILE_LAST_LOG);
} catch (e) {
LOG("cleanUpUpdatesDir - failed to rename file " + file.path +
" to " + FILE_LAST_LOG);
}
}
if (!aBackgroundUpdate) {
let e = updateDir.directoryEntries;
while (e.hasMoreElements()) {
let f = e.getNext().QueryInterface(Ci.nsIFile);
#ifdef MOZ_WIDGET_GONK
if (f.leafName == FILE_UPDATE_LINK) {
let linkedFile = getFileFromUpdateLink(updateDir);
if (linkedFile && linkedFile.exists()) {
linkedFile.remove(false);
if (f.leafName == FILE_UPDATE_LINK) {
let linkedFile = getFileFromUpdateLink(updateDir);
if (linkedFile && linkedFile.exists()) {
linkedFile.remove(false);
}
}
}
#endif
// Now, recursively remove this file. The recursive removal is really
// only needed on Mac OSX because this directory will contain a copy of
// updater.app, which is itself a directory.
try {
f.remove(true);
}
catch (e) {
LOG("cleanUpUpdatesDir - failed to remove file " + f.path);
// Now, recursively remove this file. The recursive removal is needed for
// Mac OSX because this directory will contain a copy of updater.app,
// which is itself a directory.
try {
f.remove(true);
} catch (e) {
LOG("cleanUpUpdatesDir - failed to remove file " + f.path);
}
}
}
releaseSDCardMountLock();

View File

@ -122,12 +122,15 @@ const TEST_CHECK_TIMEOUT = 100;
// How many of TEST_CHECK_TIMEOUT to wait before we abort the test.
const MAX_TIMEOUT_RUNS = 2000;
// Time in seconds the helper application should sleep.the helper's input and output files
const HELPER_SLEEP_TIMEOUT = 180;
// Maximum number of milliseconds the process that is launched can run before
// the test will try to kill it.
const APP_TIMER_TIMEOUT = 120000;
#ifdef XP_WIN
const PIPE_TO_NULL = "1> nul 2>&1";
const PIPE_TO_NULL = ">nul";
#else
const PIPE_TO_NULL = "> /dev/null 2>&1";
#endif
@ -361,12 +364,6 @@ var gPassed;
#include ../shared.js
#ifdef MOZ_MAINTENANCE_SERVICE
const STATE_APPLIED_PLATFORM = STATE_APPLIED_SVC;
#else
const STATE_APPLIED_PLATFORM = STATE_APPLIED;
#endif
// This makes it possible to run most tests on xulrunner where the update
// channel default preference is not set.
if (MOZ_APP_NAME == "xulrunner") {
@ -422,9 +419,9 @@ function setupTestCommon() {
applyDir = applyDir.parent;
}
// Try to remove the directory used to apply updates. Since the test hasn't
// ran yet and the directory shouldn't exist finished this is non-fatal for
// the test.
// Try to remove the directory used to apply updates and the updates directory
// on platforms other than Windows. Since the test hasn't ran yet and the
// directory shouldn't exist finished this is non-fatal for the test.
if (applyDir.exists()) {
logTestInfo("attempting to remove directory. Path: " + applyDir.path);
try {
@ -439,19 +436,20 @@ function setupTestCommon() {
// it is defined as a function.
adjustGeneralPaths();
removeUpdateDirsAndFiles();
// Try to remove the directory used to apply updates. Since the test hasn't
// ran yet and the directory shouldn't exist finished this is non-fatal for
// the test.
let updatesDir = getMockUpdRootD();
if (updatesDir.exists()) {
logTestInfo("attempting to remove directory. Path: " + updatesDir.path);
try {
removeDirRecursive(updatesDir);
} catch (e) {
logTestInfo("non-fatal error removing directory. Path: " +
updatesDir.path + ", Exception: " + e);
// Remove the updates directory on Windows which is located outside of the
// application directory after the call to adjustGeneralPaths has set it up.
// Since the test hasn't ran yet and the directory shouldn't exist finished
// this is non-fatal for the test.
if (IS_WIN) {
let updatesDir = getMockUpdRootD();
if (updatesDir.exists()) {
logTestInfo("attempting to remove directory. Path: " + updatesDir.path);
try {
removeDirRecursive(updatesDir);
} catch (e) {
logTestInfo("non-fatal error removing directory. Path: " +
updatesDir.path + ", Exception: " + e);
}
}
}
@ -524,8 +522,6 @@ function cleanupTestCommon() {
}
}
removeUpdateDirsAndFiles();
// The updates directory is located outside of the application directory on
// Windows so it also needs to be removed.
if (IS_WIN) {
@ -1540,8 +1536,7 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
"-no-remote",
"-process-updates",
"-dump-args",
appArgsLogPath,
PIPE_TO_NULL
appArgsLogPath
];
if (gSwitchApp) {
@ -1703,8 +1698,8 @@ function waitForHelperFinished() {
}
/**
* Helper function that waits until the helper's input and output directories
* are no longer in use before calling checkUpdate.
* Helper function that waits until the helper's input and output files are no
* longer in use before calling checkUpdate.
*/
function waitForHelperFinishFileUnlock() {
try {
@ -2595,7 +2590,7 @@ function getProcessArgs(aExtraArgs) {
args = [launchScript.path];
} else {
args = ["/D", "/Q", "/C", appBinPath, "-no-remote", "-process-updates"].
concat(aExtraArgs).concat(["1> nul 2>&1"]);
concat(aExtraArgs).concat([PIPE_TO_NULL]);
}
return args;
}

View File

@ -23,7 +23,7 @@ function run_test() {
setupTestCommon();
if (IS_WIN) {
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
}
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
@ -82,7 +82,7 @@ function customLaunchAppToApplyUpdate() {
function checkUpdateApplied() {
gTimeoutRuns++;
// Don't proceed until the active update's state is applied.
if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) {
if (gUpdateManager.activeUpdate.state != STATE_APPLIED) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to be " +
"applied, current state is: " +
@ -95,10 +95,10 @@ function checkUpdateApplied() {
// Don't proceed until the update's status state is applied.
let state = readStatusState();
if (state != STATE_APPLIED_PLATFORM) {
if (state != STATE_APPLIED) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal " + STATE_APPLIED_PLATFORM + ", " +
"status state to equal " + STATE_APPLIED + ", " +
"current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);

View File

@ -21,7 +21,7 @@ function run_test() {
setupTestCommon();
if (IS_WIN) {
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
}
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
@ -57,7 +57,7 @@ function setupAppFilesFinished() {
function checkUpdateApplied() {
gTimeoutRuns++;
// Don't proceed until the update state is applied.
if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) {
if (gUpdateManager.activeUpdate.state != STATE_APPLIED) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to be " +
"applied, current state is: " +
@ -70,10 +70,10 @@ function checkUpdateApplied() {
// Don't proceed until the update status state is applied.
let state = readStatusState();
if (state != STATE_APPLIED_PLATFORM) {
if (state != STATE_APPLIED) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal " + STATE_APPLIED_PLATFORM + ", " +
"status state to equal " + STATE_APPLIED + ", " +
"current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
@ -263,7 +263,7 @@ function checkUpdateFinished() {
do_check_true(file.exists());
do_check_eq(readFileBytes(file), "update_test/UpdateTestRemoveFile\n");
log = getUpdatesDir();
let log = getUpdatesDir();
log.append("0");
log.append(FILE_UPDATE_LOG);
if (IS_WIN) {

View File

@ -188,7 +188,8 @@ function run_test() {
// Launch the callback helper application so it is in use during the update.
let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
callbackAppProcess.init(callbackApp);

View File

@ -188,7 +188,8 @@ function run_test() {
// Launch the callback helper application so it is in use during the update.
let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
callbackAppProcess.init(callbackApp);

View File

@ -245,7 +245,8 @@ function run_test() {
// Launch the callback helper application so it is in use during the update
let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile);
callbackApp.permissions = PERMS_DIRECTORY;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
callbackAppProcess.init(callbackApp);

View File

@ -234,7 +234,8 @@ function run_test() {
// Launch the callback helper application so it is in use during the update.
let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile);
callbackApp.permissions = PERMS_DIRECTORY;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
callbackAppProcess.init(callbackApp);

View File

@ -195,7 +195,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir +
TEST_FILES[14].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -197,7 +197,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir +
TEST_FILES[12].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -195,7 +195,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir +
TEST_FILES[14].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -197,7 +197,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir +
TEST_FILES[12].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -194,7 +194,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir +
TEST_FILES[14].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -196,7 +196,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir +
TEST_FILES[12].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -195,7 +195,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -196,7 +196,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -196,7 +196,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -197,7 +197,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -196,7 +196,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -197,7 +197,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -205,7 +205,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -205,7 +205,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -205,7 +205,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -205,7 +205,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -204,7 +204,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -204,7 +204,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -86,10 +86,10 @@ function customLaunchAppToApplyUpdate() {
function checkUpdateApplied() {
gTimeoutRuns++;
// Don't proceed until the active update's state is applied.
if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) {
if (gUpdateManager.activeUpdate.state != STATE_APPLIED_SVC) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to be " +
"applied, current state is: " +
STATE_APPLIED_SVC + ", current state is: " +
gUpdateManager.activeUpdate.state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
@ -99,10 +99,10 @@ function checkUpdateApplied() {
// Don't proceed until the update's status state is applied.
let state = readStatusState();
if (state != STATE_APPLIED_PLATFORM) {
if (state != STATE_APPLIED_SVC) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal " + STATE_APPLIED_PLATFORM + ", " +
"status state to equal " + STATE_APPLIED_SVC + ", " +
"current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);

View File

@ -61,10 +61,10 @@ function setupAppFilesFinished() {
function checkUpdateApplied() {
gTimeoutRuns++;
// Don't proceed until the update state is applied.
if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) {
if (gUpdateManager.activeUpdate.state != STATE_APPLIED_SVC) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to be " +
"applied, current state is: " +
STATE_APPLIED_SVC + ", current state is: " +
gUpdateManager.activeUpdate.state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
@ -74,10 +74,10 @@ function checkUpdateApplied() {
// Don't proceed until the update status state is applied.
let state = readStatusState();
if (state != STATE_APPLIED_PLATFORM) {
if (state != STATE_APPLIED_SVC) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal " + STATE_APPLIED_PLATFORM + ", " +
"status state to equal " + STATE_APPLIED_SVC + ", " +
"current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);

View File

@ -192,7 +192,8 @@ function run_test() {
// Launch the callback helper application so it is in use during the update.
let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
callbackAppProcess.init(callbackApp);

View File

@ -192,7 +192,8 @@ function run_test() {
// Launch the callback helper application so it is in use during the update.
let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
callbackAppProcess.init(callbackApp);

View File

@ -238,7 +238,8 @@ function run_test() {
// Launch the callback helper application so it is in use during the update.
let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile);
callbackApp.permissions = PERMS_DIRECTORY;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
callbackAppProcess.init(callbackApp);

View File

@ -199,7 +199,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir +
TEST_FILES[14].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -201,7 +201,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir +
TEST_FILES[12].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -199,7 +199,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir +
TEST_FILES[14].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -201,7 +201,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir +
TEST_FILES[12].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -198,7 +198,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir +
TEST_FILES[14].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -200,7 +200,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir +
TEST_FILES[12].fileName);
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -199,7 +199,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -200,7 +200,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -200,7 +200,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -201,7 +201,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -200,7 +200,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -201,7 +201,8 @@ function run_test() {
let lockFileRelPath = TEST_FILES[3].relPathDir.split("/");
lockFileRelPath = lockFileRelPath.slice(2);
lockFileRelPath = lockFileRelPath.join("/") + "/" + TEST_FILES[3].fileName;
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40", lockFileRelPath];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
lockFileProcess.init(helperBin);

View File

@ -209,7 +209,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -209,7 +209,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -209,7 +209,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -209,7 +209,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "40"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -208,7 +208,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);

View File

@ -208,7 +208,8 @@ function run_test() {
helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", "20"];
let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);