gecko/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js
Robert Strong 6bc5c325e9 Test cleanup and tests for Bug 759469 - Add new updater instruction to add a file if it doesn't exist in the destination. r=bbondy
--HG--
rename : toolkit/mozapps/update/tests/unit_base_updater/marDirLockedStageFailure_win.js => toolkit/mozapps/update/tests/unit_base_updater/marAppApplyDirLockedStageFailure_win.js
rename : toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessComplete_win.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_win.js
rename : toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessPartial_win.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_win.js
rename : toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessComplete_win.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js
rename : toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessPartial_win.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js
rename : toolkit/mozapps/update/tests/unit_service_updater/marDirLockedStageFailureSvc_win.js => toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js
rename : toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessCompleteSvc_win.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessPartialSvc_win.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessCompleteSvc_win.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessPartialSvc_win.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js
2014-03-05 11:43:28 -08:00

48 lines
1.7 KiB
JavaScript

/* 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() {
setupTestCommon();
gTestFiles = gTestFilesPartialSuccess;
gTestFiles[11].originalFile = "partial.png";
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR, false, false);
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on all updates since
// the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
// Note that on platforms where we use execv, we cannot trust the return code.
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_UNEXPECTED_FILE_OPERATION_ERROR);
}
function checkUpdateApplied() {
if (IS_MACOSX) {
logTestInfo("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkFilesAfterUpdateFailure();
// Sorting on Linux is different so skip this check for now.
if (!IS_UNIX) {
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
}
checkCallbackAppLog();
}