summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:55:19 +0200
commiteb70e6e3d0bff11c25f14b1196025791bf2308fb (patch)
tree5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js
parent32ead795290b3399d56b4708fc75b77d296f6a1a (diff)
downloadUXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js')
-rw-r--r--toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js124
1 files changed, 0 insertions, 124 deletions
diff --git a/toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js b/toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js
deleted file mode 100644
index 3ce0e6ad7..000000000
--- a/toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* 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/. */
-
-// Since PlacesBackups.getbackupFiles() is a lazy getter, these tests must
-// run in the given order, to avoid making it out-of-sync.
-
-add_task(function* check_max_backups_is_respected() {
- // Get bookmarkBackups directory
- let backupFolder = yield PlacesBackups.getBackupFolder();
-
- // Create 2 json dummy backups in the past.
- let oldJsonPath = OS.Path.join(backupFolder, "bookmarks-2008-01-01.json");
- let oldJsonFile = yield OS.File.open(oldJsonPath, { truncate: true });
- oldJsonFile.close();
- do_check_true(yield OS.File.exists(oldJsonPath));
-
- let jsonPath = OS.Path.join(backupFolder, "bookmarks-2008-01-31.json");
- let jsonFile = yield OS.File.open(jsonPath, { truncate: true });
- jsonFile.close();
- do_check_true(yield OS.File.exists(jsonPath));
-
- // Export bookmarks to JSON.
- // Allow 2 backups, the older one should be removed.
- yield PlacesBackups.create(2);
-
- let count = 0;
- let lastBackupPath = null;
- let iterator = new OS.File.DirectoryIterator(backupFolder);
- try {
- yield iterator.forEach(aEntry => {
- count++;
- if (PlacesBackups.filenamesRegex.test(aEntry.name))
- lastBackupPath = aEntry.path;
- });
- } finally {
- iterator.close();
- }
-
- do_check_eq(count, 2);
- do_check_neq(lastBackupPath, null);
- do_check_false(yield OS.File.exists(oldJsonPath));
- do_check_true(yield OS.File.exists(jsonPath));
-});
-
-add_task(function* check_max_backups_greater_than_backups() {
- // Get bookmarkBackups directory
- let backupFolder = yield PlacesBackups.getBackupFolder();
-
- // Export bookmarks to JSON.
- // Allow 3 backups, none should be removed.
- yield PlacesBackups.create(3);
-
- let count = 0;
- let lastBackupPath = null;
- let iterator = new OS.File.DirectoryIterator(backupFolder);
- try {
- yield iterator.forEach(aEntry => {
- count++;
- if (PlacesBackups.filenamesRegex.test(aEntry.name))
- lastBackupPath = aEntry.path;
- });
- } finally {
- iterator.close();
- }
- do_check_eq(count, 2);
- do_check_neq(lastBackupPath, null);
-});
-
-add_task(function* check_max_backups_null() {
- // Get bookmarkBackups directory
- let backupFolder = yield PlacesBackups.getBackupFolder();
-
- // Export bookmarks to JSON.
- // Allow infinite backups, none should be removed, a new one is not created
- // since one for today already exists.
- yield PlacesBackups.create(null);
-
- let count = 0;
- let lastBackupPath = null;
- let iterator = new OS.File.DirectoryIterator(backupFolder);
- try {
- yield iterator.forEach(aEntry => {
- count++;
- if (PlacesBackups.filenamesRegex.test(aEntry.name))
- lastBackupPath = aEntry.path;
- });
- } finally {
- iterator.close();
- }
- do_check_eq(count, 2);
- do_check_neq(lastBackupPath, null);
-});
-
-add_task(function* check_max_backups_undefined() {
- // Get bookmarkBackups directory
- let backupFolder = yield PlacesBackups.getBackupFolder();
-
- // Export bookmarks to JSON.
- // Allow infinite backups, none should be removed, a new one is not created
- // since one for today already exists.
- yield PlacesBackups.create();
-
- let count = 0;
- let lastBackupPath = null;
- let iterator = new OS.File.DirectoryIterator(backupFolder);
- try {
- yield iterator.forEach(aEntry => {
- count++;
- if (PlacesBackups.filenamesRegex.test(aEntry.name))
- lastBackupPath = aEntry.path;
- });
- } finally {
- iterator.close();
- }
- do_check_eq(count, 2);
- do_check_neq(lastBackupPath, null);
-});
-
-function run_test() {
- run_next_test();
-}