/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. /* General Update Directory Cleanup Tests - Bug 539717 */
  5. function run_test() {
  6. do_test_pending();
  7. do_register_cleanup(end_test);
  8. removeUpdateDirsAndFiles();
  9. setUpdateChannel();
  10. writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
  11. var patches = getLocalPatchString(null, null, null, null, null, null,
  12. STATE_DOWNLOADING);
  13. var updates = getLocalUpdateString(patches);
  14. writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
  15. writeStatusFile(STATE_NONE);
  16. standardInit();
  17. var dir = getUpdatesDir();
  18. dir.append("0");
  19. logTestInfo("testing " + dir.path + " should exist");
  20. do_check_true(dir.exists());
  21. var statusFile = dir.clone();
  22. statusFile.append(FILE_UPDATE_STATUS);
  23. logTestInfo("testing " + statusFile.path + " should not exist");
  24. do_check_false(statusFile.exists());
  25. do_check_eq(gUpdateManager.activeUpdate, null);
  26. do_check_eq(gUpdateManager.updateCount, 0);
  27. do_test_finished();
  28. }
  29. function end_test() {
  30. cleanUp();
  31. }