|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 */ |
|
5 |
|
6 function run_test() { |
|
7 setupTestCommon(); |
|
8 |
|
9 logTestInfo("testing that the update.log is moved after a successful update"); |
|
10 |
|
11 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); |
|
12 var patches = getLocalPatchString(null, null, null, null, null, null, |
|
13 STATE_PENDING); |
|
14 var updates = getLocalUpdateString(patches); |
|
15 writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); |
|
16 writeStatusFile(STATE_SUCCEEDED); |
|
17 |
|
18 var dir = getUpdatesDir(); |
|
19 var log = dir.clone(); |
|
20 log.append("0"); |
|
21 log.append(FILE_UPDATE_LOG); |
|
22 writeFile(log, "Last Update Log"); |
|
23 |
|
24 standardInit(); |
|
25 |
|
26 logTestInfo("testing " + log.path + " shouldn't exist"); |
|
27 do_check_false(log.exists()); |
|
28 |
|
29 log = dir.clone(); |
|
30 log.append(FILE_LAST_LOG); |
|
31 logTestInfo("testing " + log.path + " should exist"); |
|
32 do_check_true(log.exists()); |
|
33 |
|
34 logTestInfo("testing " + log.path + " contents"); |
|
35 do_check_eq(readFile(log), "Last Update Log"); |
|
36 |
|
37 log = dir.clone(); |
|
38 log.append(FILE_BACKUP_LOG); |
|
39 logTestInfo("testing " + log.path + " shouldn't exist"); |
|
40 do_check_false(log.exists()); |
|
41 |
|
42 dir.append("0"); |
|
43 logTestInfo("testing " + dir.path + " should exist (bug 512994)"); |
|
44 do_check_true(dir.exists()); |
|
45 |
|
46 doTestFinish(); |
|
47 } |