diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/mozapps/update/tests/unit_base_updater | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/mozapps/update/tests/unit_base_updater')
44 files changed, 0 insertions, 2731 deletions
diff --git a/toolkit/mozapps/update/tests/unit_base_updater/.eslintrc.js b/toolkit/mozapps/update/tests/unit_base_updater/.eslintrc.js deleted file mode 100644 index d35787cd2..000000000 --- a/toolkit/mozapps/update/tests/unit_base_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_base_updater/head_update.js b/toolkit/mozapps/update/tests/unit_base_updater/head_update.js deleted file mode 100644 index 9715c5828..000000000 --- a/toolkit/mozapps/update/tests/unit_base_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 = false; - -/* import-globals-from ../data/xpcshellUtilsAUS.js */ -load("../data/xpcshellUtilsAUS.js"); diff --git a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgCallbackFileNotInInstallDirFailure.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgCallbackFileNotInInstallDirFailure.js deleted file mode 100644 index f3f767394..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgCallbackFileNotInInstallDirFailure.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/. - */ - -/* Callback file not in install directory or a sub-directory of the install - directory failure */ - -const STATE_AFTER_RUNUPDATE = STATE_FAILED_INVALID_CALLBACK_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 = getTestDirFile(FILE_HELPER_BIN).path; - runUpdate(STATE_AFTER_RUNUPDATE, false, 1, true, null, null, null, path); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgCallbackFilePathTooLongFailure.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgCallbackFilePathTooLongFailure.js deleted file mode 100644 index 969f84f9d..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgCallbackFilePathTooLongFailure.js +++ /dev/null @@ -1,45 +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 callback file path failure test */ - -const STATE_AFTER_RUNUPDATE = STATE_FAILED_INVALID_CALLBACK_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, null, null, path); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - standardInit(); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgInstallDirPathTooLongFailure.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgInstallDirPathTooLongFailure.js deleted file mode 100644 index 70e03646a..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgInstallDirPathTooLongFailure.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_base_updater/invalidArgInstallDirPathTraversalFailure.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgInstallDirPathTraversalFailure.js deleted file mode 100644 index 330578de6..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgInstallDirPathTraversalFailure.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_base_updater/invalidArgInstallWorkingDirPathNotSameFailure_win.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgInstallWorkingDirPathNotSameFailure_win.js deleted file mode 100644 index 8ddb34af0..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgInstallWorkingDirPathNotSameFailure_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_base_updater/invalidArgPatchDirPathTraversalFailure.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgPatchDirPathTraversalFailure.js deleted file mode 100644 index c8ae3f0c6..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgPatchDirPathTraversalFailure.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_base_updater/invalidArgStageDirNotInInstallDirFailure_win.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgStageDirNotInInstallDirFailure_win.js deleted file mode 100644 index e9b227657..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgStageDirNotInInstallDirFailure_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_base_updater/invalidArgWorkingDirPathLocalUNCFailure_win.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgWorkingDirPathLocalUNCFailure_win.js deleted file mode 100644 index 87bbad4aa..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgWorkingDirPathLocalUNCFailure_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_base_updater/invalidArgWorkingDirPathRelativeFailure.js b/toolkit/mozapps/update/tests/unit_base_updater/invalidArgWorkingDirPathRelativeFailure.js deleted file mode 100644 index a550909b2..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/invalidArgWorkingDirPathRelativeFailure.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_base_updater/marAppApplyDirLockedStageFailure_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyDirLockedStageFailure_win.js deleted file mode 100644 index b9f793236..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyDirLockedStageFailure_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_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js deleted file mode 100644 index a606720b7..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_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_base_updater/marAppApplyUpdateStageOldVersionFailure.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageOldVersionFailure.js deleted file mode 100644 index 00b38adc7..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageOldVersionFailure.js +++ /dev/null @@ -1,88 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/** - * Test a replace request for a staged update with a version file that specifies - * an older version failure. The same check is used in nsUpdateDriver.cpp for - * all update types which is why there aren't tests for the maintenance service - * as well as for other update types. - */ - -const STATE_AFTER_STAGE = STATE_APPLIED; - -function run_test() { - if (!setupTestCommon()) { - return; - } - - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setupUpdaterTest(FILE_COMPLETE_MAR); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - stageUpdate(false); -} - -/** - * Called after the call to stageUpdate finishes. - */ -function stageUpdateFinished() { - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); - // Change the active update to an older version to simulate installing a new - // version of the application while there is an update that has been staged. - let channel = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_CHANNEL); - let patches = getLocalPatchString(null, null, null, null, null, "true", - STATE_AFTER_STAGE); - let updates = getLocalUpdateString(patches, null, null, null, "1.0", null, - null, null, null, null, "true", channel); - writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); - // Change the version file to an older version to simulate installing a new - // version of the application while there is an update that has been staged. - writeVersionFile("1.0"); - reloadUpdateManagerData(); - // Try to switch the application to the staged application that was updated. - runUpdateUsingApp(STATE_AFTER_STAGE); -} - -/** - * Called after the call to runUpdateUsingApp finishes. - */ -function runUpdateFinished() { - 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_STAGE, - "the update state" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - setTestFilesAndDirsForFailure(); - checkFilesAfterUpdateFailure(getApplyDirFile, IS_MACOSX ? false : true, false); - - 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_base_updater/marAppApplyUpdateStageSuccess.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js deleted file mode 100644 index 5b9b08156..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.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_base_updater/marAppApplyUpdateSuccess.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.js deleted file mode 100644 index e76233fe6..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.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_base_updater/marAppInUseStageFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js deleted file mode 100644 index b1505d58e..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_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_base_updater/marAppInUseStageSuccessComplete_unix.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js deleted file mode 100644 index a1cc7d043..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js +++ /dev/null @@ -1,113 +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 success test */ - -const START_STATE = STATE_PENDING; -const STATE_AFTER_STAGE = 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; - setupUpdaterTest(FILE_COMPLETE_MAR, true); -} - -/** - * Called after the call to setupUpdaterTest finishes. - */ -function setupUpdaterTestFinished() { - setupSymLinks(); - runHelperFileInUse(DIR_RESOURCES + gCallbackBinFile, false); -} - -/** - * Called after the call to waitForHelperSleep finishes. - */ -function waitForHelperSleepFinished() { - stageUpdate(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() { - waitForHelperExit(); -} - -/** - * Called after the call to waitForHelperExit finishes. - */ -function waitForHelperExitFinished() { - 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); - checkUpdateLogContents(LOG_REPLACE_SUCCESS, false, true); - checkCallbackLog(); -} - -/** - * Setup symlinks for the test. - */ -function setupSymLinks() { - if (IS_UNIX) { - 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() { - if (IS_UNIX) { - checkSymlink(); - } -} diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js deleted file mode 100644 index 93333cade..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.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_base_updater/marCallbackAppStageSuccessComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js deleted file mode 100644 index 79e54c182..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_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_base_updater/marCallbackAppStageSuccessPartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js deleted file mode 100644 index b1f84715f..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_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_base_updater/marCallbackAppSuccessComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_win.js deleted file mode 100644 index 85e92d290..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_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_base_updater/marCallbackAppSuccessPartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_win.js deleted file mode 100644 index 1212c9ba2..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_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_base_updater/marFailurePartial.js b/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js deleted file mode 100644 index 960c96f7b..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.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_base_updater/marFileInUseStageFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_win.js deleted file mode 100644 index b39595f92..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_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_base_updater/marFileInUseStageFailurePartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_win.js deleted file mode 100644 index 06d386ad6..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_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_base_updater/marFileInUseSuccessComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js deleted file mode 100644 index 89a2fff5e..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_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_base_updater/marFileInUseSuccessPartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_win.js deleted file mode 100644 index ea85ddccc..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_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_base_updater/marFileLockedFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_win.js deleted file mode 100644 index c5efaa8c0..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_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_base_updater/marFileLockedFailurePartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js deleted file mode 100644 index 4fdbadb5b..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_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_base_updater/marFileLockedStageFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js deleted file mode 100644 index 4d12f4e42..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_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_base_updater/marFileLockedStageFailurePartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js deleted file mode 100644 index 5f64df34c..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_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_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js deleted file mode 100644 index b83bafccc..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_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_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js deleted file mode 100644 index 39ea485cd..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_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_base_updater/marRMRFDirFileInUseSuccessComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js deleted file mode 100644 index a71bb8d49..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_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_base_updater/marRMRFDirFileInUseSuccessPartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_win.js deleted file mode 100644 index 2cbe70ed8..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_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_base_updater/marStageFailurePartial.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js deleted file mode 100644 index a9ce23420..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.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_base_updater/marStageSuccessComplete.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js deleted file mode 100644 index f7745f68f..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.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_base_updater/marStageSuccessPartial.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js deleted file mode 100644 index ef15326de..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.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_base_updater/marSuccessComplete.js b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js deleted file mode 100644 index 1008e867f..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.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_base_updater/marSuccessPartial.js b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js deleted file mode 100644 index 616390f55..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.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_base_updater/marVersionDowngrade.js b/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js deleted file mode 100644 index 86a2eb821..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js +++ /dev/null @@ -1,51 +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/. - */ - -/* Test version downgrade MAR security check */ - -function run_test() { - if (!MOZ_VERIFY_MAR_SIGNATURE) { - return; - } - - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_OLD_VERSION_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_VERSION_DOWNGRADE_ERROR, false, (USE_EXECV ? 0 : 1), - false); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - 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_FAILED, - "the update state" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).errorCode, VERSION_DOWNGRADE_ERROR, - "the update errorCode" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(STATE_FAILED_VERSION_DOWNGRADE_ERROR); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js b/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js deleted file mode 100644 index 6db906fbc..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js +++ /dev/null @@ -1,51 +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/. - */ - -/* Test product/channel MAR security check */ - -function run_test() { - if (!MOZ_VERIFY_MAR_SIGNATURE) { - return; - } - - if (!setupTestCommon()) { - return; - } - gTestFiles = gTestFilesCompleteSuccess; - gTestDirs = gTestDirsCompleteSuccess; - setTestFilesAndDirsForFailure(); - setupUpdaterTest(FILE_WRONG_CHANNEL_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_MAR_CHANNEL_MISMATCH_ERROR, false, (USE_EXECV ? 0 : 1), - false); -} - -/** - * Called after the call to runUpdateUsingUpdater finishes. - */ -function runUpdateFinished() { - 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_FAILED, - "the update state" + MSG_SHOULD_EQUAL); - Assert.equal(gUpdateManager.getUpdateAt(0).errorCode, MAR_CHANNEL_MISMATCH_ERROR, - "the update errorCode" + MSG_SHOULD_EQUAL); - checkPostUpdateRunningFile(false); - checkFilesAfterUpdateFailure(getApplyDirFile); - checkUpdateLogContains(STATE_FAILED_MAR_CHANNEL_MISMATCH_ERROR); - waitForFilesInUse(); -} diff --git a/toolkit/mozapps/update/tests/unit_base_updater/xpcshell.ini b/toolkit/mozapps/update/tests/unit_base_updater/xpcshell.ini deleted file mode 100644 index 2b77bee7a..000000000 --- a/toolkit/mozapps/update/tests/unit_base_updater/xpcshell.ini +++ /dev/null @@ -1,136 +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. These tests should never run on Android -; which doesn't use the updater binary as other applications do and are excluded -; from running the tests in the moz.build file. - -[DEFAULT] -tags = appupdate -head = head_update.js -tail = - -[invalidArgCallbackFileNotInInstallDirFailure.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[invalidArgCallbackFilePathTooLongFailure.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[invalidArgInstallDirPathTooLongFailure.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[invalidArgInstallDirPathTraversalFailure.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[invalidArgInstallWorkingDirPathNotSameFailure_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[invalidArgPatchDirPathTraversalFailure.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[invalidArgStageDirNotInInstallDirFailure_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[invalidArgWorkingDirPathLocalUNCFailure_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[invalidArgWorkingDirPathRelativeFailure.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marSuccessComplete.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marSuccessPartial.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marFailurePartial.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marStageSuccessComplete.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marStageSuccessPartial.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marVersionDowngrade.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 and mar signing -[marWrongChannel.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 and mar signing -[marStageFailurePartial.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marCallbackAppSuccessComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marCallbackAppSuccessPartial_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marCallbackAppStageSuccessComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marCallbackAppStageSuccessPartial_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marAppInUseSuccessComplete.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marAppInUseStageSuccessComplete_unix.js] -skip-if = os == 'win' -reason = not a Windows test -[marAppInUseStageFailureComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marFileLockedFailureComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marFileLockedFailurePartial_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marFileLockedStageFailureComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marFileLockedStageFailurePartial_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marFileInUseSuccessComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marFileInUseSuccessPartial_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marRMRFDirFileInUseSuccessComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marRMRFDirFileInUseSuccessPartial_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marFileInUseStageFailureComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marFileInUseStageFailurePartial_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marRMRFDirFileInUseStageFailureComplete_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marRMRFDirFileInUseStageFailurePartial_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marAppApplyDirLockedStageFailure_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marAppApplyUpdateAppBinInUseStageSuccess_win.js] -skip-if = os != 'win' || debug && (os_version == '5.1' || os_version == '5.2') -reason = Windows only test and bug 1291985 -[marAppApplyUpdateSuccess.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marAppApplyUpdateStageSuccess.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 -[marAppApplyUpdateStageOldVersionFailure.js] -skip-if = os == 'win' && debug && (os_version == '5.1' || os_version == '5.2') -reason = bug 1291985 |