summaryrefslogtreecommitdiffstats
path: root/browser/components/migration/tests/unit/test_ChromeMigrationUtils_path_chromium_snap.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /browser/components/migration/tests/unit/test_ChromeMigrationUtils_path_chromium_snap.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/migration/tests/unit/test_ChromeMigrationUtils_path_chromium_snap.js')
-rw-r--r--browser/components/migration/tests/unit/test_ChromeMigrationUtils_path_chromium_snap.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/browser/components/migration/tests/unit/test_ChromeMigrationUtils_path_chromium_snap.js b/browser/components/migration/tests/unit/test_ChromeMigrationUtils_path_chromium_snap.js
new file mode 100644
index 0000000000..5011991536
--- /dev/null
+++ b/browser/components/migration/tests/unit/test_ChromeMigrationUtils_path_chromium_snap.js
@@ -0,0 +1,55 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const { ChromeMigrationUtils } = ChromeUtils.importESModule(
+ "resource:///modules/ChromeMigrationUtils.sys.mjs"
+);
+
+const SUB_DIRECTORIES = {
+ linux: {
+ Chromium: [".config", "chromium"],
+ SnapChromium: ["snap", "chromium", "common", "chromium"],
+ },
+};
+
+add_task(async function setup_fakePaths() {
+ let pathId;
+ if (AppConstants.platform == "macosx") {
+ pathId = "ULibDir";
+ } else if (AppConstants.platform == "win") {
+ pathId = "LocalAppData";
+ } else {
+ pathId = "Home";
+ }
+
+ registerFakePath(pathId, do_get_file("chromefiles/", true));
+});
+
+add_task(async function test_getDataPath_function() {
+ let rootPath = getRootPath();
+ let chromiumSubFolders = SUB_DIRECTORIES[AppConstants.platform].Chromium;
+ // must remove normal chromium path
+ await IOUtils.remove(PathUtils.join(rootPath, ...chromiumSubFolders), {
+ ignoreAbsent: true,
+ });
+
+ let snapChromiumSubFolders =
+ SUB_DIRECTORIES[AppConstants.platform].SnapChromium;
+ // must create snap chromium path
+ await IOUtils.makeDirectory(
+ PathUtils.join(rootPath, ...snapChromiumSubFolders),
+ {
+ createAncestor: true,
+ ignoreExisting: true,
+ }
+ );
+
+ let chromiumUserDataPath = await ChromeMigrationUtils.getDataPath("Chromium");
+ Assert.equal(
+ chromiumUserDataPath,
+ PathUtils.join(getRootPath(), ...snapChromiumSubFolders),
+ "Should get the path of Snap Chromium data directory."
+ );
+});