Bug 1529043 - Part 6 (test only) - Make the setupUpdaterTest function async and change call sites so they use await. r=mhowell

Depends on D20797

Differential Revision: https://phabricator.services.mozilla.com/D20798

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Robert Strong 2019-02-22 21:23:08 +00:00
parent 6182bcea9a
commit 23ff831432
83 changed files with 185 additions and 704 deletions

View File

@ -2143,30 +2143,6 @@ function isBinarySigned(aBinPath) {
return true;
}
/**
* Helper function for asynchronously setting up the application files required
* to launch the application for the updater tests by either copying or creating
* symlinks for the files. This is needed for Windows debug builds which can
* lock a file that is being copied so that the tests can run in parallel. After
* the files have been copied the setupUpdaterTestFinished function will be
* called.
*/
function setupAppFilesAsync() {
gTimeoutRuns++;
try {
setupAppFiles();
} catch (e) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while trying to setup application " +
"files! Exception: " + e);
}
executeSoon(setupAppFilesAsync);
return;
}
executeSoon(setupUpdaterTestFinished);
}
/**
* Helper function for setting up the application files required to launch the
* application for the updater tests by either copying or creating symlinks to
@ -2689,7 +2665,7 @@ async function waitForHelperExit() {
* @param aSetupActiveUpdate
* Whether to setup the active update.
*/
function setupUpdaterTest(aMarFile, aPostUpdateAsync,
async function setupUpdaterTest(aMarFile, aPostUpdateAsync,
aPostUpdateExeRelPathPrefix = "",
aSetupActiveUpdate = true) {
debugDump("start - updater test setup");
@ -2787,8 +2763,17 @@ function setupUpdaterTest(aMarFile, aPostUpdateAsync,
createUpdaterINI(aPostUpdateAsync, aPostUpdateExeRelPathPrefix);
}
await TestUtils.waitForCondition(() => {
try {
setupAppFiles();
return true;
} catch (e) {
logTestInfo("exception when calling setupAppFiles, Exception: " + e);
}
return false;
}, "Waiting to setup app files");
debugDump("finish - updater test setup");
setupAppFilesAsync();
}
/**

View File

@ -8,20 +8,14 @@
const STATE_AFTER_RUNUPDATE = STATE_FAILED_INVALID_CALLBACK_DIR_ERROR;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = getTestDirFile(FILE_HELPER_BIN).path;
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, null, path);
standardInit();

View File

@ -7,20 +7,14 @@
const STATE_AFTER_RUNUPDATE = STATE_FAILED_INVALID_CALLBACK_PATH_ERROR;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = "123456789";
if (AppConstants.platform == "win") {
path = "\\" + path;
@ -30,7 +24,6 @@ async function setupUpdaterTestFinished() {
path = "/" + path;
path = path.repeat(1000); // 10000 characters
}
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, null, path);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -13,20 +13,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = "123456789";
if (AppConstants.platform == "win") {
path = "\\" + path;
@ -36,7 +30,6 @@ async function setupUpdaterTestFinished() {
path = "/" + path;
path = path.repeat(1000); // 10000 characters
}
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, path, null, null);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -13,27 +13,20 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = "123456789";
if (AppConstants.platform == "win") {
path = "C:\\" + path + "\\..\\" + path;
} else {
path = "/" + path + "/../" + path;
}
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, path, null, null);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -14,20 +14,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = getApplyDirFile("..", false).path;
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, path, null);
standardInit();

View File

@ -8,27 +8,20 @@
const STATE_AFTER_RUNUPDATE =
IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = getUpdateDirFile(DIR_PATCH);
if (AppConstants.platform == "win") {
path = path + "\\..\\";
} else {
path = path + "/../";
}
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, path, null, null, null);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -15,20 +15,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = getApplyDirFile("..", false).path;
runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true, null, null, path, null);
standardInit();

View File

@ -14,20 +14,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = "\\\\.\\" + getApplyDirFile(null, false).path;
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, path, null);
standardInit();

View File

@ -14,20 +14,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, "test", null);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -9,22 +9,15 @@
const STATE_AFTER_STAGE = STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
createUpdateInProgressLockFile(getGREBinDir());
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(false);
}

View File

@ -9,20 +9,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(true);
}

View File

@ -11,20 +11,13 @@
const STATE_AFTER_STAGE = STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, null, "", false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, null, "", false);
let patchProps = {state: STATE_AFTER_STAGE};
let patches = getLocalPatchString(patchProps);
let updateProps = {appVersion: "0.9"};

View File

@ -9,20 +9,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, true);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, true);
stageUpdate(true);
}

View File

@ -7,23 +7,16 @@
* apply it.
*/
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
// The third parameter will test that a full path to the post update binary
// doesn't execute.
setupUpdaterTest(FILE_COMPLETE_MAR, undefined,
getApplyDirFile(null, true).path + "/");
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, undefined,
getApplyDirFile(null, true).path + "/");
runUpdateUsingApp(STATE_SUCCEEDED);
}

View File

@ -7,19 +7,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
stageUpdate(true);
}

View File

@ -7,7 +7,7 @@
const START_STATE = STATE_PENDING;
const STATE_AFTER_STAGE = STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -16,13 +16,7 @@ function run_test() {
gTestFiles[gTestFiles.length - 1].compareContents = "FromComplete\n";
gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, true);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, true);
setupSymLinks();
await runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
stageUpdate(true);

View File

@ -4,19 +4,13 @@
/* Application in use complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await waitForHelperExit();

View File

@ -6,20 +6,14 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
gCallbackBinFile = "exe0.exe";
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(true);
}

View File

@ -6,20 +6,14 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
gCallbackBinFile = "exe0.exe";
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
stageUpdate(true);
}

View File

@ -4,20 +4,14 @@
/* Replace app binary complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
gCallbackBinFile = "exe0.exe";
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await checkPostUpdateAppLog();
standardInit();

View File

@ -4,20 +4,14 @@
/* Patch app binary partial MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
gCallbackBinFile = "exe0.exe";
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await checkPostUpdateAppLog();
standardInit();

View File

@ -5,7 +5,7 @@
/* General Partial MAR File Patch Apply Failure Test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -13,13 +13,7 @@ function run_test() {
gTestFiles[11].originalFile = "partial.png";
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
// 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,

View File

@ -7,19 +7,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName,
false);
stageUpdate(true);

View File

@ -7,19 +7,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName,
false);
stageUpdate(true);

View File

@ -4,19 +4,13 @@
/* File in use complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName,
false);
runUpdate(STATE_SUCCEEDED, false, 0, true);

View File

@ -4,19 +4,13 @@
/* File in use partial MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName,
false);
runUpdate(STATE_SUCCEEDED, false, 0, true);

View File

@ -4,20 +4,14 @@
/* File locked complete MAR file patch apply failure test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperLockFile(gTestFiles[3]);
runUpdate(STATE_FAILED_WRITE_ERROR, false, 1, true);
await waitForHelperExit();

View File

@ -4,20 +4,14 @@
/* File locked partial MAR file patch apply failure test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperLockFile(gTestFiles[2]);
runUpdate(STATE_FAILED_READ_ERROR, false, 1, true);
await waitForHelperExit();

View File

@ -6,20 +6,14 @@
const STATE_AFTER_STAGE = STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperLockFile(gTestFiles[3]);
stageUpdate(true);
}

View File

@ -6,20 +6,14 @@
const STATE_AFTER_STAGE = STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperLockFile(gTestFiles[2]);
stageUpdate(true);
}

View File

@ -5,7 +5,7 @@
/* Test update-settings.ini missing channel MAR security check */
function run_test() {
async function run_test() {
if (!MOZ_VERIFY_MAR_SIGNATURE) {
return;
}
@ -17,13 +17,7 @@ function run_test() {
gTestFiles[gTestFiles.length - 2].originalContents = null;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
// 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_UPDATE_SETTINGS_FILE_CHANNEL,

View File

@ -8,7 +8,7 @@
const STATE_AFTER_STAGE = STATE_FAILED;
gStagingRemovedUpdate = true;
function run_test() {
async function run_test() {
if (!MOZ_VERIFY_MAR_SIGNATURE) {
return;
}
@ -20,13 +20,7 @@ function run_test() {
gTestFiles[gTestFiles.length - 2].originalContents = null;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(true);
}

View File

@ -4,19 +4,13 @@
/* Application in use complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperPIDPersists(DIR_RESOURCES + gCallbackBinFile, false);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await waitForHelperExit();

View File

@ -8,19 +8,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] +
gTestDirs[4].subDirFiles[0], true);
stageUpdate(true);

View File

@ -8,20 +8,15 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true);
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0],
true);
stageUpdate(true);
}

View File

@ -4,19 +4,13 @@
/* File in use inside removed dir complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] +
gTestDirs[4].subDirFiles[0], true);
runUpdate(STATE_SUCCEEDED, false, 0, true);

View File

@ -4,20 +4,15 @@
/* File in use inside removed dir partial MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true);
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0],
true);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await waitForHelperExit();
await checkPostUpdateAppLog();

View File

@ -8,7 +8,7 @@
const STATE_AFTER_STAGE = STATE_FAILED;
gStagingRemovedUpdate = true;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -16,13 +16,7 @@ function run_test() {
gTestFiles[11].originalFile = "partial.png";
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
stageUpdate(true);
}

View File

@ -7,7 +7,7 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -17,13 +17,7 @@ function run_test() {
gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
gTestDirs = gTestDirsCompleteSuccess;
setupSymLinks();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(true);
}

View File

@ -7,7 +7,7 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -17,13 +17,7 @@ function run_test() {
gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
gTestDirs = gTestDirsPartialSuccess;
preventDistributionFiles();
setupUpdaterTest(FILE_PARTIAL_MAR, true);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, true);
stageUpdate(true);
}

View File

@ -5,20 +5,14 @@
/* General Complete MAR File Patch Apply Test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
preventDistributionFiles();
setupUpdaterTest(FILE_COMPLETE_MAR, true);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, true);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await checkPostUpdateAppLog();
checkAppBundleModTime();

View File

@ -5,7 +5,7 @@
/* General Partial MAR File Patch Apply Test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -16,13 +16,7 @@ function run_test() {
gTestDirs = gTestDirsPartialSuccess;
// The third parameter will test that a relative path that contains a
// directory traversal to the post update binary doesn't execute.
setupUpdaterTest(FILE_PARTIAL_MAR, false, "test/../");
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false, "test/../");
runUpdate(STATE_SUCCEEDED, false, 0, true);
checkAppBundleModTime();
standardInit();

View File

@ -5,7 +5,7 @@
/* Test version downgrade MAR security check */
function run_test() {
async function run_test() {
if (!MOZ_VERIFY_MAR_SIGNATURE) {
return;
}
@ -16,13 +16,7 @@ function run_test() {
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_OLD_VERSION_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_OLD_VERSION_MAR, false);
// 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_VERSION_DOWNGRADE_ERROR,

View File

@ -5,7 +5,7 @@
/* Test product/channel MAR security check */
function run_test() {
async function run_test() {
if (!MOZ_VERIFY_MAR_SIGNATURE) {
return;
}
@ -18,13 +18,7 @@ function run_test() {
UPDATE_SETTINGS_CONTENTS.replace("xpcshell-test", "wrong-channel");
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
// 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_MAR_CHANNEL_MISMATCH_ERROR,

View File

@ -8,7 +8,7 @@
const STATE_AFTER_STAGE = STATE_FAILED;
gStagingRemovedUpdate = true;
function run_test() {
async function run_test() {
if (!MOZ_VERIFY_MAR_SIGNATURE) {
return;
}
@ -21,13 +21,7 @@ function run_test() {
UPDATE_SETTINGS_CONTENTS.replace("xpcshell-test", "wrong-channel");
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(true);
}

View File

@ -4,7 +4,7 @@
/* Bootstrap the tests using the service by installing our own version of the service */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -12,13 +12,7 @@ function run_test() {
// application return code and update.status result.
gTestFiles = gTestFilesCommon;
gTestDirs = [];
setupUpdaterTest(FILE_COMPLETE_MAR, null);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, null);
runUpdate(STATE_SUCCEEDED, false, 0, true);
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);

View File

@ -13,20 +13,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = "123456789";
if (AppConstants.platform == "win") {
path = "\\" + path;
@ -36,7 +30,6 @@ async function setupUpdaterTestFinished() {
path = "/" + path;
path = path.repeat(1000); // 10000 characters
}
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, path, null, null);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -13,27 +13,20 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = "123456789";
if (AppConstants.platform == "win") {
path = "C:\\" + path + "\\..\\" + path;
} else {
path = "/" + path + "/../" + path;
}
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, path, null, null);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -14,20 +14,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = getApplyDirFile("..", false).path;
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, path, null);
standardInit();

View File

@ -8,20 +8,14 @@
const STATE_AFTER_RUNUPDATE =
IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = getUpdateDirFile(DIR_PATCH).parent.path;
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, path, null, null, null);
standardInit();

View File

@ -8,27 +8,20 @@
const STATE_AFTER_RUNUPDATE =
IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = getUpdateDirFile(DIR_PATCH);
if (AppConstants.platform == "win") {
path = path + "\\..\\";
} else {
path = path + "/../";
}
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, path, null, null, null);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -15,20 +15,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = getApplyDirFile("..", false).path;
runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true, null, null, path, null);
standardInit();

View File

@ -14,20 +14,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
let path = "\\\\.\\" + getApplyDirFile(null, false).path;
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, path, null);
standardInit();

View File

@ -14,20 +14,14 @@ const STATE_AFTER_RUNUPDATE_SERVICE = AppConstants.EARLY_BETA_OR_EARLIER
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_AFTER_RUNUPDATE_SERVICE
: STATE_AFTER_RUNUPDATE_BASE;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, "test", null);
standardInit();
checkPostUpdateRunningFile(false);

View File

@ -9,22 +9,15 @@
const STATE_AFTER_STAGE = STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
createUpdateInProgressLockFile(getGREBinDir());
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(false);
}

View File

@ -9,20 +9,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(true);
}

View File

@ -9,20 +9,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, true);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, true);
stageUpdate(true);
}

View File

@ -7,23 +7,16 @@
* apply it.
*/
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
// The third parameter will test that a full path to the post update binary
// doesn't execute.
setupUpdaterTest(FILE_COMPLETE_MAR, undefined,
getApplyDirFile(null, true).path + "/");
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, undefined,
getApplyDirFile(null, true).path + "/");
runUpdateUsingApp(STATE_SUCCEEDED);
}

View File

@ -7,19 +7,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
stageUpdate(true);
}

View File

@ -4,19 +4,13 @@
/* Application in use complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await waitForHelperExit();

View File

@ -6,20 +6,14 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
gCallbackBinFile = "exe0.exe";
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(true);
}

View File

@ -6,20 +6,14 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
gCallbackBinFile = "exe0.exe";
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
stageUpdate(true);
}

View File

@ -4,20 +4,14 @@
/* Replace app binary complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
gCallbackBinFile = "exe0.exe";
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await checkPostUpdateAppLog();
standardInit();

View File

@ -4,20 +4,14 @@
/* Patch app binary partial MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
gCallbackBinFile = "exe0.exe";
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await checkPostUpdateAppLog();
standardInit();

View File

@ -5,7 +5,7 @@
/* General Partial MAR File Patch Apply Failure Test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -13,13 +13,7 @@ function run_test() {
gTestFiles[11].originalFile = "partial.png";
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
// 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,

View File

@ -7,19 +7,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName,
false);
stageUpdate(true);

View File

@ -7,19 +7,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName,
false);
stageUpdate(true);

View File

@ -4,19 +4,13 @@
/* File in use complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName,
false);
runUpdate(STATE_SUCCEEDED, false, 0, true);

View File

@ -4,19 +4,13 @@
/* File in use partial MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName,
false);
runUpdate(STATE_SUCCEEDED, false, 0, true);

View File

@ -4,20 +4,14 @@
/* File locked complete MAR file patch apply failure test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperLockFile(gTestFiles[3]);
runUpdate(STATE_FAILED_WRITE_ERROR, false, 1, true);
await waitForHelperExit();

View File

@ -4,20 +4,14 @@
/* File locked partial MAR file patch apply failure test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperLockFile(gTestFiles[2]);
runUpdate(STATE_FAILED_READ_ERROR, false, 1, true);
await waitForHelperExit();

View File

@ -6,20 +6,14 @@
const STATE_AFTER_STAGE = STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperLockFile(gTestFiles[3]);
stageUpdate(true);
}

View File

@ -6,20 +6,14 @@
const STATE_AFTER_STAGE = STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperLockFile(gTestFiles[2]);
stageUpdate(true);
}

View File

@ -8,19 +8,13 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] +
gTestDirs[4].subDirFiles[0], true);
stageUpdate(true);

View File

@ -8,20 +8,15 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true);
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0],
true);
stageUpdate(true);
}

View File

@ -4,19 +4,13 @@
/* File in use inside removed dir complete MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
await runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] +
gTestDirs[4].subDirFiles[0], true);
runUpdate(STATE_SUCCEEDED, false, 0, true);

View File

@ -4,20 +4,15 @@
/* File in use inside removed dir partial MAR file patch apply success test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true);
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
await runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0],
true);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await waitForHelperExit();
await checkPostUpdateAppLog();

View File

@ -8,7 +8,7 @@
const STATE_AFTER_STAGE = STATE_FAILED;
gStagingRemovedUpdate = true;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -16,13 +16,7 @@ function run_test() {
gTestFiles[11].originalFile = "partial.png";
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false);
stageUpdate(true);
}

View File

@ -7,7 +7,7 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -17,13 +17,7 @@ function run_test() {
gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
gTestDirs = gTestDirsCompleteSuccess;
setupSymLinks();
setupUpdaterTest(FILE_COMPLETE_MAR, false);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, false);
stageUpdate(true);
}

View File

@ -7,7 +7,7 @@
const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED;
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -17,13 +17,7 @@ function run_test() {
gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
gTestDirs = gTestDirsPartialSuccess;
preventDistributionFiles();
setupUpdaterTest(FILE_PARTIAL_MAR, true);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, true);
stageUpdate(true);
}

View File

@ -5,20 +5,14 @@
/* General Complete MAR File Patch Apply Test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
preventDistributionFiles();
setupUpdaterTest(FILE_COMPLETE_MAR, true);
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_COMPLETE_MAR, true);
runUpdate(STATE_SUCCEEDED, false, 0, true);
await checkPostUpdateAppLog();
checkAppBundleModTime();

View File

@ -5,7 +5,7 @@
/* General Partial MAR File Patch Apply Test */
function run_test() {
async function run_test() {
if (!setupTestCommon()) {
return;
}
@ -16,13 +16,7 @@ function run_test() {
gTestDirs = gTestDirsPartialSuccess;
// The third parameter will test that a relative path that contains a
// directory traversal to the post update binary doesn't execute.
setupUpdaterTest(FILE_PARTIAL_MAR, false, "test/../");
}
/**
* Called after the call to setupUpdaterTest finishes.
*/
async function setupUpdaterTestFinished() {
await setupUpdaterTest(FILE_PARTIAL_MAR, false, "test/../");
runUpdate(STATE_SUCCEEDED, false, 0, true);
checkAppBundleModTime();
standardInit();