summaryrefslogtreecommitdiffstats
path: root/browser/components/backup/tests/xpcshell/test_BrowserResource.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /browser/components/backup/tests/xpcshell/test_BrowserResource.js
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/backup/tests/xpcshell/test_BrowserResource.js')
-rw-r--r--browser/components/backup/tests/xpcshell/test_BrowserResource.js63
1 files changed, 0 insertions, 63 deletions
diff --git a/browser/components/backup/tests/xpcshell/test_BrowserResource.js b/browser/components/backup/tests/xpcshell/test_BrowserResource.js
deleted file mode 100644
index 23c8e077a5..0000000000
--- a/browser/components/backup/tests/xpcshell/test_BrowserResource.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const { BackupResource } = ChromeUtils.importESModule(
- "resource:///modules/backup/BackupResource.sys.mjs"
-);
-
-const EXPECTED_KILOBYTES_FOR_XULSTORE = 1;
-
-add_setup(() => {
- do_get_profile();
-});
-
-/**
- * Tests that BackupService.getFileSize will get the size of a file in kilobytes.
- */
-add_task(async function test_getFileSize() {
- let file = do_get_file("data/test_xulstore.json");
-
- let testFilePath = PathUtils.join(PathUtils.profileDir, "test_xulstore.json");
-
- await IOUtils.copy(file.path, PathUtils.profileDir);
-
- let size = await BackupResource.getFileSize(testFilePath);
-
- Assert.equal(
- size,
- EXPECTED_KILOBYTES_FOR_XULSTORE,
- "Size of the test_xulstore.json is rounded up to the nearest kilobyte."
- );
-
- await IOUtils.remove(testFilePath);
-});
-
-/**
- * Tests that BackupService.getFileSize will get the total size of all the files in a directory and it's children in kilobytes.
- */
-add_task(async function test_getDirectorySize() {
- let file = do_get_file("data/test_xulstore.json");
-
- // Create a test directory with the test json file in it.
- let testDir = PathUtils.join(PathUtils.profileDir, "testDir");
- await IOUtils.makeDirectory(testDir);
- await IOUtils.copy(file.path, testDir);
-
- // Create another test directory inside of that one.
- let nestedTestDir = PathUtils.join(testDir, "testDir");
- await IOUtils.makeDirectory(nestedTestDir);
- await IOUtils.copy(file.path, nestedTestDir);
-
- let size = await BackupResource.getDirectorySize(testDir);
-
- Assert.equal(
- size,
- EXPECTED_KILOBYTES_FOR_XULSTORE * 2,
- `Total size of the directory is rounded up to the nearest kilobyte
- and is equal to twice the size of the test_xulstore.json file`
- );
-
- await IOUtils.remove(testDir, { recursive: true });
-});