Bug 879612 - Move app update common xpcshell test code into head_update.js.in. r=bbondy

This commit is contained in:
Robert Strong 2013-09-30 14:54:38 -07:00
parent c339e3d23e
commit 408799be98
55 changed files with 198 additions and 66 deletions

View File

@ -1164,16 +1164,6 @@ function setupUpdaterTest(aMarFile) {
let afterApplyBinDir = getApplyDirFile("a/b/", true);
helperBin.copyTo(afterApplyBinDir, gCallbackBinFile);
if (!gBackgroundUpdate && !gSwitchApp) {
let updaterIniContents = "[Strings]\n" +
"Title=Update XPCShell Test\n" +
"Info=Application Update Test - " + TEST_ID + "\n";
let updaterIni = updatesDir.clone();
updaterIni.append(FILE_UPDATER_INI);
writeFile(updaterIni, updaterIniContents);
updaterIni.copyTo(afterApplyBinDir, FILE_UPDATER_INI);
}
// Copy the mar that will be applied
let mar = do_get_file(aMarFile);
mar.copyTo(updatesDir, FILE_UPDATE_ARCHIVE);
@ -2240,6 +2230,8 @@ function adjustGeneralPaths() {
let ds = Services.dirsvc.QueryInterface(AUS_Ci.nsIDirectoryService);
ds.registerProvider(dirProvider);
do_register_cleanup(function() {
// Call end_test first before the directory provider is unregistered
end_test();
ds.unregisterProvider(dirProvider);
let testBin = do_get_file(getApplyDirPath() + "test" + APP_BIN_SUFFIX, true);
// Try to remove the test.bin file if it exists (it shouldn't).

View File

@ -9,8 +9,8 @@ const TEST_ID = "0010";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
// Verify write access to the custom app dir

View File

@ -12,8 +12,8 @@ var gExpectedCount;
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();

View File

@ -23,8 +23,8 @@ var gIncrementalDownloadErrorType = 0;
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false);

View File

@ -15,8 +15,8 @@ var gAppInfo;
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();

View File

@ -19,8 +19,8 @@ var gExpectedStatusText;
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();

View File

@ -9,8 +9,8 @@ const TEST_ID = "0060";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("testing addition of a successful update to " + FILE_UPDATES_DB +

View File

@ -9,8 +9,8 @@ const TEST_ID = "0061";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("testing removal of an update download in progress for an " +

View File

@ -9,8 +9,8 @@ const TEST_ID = "0062";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("testing resuming an update download in progress for the same " +

View File

@ -9,8 +9,8 @@ const TEST_ID = "0063";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("testing removing an active update for a channel that is not" +

View File

@ -9,8 +9,8 @@ const TEST_ID = "0064";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("testing removal of an update download in progress for the " +

View File

@ -9,8 +9,8 @@ const TEST_ID = "0070";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();

View File

@ -9,8 +9,8 @@ const TEST_ID = "0071";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();

View File

@ -8,8 +8,8 @@ const TEST_ID = "0072";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();

View File

@ -8,8 +8,8 @@ const TEST_ID = "0073";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();

View File

@ -12,8 +12,8 @@ const TEST_ID = "0080";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("testing nsIUpdatePrompt notifications should not be seen " +

View File

@ -11,8 +11,8 @@ const TEST_ID = "0081";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("testing nsIUpdatePrompt notifications should not be seen when " +

View File

@ -11,8 +11,8 @@ const TEST_ID = "0082";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();

View File

@ -236,8 +236,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_COMPLETE_FILE);
@ -286,3 +286,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -238,8 +238,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_PARTIAL_FILE);
@ -287,3 +287,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -231,8 +231,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_PARTIAL_FILE);
@ -283,3 +283,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -269,8 +269,8 @@ function checkSymlink() {
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -383,3 +383,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -18,11 +18,10 @@ function run_test() {
return;
}
// Setup an old version MAR file
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
// Setup an old version MAR file
setupUpdaterTest(MAR_OLD_VERSION_FILE);
// Apply the MAR
@ -40,3 +39,7 @@ function run_test() {
let updateStatus = readStatusFile(updatesDir);
do_check_eq(updateStatus.split(": ")[1], VERSION_DOWNGRADE_ERROR);
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -238,8 +238,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -328,3 +328,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -18,10 +18,10 @@ function run_test() {
return;
}
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
// Setup a wrong channel MAR file
do_register_cleanup(cleanupUpdaterTest);
setupUpdaterTest(MAR_WRONG_CHANNEL_FILE);
// Apply the MAR
@ -39,3 +39,7 @@ function run_test() {
let updateStatus = readStatusFile(updatesDir);
do_check_eq(updateStatus.split(": ")[1], MAR_CHANNEL_MISMATCH_ERROR);
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -230,8 +230,9 @@ ADDITIONAL_TEST_DIRS = [
}];
function run_test() {
do_register_cleanup(cleanupUpdaterTest);
do_test_pending();
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -282,4 +283,10 @@ function run_test() {
do_check_false(toBeDeletedDir.exists());
toBeDeletedDir = getTargetDirFile("tobedeleted", true);
do_check_false(toBeDeletedDir.exists());
do_test_finished();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -192,8 +192,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_COMPLETE_WIN_FILE);
@ -218,3 +218,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -194,8 +194,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_IN_USE_WIN_FILE);
@ -220,3 +220,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -192,8 +192,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -230,3 +230,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -194,8 +194,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -232,3 +232,7 @@ function run_test() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -235,8 +235,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_COMPLETE_FILE);
@ -301,3 +301,8 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -235,8 +235,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -328,3 +328,8 @@ function doUpdate() {
function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -185,8 +185,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -242,3 +242,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -185,8 +185,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -239,3 +239,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -185,8 +185,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_COMPLETE_FILE);
@ -236,3 +236,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -186,8 +186,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_PARTIAL_FILE);
@ -237,3 +237,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -185,8 +185,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -250,3 +250,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -186,8 +186,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -251,3 +251,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -185,8 +185,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -247,3 +247,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -186,8 +186,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -248,3 +248,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -191,8 +191,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_COMPLETE_FILE);
@ -233,3 +233,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -194,8 +194,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_IN_USE_WIN_FILE);
@ -236,3 +236,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -191,8 +191,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_COMPLETE_FILE);
@ -243,3 +243,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -234,8 +234,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
setupUpdaterTest(MAR_IN_USE_WIN_FILE);
@ -284,3 +284,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -191,8 +191,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -247,3 +247,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -194,8 +194,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -250,3 +250,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -191,8 +191,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -256,3 +256,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -234,8 +234,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -297,3 +297,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -191,8 +191,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -246,3 +246,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -194,8 +194,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -249,3 +249,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -191,8 +191,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -255,3 +255,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -234,8 +234,8 @@ ADDITIONAL_TEST_DIRS = [
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
gBackgroundUpdate = true;
@ -296,3 +296,7 @@ function checkUpdate() {
checkCallbackAppLog();
}
function end_test() {
cleanupUpdaterTest();
}

View File

@ -11,8 +11,8 @@ const TEST_ID = "bug595059";
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("testing Bug 595059 - calling nsIUpdatePrompt::showUpdateError " +

View File

@ -12,8 +12,8 @@ const NETWORK_ERROR_OFFLINE = 111;
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
logTestInfo("test when an update check fails because the network is " +

View File

@ -27,9 +27,9 @@ FakeDirProvider.prototype = {
function run_test() {
do_test_pending();
do_register_cleanup(end_test);
DEBUG_AUS_TEST = true;
// adjustGeneralPaths registers a cleanup function that calls end_test.
adjustGeneralPaths();
removeUpdateDirsAndFiles();