summaryrefslogtreecommitdiffstats
path: root/browser/components/tests/unit/test_browserGlue_migration_places_xulstore.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /browser/components/tests/unit/test_browserGlue_migration_places_xulstore.js
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/tests/unit/test_browserGlue_migration_places_xulstore.js')
-rw-r--r--browser/components/tests/unit/test_browserGlue_migration_places_xulstore.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/browser/components/tests/unit/test_browserGlue_migration_places_xulstore.js b/browser/components/tests/unit/test_browserGlue_migration_places_xulstore.js
new file mode 100644
index 0000000000..7e2ae93bfe
--- /dev/null
+++ b/browser/components/tests/unit/test_browserGlue_migration_places_xulstore.js
@@ -0,0 +1,54 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
+const TOPICDATA_BROWSERGLUE_TEST = "force-ui-migration";
+const UI_VERSION = 120;
+
+const { AppConstants } = ChromeUtils.importESModule(
+ "resource://gre/modules/AppConstants.sys.mjs"
+);
+const { PlacesUIUtils } = ChromeUtils.importESModule(
+ "resource:///modules/PlacesUIUtils.sys.mjs"
+);
+
+add_task(async function has_not_used_ctrl_tab_and_its_off() {
+ const gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"].getService(
+ Ci.nsIObserver
+ );
+ registerCleanupFunction(() => {
+ Services.prefs.clearUserPref("browser.migration.version");
+ });
+ Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
+
+ Services.xulStore.setValue(
+ AppConstants.BROWSER_CHROME_URL,
+ "place:test",
+ "open",
+ "true"
+ );
+
+ // Simulate a migration.
+ gBrowserGlue.observe(
+ null,
+ TOPIC_BROWSERGLUE_TEST,
+ TOPICDATA_BROWSERGLUE_TEST
+ );
+
+ Assert.equal(
+ Services.xulStore.getValue(
+ AppConstants.BROWSER_CHROME_URL,
+ PlacesUIUtils.obfuscateUrlForXulStore("place:test"),
+ "open"
+ ),
+ "true"
+ );
+
+ Assert.greater(
+ Services.prefs.getIntPref("browser.migration.version"),
+ UI_VERSION,
+ "Check migration version has been bumped up"
+ );
+});