PageRenderTime 11ms CodeModel.GetById 7ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/toolkit/mozapps/update/test/unit/test_0072_update_dir_cleanup.js

http://github.com/zpao/v8monkey
JavaScript | 41 lines | 27 code | 10 blank | 4 comment | 0 complexity | 7bddcfe341947cafde62ff57a44e476f MD5 | raw file
 1/* Any copyright is dedicated to the Public Domain.
 2 * http://creativecommons.org/publicdomain/zero/1.0/
 3 */
 4
 5/* General Update Directory Cleanup Tests - Bug 539717 */
 6
 7function run_test() {
 8  do_test_pending();
 9  do_register_cleanup(end_test);
10
11  removeUpdateDirsAndFiles();
12  setUpdateChannel();
13
14  writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
15  var patches = getLocalPatchString(null, null, null, null, null, null,
16                                    STATE_DOWNLOADING);
17  var updates = getLocalUpdateString(patches);
18  writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
19  writeStatusFile(STATE_NONE);
20
21  standardInit();
22
23  var dir = getUpdatesDir();
24  dir.append("0");
25  logTestInfo("testing " + dir.path + " should exist");
26  do_check_true(dir.exists());
27
28  var statusFile = dir.clone();
29  statusFile.append(FILE_UPDATE_STATUS);
30  logTestInfo("testing " + statusFile.path + " should not exist");
31  do_check_false(statusFile.exists());
32
33  do_check_eq(gUpdateManager.activeUpdate, null);
34  do_check_eq(gUpdateManager.updateCount, 0);
35
36  do_test_finished();
37}
38
39function end_test() {
40  cleanUp();
41}