Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | /* General Complete MAR File Patch Apply Test */ |
michael@0 | 7 | |
michael@0 | 8 | function run_test() { |
michael@0 | 9 | if (!shouldRunServiceTest()) { |
michael@0 | 10 | return; |
michael@0 | 11 | } |
michael@0 | 12 | |
michael@0 | 13 | setupTestCommon(); |
michael@0 | 14 | gTestFiles = gTestFilesCompleteSuccess; |
michael@0 | 15 | gTestDirs = gTestDirsCompleteSuccess; |
michael@0 | 16 | setupUpdaterTest(FILE_COMPLETE_MAR, false, false); |
michael@0 | 17 | |
michael@0 | 18 | // For Mac OS X set the last modified time for the root directory to a date in |
michael@0 | 19 | // the past to test that the last modified time is updated on a successful |
michael@0 | 20 | // update (bug 600098). |
michael@0 | 21 | if (IS_MACOSX) { |
michael@0 | 22 | let now = Date.now(); |
michael@0 | 23 | let yesterday = now - (1000 * 60 * 60 * 24); |
michael@0 | 24 | let applyToDir = getApplyDirFile(); |
michael@0 | 25 | applyToDir.lastModifiedTime = yesterday; |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | setupAppFilesAsync(); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | function setupAppFilesFinished() { |
michael@0 | 32 | runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | function checkUpdateFinished() { |
michael@0 | 36 | if (IS_MACOSX) { |
michael@0 | 37 | logTestInfo("testing last modified time on the apply to directory has " + |
michael@0 | 38 | "changed after a successful update (bug 600098)"); |
michael@0 | 39 | let now = Date.now(); |
michael@0 | 40 | let applyToDir = getApplyDirFile(); |
michael@0 | 41 | let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); |
michael@0 | 42 | do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | checkFilesAfterUpdateSuccess(); |
michael@0 | 46 | // Sorting on Linux is different so skip this check for now. |
michael@0 | 47 | if (!IS_UNIX) { |
michael@0 | 48 | checkUpdateLogContents(LOG_COMPLETE_SUCCESS); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | checkCallbackServiceLog(); |
michael@0 | 52 | } |