michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: /* File locked complete MAR file patch apply failure test */ michael@0: michael@0: function run_test() { michael@0: setupTestCommon(); michael@0: gTestFiles = gTestFilesCompleteSuccess; michael@0: gTestDirs = gTestDirsCompleteSuccess; michael@0: setTestFilesAndDirsForFailure(); michael@0: setupUpdaterTest(FILE_COMPLETE_MAR, false, false); michael@0: michael@0: // Exclusively lock an existing file so it is in use during the update. michael@0: let helperBin = getTestDirFile(FILE_HELPER_BIN); michael@0: let helperDestDir = getApplyDirFile("a/b/"); michael@0: helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); michael@0: helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); michael@0: // Strip off the first two directories so the path has to be from the helper's michael@0: // working directory. michael@0: let lockFileRelPath = gTestFiles[3].relPathDir.split("/"); michael@0: lockFileRelPath = lockFileRelPath.slice(2); michael@0: lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName; michael@0: let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", michael@0: HELPER_SLEEP_TIMEOUT, lockFileRelPath]; michael@0: let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"]. michael@0: createInstance(AUS_Ci.nsIProcess); michael@0: lockFileProcess.init(helperBin); michael@0: lockFileProcess.run(false, args, args.length); michael@0: michael@0: do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep); michael@0: } michael@0: michael@0: function doUpdate() { michael@0: runUpdate(1, STATE_FAILED_WRITE_ERROR); michael@0: } michael@0: michael@0: function checkUpdateApplied() { michael@0: setupHelperFinish(); michael@0: } michael@0: michael@0: function checkUpdate() { michael@0: checkFilesAfterUpdateFailure(); michael@0: checkUpdateLogContains(ERR_RENAME_FILE); michael@0: checkCallbackAppLog(); michael@0: }