From 0ddd00f1959c78ce37c14fef3c83401408fca3bf Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Tue, 25 Feb 2020 15:07:00 -0500 Subject: Issue #439 - Remove tests from toolkit/ --- .../update/tests/unit_service_updater/.eslintrc.js | 7 - .../tests/unit_service_updater/bootstrapSvc.js | 35 ----- .../unit_service_updater/checkUpdaterSigSvc.js | 39 ------ .../tests/unit_service_updater/head_update.js | 8 -- .../invalidArgInstallDirPathTooLongFailureSvc.js | 47 ------- .../invalidArgInstallDirPathTraversalFailureSvc.js | 44 ------ ...rgInstallWorkingDirPathNotSameFailureSvc_win.js | 38 ----- .../invalidArgPatchDirPathTraversalFailureSvc.js | 43 ------ ...alidArgStageDirNotInInstallDirFailureSvc_win.js | 38 ----- ...validArgWorkingDirPathLocalUNCFailureSvc_win.js | 38 ----- .../invalidArgWorkingDirPathRelativeFailureSvc.js | 37 ----- .../marAppApplyDirLockedStageFailureSvc_win.js | 41 ------ ...AppApplyUpdateAppBinInUseStageSuccessSvc_win.js | 83 ----------- .../marAppApplyUpdateStageSuccessSvc.js | 82 ----------- .../marAppApplyUpdateSuccessSvc.js | 65 --------- .../marAppInUseStageFailureCompleteSvc_win.js | 70 --------- .../marAppInUseSuccessCompleteSvc.js | 62 -------- .../marCallbackAppStageSuccessCompleteSvc_win.js | 61 -------- .../marCallbackAppStageSuccessPartialSvc_win.js | 61 -------- .../marCallbackAppSuccessCompleteSvc_win.js | 48 ------- .../marCallbackAppSuccessPartialSvc_win.js | 48 ------- .../unit_service_updater/marFailurePartialSvc.js | 47 ------- .../marFileInUseStageFailureCompleteSvc_win.js | 67 --------- .../marFileInUseStageFailurePartialSvc_win.js | 67 --------- .../marFileInUseSuccessCompleteSvc_win.js | 63 --------- .../marFileInUseSuccessPartialSvc_win.js | 63 --------- .../marFileLockedFailureCompleteSvc_win.js | 57 -------- .../marFileLockedFailurePartialSvc_win.js | 56 -------- .../marFileLockedStageFailureCompleteSvc_win.js | 71 ---------- .../marFileLockedStageFailurePartialSvc_win.js | 70 --------- ...rRMRFDirFileInUseStageFailureCompleteSvc_win.js | 72 ---------- ...arRMRFDirFileInUseStageFailurePartialSvc_win.js | 71 ---------- .../marRMRFDirFileInUseSuccessCompleteSvc_win.js | 63 --------- .../marRMRFDirFileInUseSuccessPartialSvc_win.js | 62 -------- .../marStageFailurePartialSvc.js | 41 ------ .../marStageSuccessCompleteSvc.js | 132 ----------------- .../marStageSuccessPartialSvc.js | 112 --------------- .../unit_service_updater/marSuccessCompleteSvc.js | 96 ------------- .../unit_service_updater/marSuccessPartialSvc.js | 79 ----------- .../update/tests/unit_service_updater/xpcshell.ini | 156 --------------------- 40 files changed, 2440 deletions(-) delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/.eslintrc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/checkUpdaterSigSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/head_update.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallDirPathTooLongFailureSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallDirPathTraversalFailureSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallWorkingDirPathNotSameFailureSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/invalidArgPatchDirPathTraversalFailureSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/invalidArgStageDirNotInInstallDirFailureSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/invalidArgWorkingDirPathLocalUNCFailureSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/invalidArgWorkingDirPathRelativeFailureSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js delete mode 100644 toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini (limited to 'toolkit/mozapps/update/tests/unit_service_updater') diff --git a/toolkit/mozapps/update/tests/unit_service_updater/.eslintrc.js b/toolkit/mozapps/update/tests/unit_service_updater/.eslintrc.js deleted file mode 100644 index d35787cd2..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = { - "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" - ] -}; diff --git a/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js deleted file mode 100644 index 015fbd0cb..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js +++ /dev/null @@ -1,35 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* Bootstrap the tests using the service by installing our own version of the service */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - // We don't actually care if the MAR has any data, we only care about the - // application return code and update.status result. - gTestFiles = gTestFilesCommon; - gTestDirs = []; - setupUpdaterTest(FILE_COMPLETE_MAR, null); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdateUsingService finishes. - */ -function runUpdateFinished() { - checkFilesAfterUpdateSuccess(getApplyDirFile, false, false); - - // We need to check the service log even though this is a bootstrap - // because the app bin could be in use by this test by the time the next - // test runs. - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/checkUpdaterSigSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/checkUpdaterSigSvc.js deleted file mode 100644 index bf765ee78..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/checkUpdaterSigSvc.js +++ /dev/null @@ -1,39 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/** - * We skip authenticode cert checks from the service udpates - * so that we can use updater-xpcshell with the wrong certs for testing. - * This tests that code path. */ - -function run_test() { - if (!IS_AUTHENTICODE_CHECK_ENABLED) { - return; - } - - let binDir = getGREBinDir(); - let maintenanceServiceBin = binDir.clone(); - maintenanceServiceBin.append(FILE_MAINTENANCE_SERVICE_BIN); - - let updaterBin = binDir.clone(); - updaterBin.append(FILE_UPDATER_BIN); - - debugDump("Launching maintenance service bin: " + - maintenanceServiceBin.path + " to check updater: " + - updaterBin.path + " signature."); - - // Bypass the manifest and run as invoker - gEnv.set("__COMPAT_LAYER", "RunAsInvoker"); - - let dummyInstallPath = "---"; - let maintenanceServiceBinArgs = ["check-cert", dummyInstallPath, - updaterBin.path]; - let maintenanceServiceBinProcess = Cc["@mozilla.org/process/util;1"]. - createInstance(Ci.nsIProcess); - maintenanceServiceBinProcess.init(maintenanceServiceBin); - maintenanceServiceBinProcess.run(true, maintenanceServiceBinArgs, - maintenanceServiceBinArgs.length); - Assert.equal(maintenanceServiceBinProcess.exitValue, 0, - "the maintenance service exit value should be 0"); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/head_update.js b/toolkit/mozapps/update/tests/unit_service_updater/head_update.js deleted file mode 100644 index 38be4ee39..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/head_update.js +++ /dev/null @@ -1,8 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -const IS_SERVICE_TEST = true; - -/* import-globals-from ../data/xpcshellUtilsAUS.js */ -load("../data/xpcshellUtilsAUS.js"); diff --git a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallDirPathTooLongFailureSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallDirPathTooLongFailureSvc.js deleted file mode 100644 index 70e03646a..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallDirPathTooLongFailureSvc.js +++ /dev/null @@ -1,47 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* Too long install directory path failure test */ - -const STATE_AFTER_RUNUPDATE = - IS_SERVICE_TEST ? STATE_FAILED_SERVICE_INVALID_INSTALL_DIR_PATH_ERROR - : STATE_FAILED_INVALID_INSTALL_DIR_PATH_ERROR; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - let path = "123456789"; - if (IS_WIN) { - path = "\\" + path; - path = path.repeat(30); // 300 characters - path = "C:" + path; - } else { - path = "/" + path; - path = path.repeat(1000); // 10000 characters - } - - runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, path, null, null); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallDirPathTraversalFailureSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallDirPathTraversalFailureSvc.js deleted file mode 100644 index 330578de6..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallDirPathTraversalFailureSvc.js +++ /dev/null @@ -1,44 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* Install directory path traversal failure test */ - -const STATE_AFTER_RUNUPDATE = - IS_SERVICE_TEST ? STATE_FAILED_SERVICE_INVALID_INSTALL_DIR_PATH_ERROR - : STATE_FAILED_INVALID_INSTALL_DIR_PATH_ERROR; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - let path = "123456789"; - if (IS_WIN) { - path = "C:\\" + path + "\\..\\" + path; - } else { - path = "/" + path + "/../" + path; - } - - runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, path, null, null); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallWorkingDirPathNotSameFailureSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallWorkingDirPathNotSameFailureSvc_win.js deleted file mode 100644 index 8ddb34af0..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgInstallWorkingDirPathNotSameFailureSvc_win.js +++ /dev/null @@ -1,38 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* Different install and working directories for a regular update failure */ - -const STATE_AFTER_RUNUPDATE = - IS_SERVICE_TEST ? STATE_FAILED_SERVICE_INVALID_APPLYTO_DIR_ERROR - : STATE_FAILED_INVALID_APPLYTO_DIR_ERROR; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - let path = getApplyDirFile("..", false).path; - runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, path, null); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgPatchDirPathTraversalFailureSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/invalidArgPatchDirPathTraversalFailureSvc.js deleted file mode 100644 index c8ae3f0c6..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgPatchDirPathTraversalFailureSvc.js +++ /dev/null @@ -1,43 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* Patch directory path traversal failure test */ - -const STATE_AFTER_RUNUPDATE = - IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - let path = getUpdatesPatchDir(); - if (IS_WIN) { - path = path + "\\..\\"; - } else { - path = path + "/../"; - } - - runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, path, null, null, null); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgStageDirNotInInstallDirFailureSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/invalidArgStageDirNotInInstallDirFailureSvc_win.js deleted file mode 100644 index e9b227657..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgStageDirNotInInstallDirFailureSvc_win.js +++ /dev/null @@ -1,38 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* Different install and working directories for a regular update failure */ - -const STATE_AFTER_RUNUPDATE = - IS_SERVICE_TEST ? STATE_FAILED_SERVICE_INVALID_APPLYTO_DIR_STAGED_ERROR - : STATE_FAILED_INVALID_APPLYTO_DIR_STAGED_ERROR; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - let path = getApplyDirFile("..", false).path; - runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true, null, null, path, null); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgWorkingDirPathLocalUNCFailureSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/invalidArgWorkingDirPathLocalUNCFailureSvc_win.js deleted file mode 100644 index 87bbad4aa..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgWorkingDirPathLocalUNCFailureSvc_win.js +++ /dev/null @@ -1,38 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* Working directory path local UNC failure test */ - -const STATE_AFTER_RUNUPDATE = - IS_SERVICE_TEST ? STATE_FAILED_SERVICE_INVALID_WORKING_DIR_PATH_ERROR - : STATE_FAILED_INVALID_WORKING_DIR_PATH_ERROR; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - let path = "\\\\.\\" + getApplyDirFile(null, false).path; - runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, path, null); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgWorkingDirPathRelativeFailureSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/invalidArgWorkingDirPathRelativeFailureSvc.js deleted file mode 100644 index a550909b2..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/invalidArgWorkingDirPathRelativeFailureSvc.js +++ /dev/null @@ -1,37 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* Relative working directory path failure test */ - -const STATE_AFTER_RUNUPDATE = - IS_SERVICE_TEST ? STATE_FAILED_SERVICE_INVALID_WORKING_DIR_PATH_ERROR - : STATE_FAILED_INVALID_WORKING_DIR_PATH_ERROR; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, "test", null); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js deleted file mode 100644 index b9f793236..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js +++ /dev/null @@ -1,41 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/** - * Test applying an update by staging an update and launching an application to - * apply it. - */ - -const STATE_AFTER_STAGE = STATE_PENDING; - -function run_test() { - if (!setupTestCommon()) { - return; - } - - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - createUpdateInProgressLockFile(getAppBaseDir()); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(false); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - removeUpdateInProgressLockFile(getAppBaseDir()); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(PERFORMING_STAGED_UPDATE); - checkUpdateLogContains(ERR_UPDATE_IN_PROGRESS); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js deleted file mode 100644 index a606720b7..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js +++ /dev/null @@ -1,83 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/** - * Test applying an update by staging an update and launching an application to - * apply it. - */ - -const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED; - -function run_test() { - if (!setupTestCommon()) { - return; - } - - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR, undefined); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true, false); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); - lockDirectory(getAppBaseDir().path); - // Switch the application to the staged application that was updated. - runUpdateUsingApp(STATE_SUCCEEDED); -} - -/** - * Called after the call to runUpdateUsingApp finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - checkAppBundleModTime(); - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS); - - let updatesDir = getUpdatesPatchDir(); - Assert.ok(updatesDir.exists(), - MSG_SHOULD_EXIST + getMsgPath(updatesDir.path)); - - let log = getUpdateLog(FILE_UPDATE_LOG); - Assert.ok(!log.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(log.path)); - - log = getUpdateLog(FILE_LAST_UPDATE_LOG); - Assert.ok(log.exists(), - MSG_SHOULD_EXIST + getMsgPath(log.path)); - - log = getUpdateLog(FILE_BACKUP_UPDATE_LOG); - Assert.ok(log.exists(), - MSG_SHOULD_EXIST + getMsgPath(log.path)); - - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js deleted file mode 100644 index 5b9b08156..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js +++ /dev/null @@ -1,82 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/** - * Test applying an update by staging an update and launching an application to - * apply it. - */ - -const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED; - -function run_test() { - if (!setupTestCommon()) { - return; - } - - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR, true); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdateUsingApp(STATE_SUCCEEDED); -} - -/** - * Called after the call to runUpdateUsingApp finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - checkAppBundleModTime(); - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true); - - let updatesDir = getUpdatesPatchDir(); - Assert.ok(updatesDir.exists(), - MSG_SHOULD_EXIST + getMsgPath(updatesDir.path)); - - let log = getUpdateLog(FILE_UPDATE_LOG); - Assert.ok(!log.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(log.path)); - - log = getUpdateLog(FILE_LAST_UPDATE_LOG); - Assert.ok(log.exists(), - MSG_SHOULD_EXIST + getMsgPath(log.path)); - - log = getUpdateLog(FILE_BACKUP_UPDATE_LOG); - Assert.ok(log.exists(), - MSG_SHOULD_EXIST + getMsgPath(log.path)); - - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js deleted file mode 100644 index e76233fe6..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js +++ /dev/null @@ -1,65 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/** - * Test applying an update by staging an update and launching an application to - * apply it. - */ - -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() { - runUpdateUsingApp(STATE_SUCCEEDED); -} - -/** - * Called after the call to runUpdateUsingApp finishes. - */ -function runUpdateFinished() { - checkAppBundleModTime(); - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getApplyDirFile); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS); - - let updatesDir = getUpdatesPatchDir(); - Assert.ok(updatesDir.exists(), - MSG_SHOULD_EXIST + getMsgPath(updatesDir.path)); - - let log = getUpdateLog(FILE_UPDATE_LOG); - Assert.ok(!log.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(log.path)); - - log = getUpdateLog(FILE_LAST_UPDATE_LOG); - Assert.ok(log.exists(), - MSG_SHOULD_EXIST + getMsgPath(log.path)); - - log = getUpdateLog(FILE_BACKUP_UPDATE_LOG); - Assert.ok(!log.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(log.path)); - - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js deleted file mode 100644 index b1505d58e..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js +++ /dev/null @@ -1,70 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* Application in use complete MAR file staged patch apply failure test */ - -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() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_AFTER_RUNUPDATE, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - setTestFilesAndDirsForFailure(); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_RENAME_FILE); - checkUpdateLogContains(ERR_MOVE_DESTDIR_7 + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js deleted file mode 100644 index 93333cade..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js +++ /dev/null @@ -1,62 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* Application in use complete MAR file patch apply success test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - checkAppBundleModTime(); - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js deleted file mode 100644 index 79e54c182..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js +++ /dev/null @@ -1,61 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* Replace app binary complete MAR file staged patch apply success test */ - -const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - gCallbackBinFile = "exe0.exe"; - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js deleted file mode 100644 index b1f84715f..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js +++ /dev/null @@ -1,61 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* Patch app binary partial MAR file staged patch apply success test */ - -const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestDirs = gTestDirsPartialSuccess; - gCallbackBinFile = "exe0.exe"; - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js deleted file mode 100644 index 85e92d290..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js +++ /dev/null @@ -1,48 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* Replace app binary complete MAR file patch apply success test */ - -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() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js deleted file mode 100644 index 1212c9ba2..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js +++ /dev/null @@ -1,48 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* Patch app binary partial MAR file patch apply success test */ - -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() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js deleted file mode 100644 index 960c96f7b..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js +++ /dev/null @@ -1,47 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* General Partial MAR File Patch Apply Failure Test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestFiles[11].originalFile = "partial.png"; - gTestDirs = gTestDirsPartialSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - // If execv is used the updater process will turn into the callback process - // and the updater's return code will be that of the callback process. - runUpdate(STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, false, (USE_EXECV ? 0 : 1), - true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkAppBundleModTime(); - standardInit(); - Assert.equal(readStatusFile(), STATE_NONE, - "the status file failure code" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_FAILED, - "the update state" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).errorCode, LOADSOURCE_ERROR_WRONG_SIZE, - "the update errorCode" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContents(LOG_PARTIAL_FAILURE); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js deleted file mode 100644 index b39595f92..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js +++ /dev/null @@ -1,67 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File in use complete MAR file staged patch apply failure test */ - -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() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName, - false); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_AFTER_RUNUPDATE, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - setTestFilesAndDirsForFailure(); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_RENAME_FILE); - checkUpdateLogContains(ERR_MOVE_DESTDIR_7 + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js deleted file mode 100644 index 06d386ad6..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js +++ /dev/null @@ -1,67 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File in use partial MAR file staged patch apply failure test */ - -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() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestDirs = gTestDirsPartialSuccess; - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName, - false); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_AFTER_RUNUPDATE, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - setTestFilesAndDirsForFailure(); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_RENAME_FILE); - checkUpdateLogContains(ERR_MOVE_DESTDIR_7 + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js deleted file mode 100644 index 89a2fff5e..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js +++ /dev/null @@ -1,63 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File in use complete MAR file patch apply success test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(gTestFiles[13].relPathDir + gTestFiles[13].fileName, - false); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContains(ERR_BACKUP_DISCARD); - checkUpdateLogContains(STATE_SUCCEEDED + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js deleted file mode 100644 index ea85ddccc..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js +++ /dev/null @@ -1,63 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File in use partial MAR file patch apply success test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestDirs = gTestDirsPartialSuccess; - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(gTestFiles[11].relPathDir + gTestFiles[11].fileName, - false); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContains(ERR_BACKUP_DISCARD); - checkUpdateLogContains(STATE_SUCCEEDED + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js deleted file mode 100644 index c5efaa8c0..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js +++ /dev/null @@ -1,57 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File locked complete MAR file patch apply failure test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperLockFile(gTestFiles[3]); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - runUpdate(STATE_FAILED_WRITE_ERROR, false, 1, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(readStatusFile(), STATE_PENDING, - "the status file failure code" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_PENDING, - "the update state" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).errorCode, WRITE_ERROR, - "the update errorCode" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_RENAME_FILE); - checkUpdateLogContains(ERR_BACKUP_CREATE_7); - checkUpdateLogContains(STATE_FAILED_WRITE_ERROR + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js deleted file mode 100644 index 4fdbadb5b..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js +++ /dev/null @@ -1,56 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File locked partial MAR file patch apply failure test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestDirs = gTestDirsPartialSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperLockFile(gTestFiles[2]); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - runUpdate(STATE_FAILED_READ_ERROR, false, 1, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(readStatusFile(), STATE_NONE, - "the status file failure code" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_FAILED, - "the update state" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).errorCode, READ_ERROR, - "the update errorCode" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_UNABLE_OPEN_DEST); - checkUpdateLogContains(STATE_FAILED_READ_ERROR + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js deleted file mode 100644 index 4d12f4e42..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js +++ /dev/null @@ -1,71 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File locked complete MAR file staged patch apply failure test */ - -const STATE_AFTER_STAGE = STATE_PENDING; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperLockFile(gTestFiles[3]); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - // Files aren't checked after staging since this test locks a file which - // prevents reading the file. - checkUpdateLogContains(ERR_ENSURE_COPY); - // Switch the application to the staged application that was updated. - runUpdate(STATE_FAILED_WRITE_ERROR, false, 1, false); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(readStatusFile(), STATE_PENDING, - "the status file failure code" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.updateCount, 2, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_PENDING, - "the update state" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).errorCode, WRITE_ERROR, - "the update errorCode" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_RENAME_FILE); - checkUpdateLogContains(ERR_BACKUP_CREATE_7); - checkUpdateLogContains(STATE_FAILED_WRITE_ERROR + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js deleted file mode 100644 index 5f64df34c..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js +++ /dev/null @@ -1,70 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File locked partial MAR file staged patch apply failure test */ - -const STATE_AFTER_STAGE = STATE_PENDING; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestDirs = gTestDirsPartialSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperLockFile(gTestFiles[2]); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - // Files aren't checked after staging since this test locks a file which - // prevents reading the file. - checkUpdateLogContains(ERR_ENSURE_COPY); - // Switch the application to the staged application that was updated. - runUpdate(STATE_FAILED_READ_ERROR, false, 1, false); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(readStatusFile(), STATE_NONE, - "the status file failure code" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.updateCount, 2, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_FAILED, - "the update state" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).errorCode, READ_ERROR, - "the update errorCode" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_UNABLE_OPEN_DEST); - checkUpdateLogContains(STATE_FAILED_READ_ERROR + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js deleted file mode 100644 index b83bafccc..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js +++ /dev/null @@ -1,72 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File in use inside removed dir complete MAR file staged patch apply failure - test */ - -const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED; -const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] + - gTestDirs[4].subDirFiles[0], true); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_AFTER_RUNUPDATE, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - setTestFilesAndDirsForFailure(); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_RENAME_FILE); - checkUpdateLogContains(ERR_MOVE_DESTDIR_7 + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js deleted file mode 100644 index 39ea485cd..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js +++ /dev/null @@ -1,71 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File in use inside removed dir partial MAR file staged patch apply failure - test */ - -const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED; -const STATE_AFTER_RUNUPDATE = IS_SERVICE_TEST ? STATE_PENDING_SVC : STATE_PENDING; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestDirs = gTestDirsPartialSuccess; - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_AFTER_RUNUPDATE, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - setTestFilesAndDirsForFailure(); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_RENAME_FILE); - checkUpdateLogContains(ERR_MOVE_DESTDIR_7 + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js deleted file mode 100644 index a71bb8d49..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js +++ /dev/null @@ -1,63 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File in use inside removed dir complete MAR file patch apply success test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(gTestDirs[4].relPathDir + gTestDirs[4].subDirs[0] + - gTestDirs[4].subDirFiles[0], true); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContains(ERR_BACKUP_DISCARD); - checkUpdateLogContains(STATE_SUCCEEDED + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js deleted file mode 100644 index 2cbe70ed8..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js +++ /dev/null @@ -1,62 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/* File in use inside removed dir partial MAR file patch apply success test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestDirs = gTestDirsPartialSuccess; - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runHelperFileInUse(gTestDirs[2].relPathDir + gTestDirs[2].files[0], true); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContains(ERR_BACKUP_DISCARD); - checkUpdateLogContains(STATE_SUCCEEDED + "\n" + CALL_QUIT); - checkCallbackLog(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js deleted file mode 100644 index a9ce23420..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js +++ /dev/null @@ -1,41 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* General Partial MAR File Staged Patch Apply Failure Test */ - -const STATE_AFTER_STAGE = STATE_FAILED; -gStagingRemovedUpdate = true; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestFiles[11].originalFile = "partial.png"; - gTestDirs = gTestDirsPartialSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_PARTIAL_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).errorCode, LOADSOURCE_ERROR_WRONG_SIZE, - "the update errorCode" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(ERR_LOADSOURCEFILE_FAILED); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js deleted file mode 100644 index f7745f68f..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js +++ /dev/null @@ -1,132 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* General Complete MAR File Staged Patch Apply Test */ - -const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestFiles[gTestFiles.length - 1].originalContents = null; - gTestFiles[gTestFiles.length - 1].compareContents = "FromComplete\n"; - gTestFiles[gTestFiles.length - 1].comparePerms = 0o644; - gTestDirs = gTestDirsCompleteSuccess; - setupDistributionDir(); - setupSymLinks(); - setupUpdaterTest(FILE_COMPLETE_MAR, false); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - checkAppBundleModTime(); - checkSymLinks(); - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true); - checkDistributionDir(); - checkCallbackLog(); -} - -/** - * Setup the state of the distribution directory for the test. - */ -function setupDistributionDir() { - if (IS_MACOSX) { - // Create files in the old distribution directory location to verify that - // the directory and its contents are removed when there is a distribution - // directory in the new location. - let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true); - writeFile(testFile, "test\n"); - testFile = getApplyDirFile(DIR_MACOS + "distribution/test1/testFile", true); - writeFile(testFile, "test\n"); - } -} - -/** - * Checks the state of the distribution directory for the test. - */ -function checkDistributionDir() { - if (IS_MACOSX) { - let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true); - Assert.ok(!distributionDir.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path)); - checkUpdateLogContains(REMOVE_OLD_DIST_DIR); - } -} - -/** - * Setup symlinks for the test. - */ -function setupSymLinks() { - // Don't test symlinks on Mac OS X in this test since it tends to timeout. - // It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js - if (IS_UNIX && !IS_MACOSX) { - removeSymlink(); - createSymlink(); - do_register_cleanup(removeSymlink); - gTestFiles.splice(gTestFiles.length - 3, 0, - { - description: "Readable symlink", - fileName: "link", - relPathDir: DIR_RESOURCES, - originalContents: "test", - compareContents: "test", - originalFile: null, - compareFile: null, - originalPerms: 0o666, - comparePerms: 0o666 - }); - } -} - -/** - * Checks the state of the symlinks for the test. - */ -function checkSymLinks() { - // Don't test symlinks on Mac OS X in this test since it tends to timeout. - // It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js - if (IS_UNIX && !IS_MACOSX) { - checkSymlink(); - } -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js deleted file mode 100644 index ef15326de..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js +++ /dev/null @@ -1,112 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* General Partial MAR File Staged Patch Apply Test */ - -const STATE_AFTER_STAGE = IS_SERVICE_TEST ? STATE_APPLIED_SVC : STATE_APPLIED; - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestFiles[gTestFiles.length - 2].originalContents = null; - gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n"; - gTestFiles[gTestFiles.length - 2].comparePerms = 0o644; - gTestDirs = gTestDirsPartialSuccess; - preventDistributionFiles(); - setupDistributionDir(); - setupUpdaterTest(FILE_PARTIAL_MAR, true); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(true); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true, false, true); - // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - checkAppBundleModTime(); - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile, false, true); - checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true, true); - checkDistributionDir(); - checkCallbackLog(); -} - -/** - * Setup the state of the distribution directory for the test. - */ -function setupDistributionDir() { - if (IS_MACOSX) { - // Create files in the old distribution directory location to verify that - // the directory and its contents are moved to the new location on update. - let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true); - writeFile(testFile, "test\n"); - testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true); - writeFile(testFile, "test\n"); - } -} - -/** - * Checks the state of the distribution directory. - */ -function checkDistributionDir() { - let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true); - if (IS_MACOSX) { - Assert.ok(distributionDir.exists(), - MSG_SHOULD_EXIST + getMsgPath(distributionDir.path)); - - let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true); - Assert.ok(testFile.exists(), - MSG_SHOULD_EXIST + getMsgPath(testFile.path)); - - testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true); - Assert.ok(testFile.exists(), - MSG_SHOULD_EXIST + getMsgPath(testFile.path)); - - distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true); - Assert.ok(!distributionDir.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path)); - - checkUpdateLogContains(MOVE_OLD_DIST_DIR); - } else { - debugDump("testing that files aren't added with an add-if instruction " + - "when the file's destination directory doesn't exist"); - Assert.ok(!distributionDir.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path)); - } -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js deleted file mode 100644 index 1008e867f..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js +++ /dev/null @@ -1,96 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* General Complete MAR File Patch Apply Test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - preventDistributionFiles(); - setupDistributionDir(); - setupUpdaterTest(FILE_COMPLETE_MAR, true); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkPostUpdateAppLog(); -} - -/** - * Called after the call to checkPostUpdateAppLog finishes. - */ -function checkPostUpdateAppLogFinished() { - checkAppBundleModTime(); - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(true); - checkFilesAfterUpdateSuccess(getApplyDirFile); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, false, false, true); - checkDistributionDir(); - checkCallbackLog(); -} - -/** - * Setup the state of the distribution directory for the test. - */ -function setupDistributionDir() { - if (IS_MACOSX) { - // Create files in the old distribution directory location to verify that - // the directory and its contents are moved to the new location on update. - let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true); - writeFile(testFile, "test\n"); - testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true); - writeFile(testFile, "test\n"); - } -} - -/** - * Checks the state of the distribution directory. - */ -function checkDistributionDir() { - let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true); - if (IS_MACOSX) { - Assert.ok(distributionDir.exists(), - MSG_SHOULD_EXIST + getMsgPath(distributionDir.path)); - - let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true); - Assert.ok(testFile.exists(), - MSG_SHOULD_EXIST + getMsgPath(testFile.path)); - - testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true); - Assert.ok(testFile.exists(), - MSG_SHOULD_EXIST + getMsgPath(testFile.path)); - - distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true); - Assert.ok(!distributionDir.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path)); - - checkUpdateLogContains(MOVE_OLD_DIST_DIR); - } else { - debugDump("testing that files aren't added with an add-if instruction " + - "when the file's destination directory doesn't exist"); - Assert.ok(!distributionDir.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path)); - } -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js deleted file mode 100644 index 616390f55..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js +++ /dev/null @@ -1,79 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/* General Partial MAR File Patch Apply Test */ - -function run_test() { - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesPartialSuccess; - gTestFiles[gTestFiles.length - 1].originalContents = null; - gTestFiles[gTestFiles.length - 1].compareContents = "FromPartial\n"; - gTestFiles[gTestFiles.length - 1].comparePerms = 0o644; - gTestFiles[gTestFiles.length - 2].originalContents = null; - gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n"; - gTestFiles[gTestFiles.length - 2].comparePerms = 0o644; - gTestDirs = gTestDirsPartialSuccess; - setupDistributionDir(); - // 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. - */ -function setupUpdaterTestFinished() { - runUpdate(STATE_SUCCEEDED, false, 0, true); -} - -/** - * Called after the call to runUpdate finishes. - */ -function runUpdateFinished() { - checkAppBundleModTime(); - standardInit(); - Assert.equal(readStatusState(), STATE_NONE, - "the status file state" + MSG_SHOULD_EQUAL); - Assert.ok(!gUpdateManager.activeUpdate, - "the active update should not be defined"); - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_SUCCEEDED, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getApplyDirFile); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS); - checkDistributionDir(); - checkCallbackLog(); -} - -/** - * Setup the state of the distribution directory for the test. - */ -function setupDistributionDir() { - if (IS_MACOSX) { - // Create files in the old distribution directory location to verify that - // the directory and its contents are removed when there is a distribution - // directory in the new location. - let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true); - writeFile(testFile, "test\n"); - testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true); - writeFile(testFile, "test\n"); - } -} - -/** - * Checks the state of the distribution directory. - */ -function checkDistributionDir() { - if (IS_MACOSX) { - let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true); - Assert.ok(!distributionDir.exists(), - MSG_SHOULD_NOT_EXIST + getMsgPath(distributionDir.path)); - checkUpdateLogContains(REMOVE_OLD_DIST_DIR); - } -} diff --git a/toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini b/toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini deleted file mode 100644 index 1d63f8583..000000000 --- a/toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini +++ /dev/null @@ -1,156 +0,0 @@ -; This Source Code Form is subject to the terms of the Mozilla Public -; License, v. 2.0. If a copy of the MPL was not distributed with this -; file, You can obtain one at http://mozilla.org/MPL/2.0/. - -; Tests that require the updater binary and the maintenance service. - -[DEFAULT] -tags = appupdate -head = head_update.js -tail = - -[bootstrapSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[invalidArgInstallDirPathTooLongFailureSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[invalidArgInstallDirPathTraversalFailureSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[invalidArgInstallWorkingDirPathNotSameFailureSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[invalidArgPatchDirPathTraversalFailureSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[invalidArgStageDirNotInInstallDirFailureSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[invalidArgWorkingDirPathLocalUNCFailureSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[invalidArgWorkingDirPathRelativeFailureSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marSuccessCompleteSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marSuccessPartialSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFailurePartialSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marStageSuccessCompleteSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marStageSuccessPartialSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marStageFailurePartialSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marCallbackAppSuccessCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marCallbackAppSuccessPartialSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marCallbackAppStageSuccessCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marCallbackAppStageSuccessPartialSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marAppInUseSuccessCompleteSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marAppInUseStageFailureCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFileLockedFailureCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFileLockedFailurePartialSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFileLockedStageFailureCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFileLockedStageFailurePartialSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFileInUseSuccessCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFileInUseSuccessPartialSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marRMRFDirFileInUseSuccessCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marRMRFDirFileInUseSuccessPartialSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFileInUseStageFailureCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marFileInUseStageFailurePartialSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marRMRFDirFileInUseStageFailureCompleteSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marRMRFDirFileInUseStageFailurePartialSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marAppApplyDirLockedStageFailureSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marAppApplyUpdateSuccessSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[marAppApplyUpdateStageSuccessSvc.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -run-sequentially = Uses the Mozilla Maintenance Service. -[checkUpdaterSigSvc.js] -- cgit v1.2.3