diff -r 000000000000 -r 6474c204b198 toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,30 @@ +/* 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 (!IS_MAR_CHECKS_ENABLED) { + return; + } + + setupTestCommon(); + // We don't actually care if the MAR has any data, we only care about the + // application return code and update.status result. + gTestFiles = gTestFilesCommon; + gTestDirs = []; + setupUpdaterTest(FILE_OLD_VERSION_MAR, false, false); + + // Apply the MAR + // Note that if execv is used, the updater process will turn into the + // callback process, so its return code will be that of the callback + // app. + runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_VERSION_DOWNGRADE_ERROR); +} + +function checkUpdateApplied() { + checkFilesAfterUpdateSuccess(); + doTestFinish(); +}