summaryrefslogtreecommitdiffstats
path: root/toolkit/modules/tests/xpcshell/test_firstStartup.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/modules/tests/xpcshell/test_firstStartup.js
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/tests/xpcshell/test_firstStartup.js')
-rw-r--r--toolkit/modules/tests/xpcshell/test_firstStartup.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/toolkit/modules/tests/xpcshell/test_firstStartup.js b/toolkit/modules/tests/xpcshell/test_firstStartup.js
new file mode 100644
index 0000000000..73570ae37e
--- /dev/null
+++ b/toolkit/modules/tests/xpcshell/test_firstStartup.js
@@ -0,0 +1,35 @@
+"use strict";
+
+const { AppConstants } = ChromeUtils.importESModule(
+ "resource://gre/modules/AppConstants.sys.mjs"
+);
+const { FirstStartup } = ChromeUtils.importESModule(
+ "resource://gre/modules/FirstStartup.sys.mjs"
+);
+const { updateAppInfo } = ChromeUtils.importESModule(
+ "resource://testing-common/AppInfo.sys.mjs"
+);
+
+const PREF_TIMEOUT = "first-startup.timeout";
+
+add_task(async function test_success() {
+ updateAppInfo();
+ FirstStartup.init();
+ if (AppConstants.MOZ_NORMANDY || AppConstants.MOZ_UPDATE_AGENT) {
+ equal(FirstStartup.state, FirstStartup.SUCCESS);
+ } else {
+ equal(FirstStartup.state, FirstStartup.UNSUPPORTED);
+ }
+});
+
+add_task(async function test_timeout() {
+ updateAppInfo();
+ Services.prefs.setIntPref(PREF_TIMEOUT, 0);
+ FirstStartup.init();
+
+ if (AppConstants.MOZ_NORMANDY || AppConstants.MOZ_UPDATE_AGENT) {
+ equal(FirstStartup.state, FirstStartup.TIMED_OUT);
+ } else {
+ equal(FirstStartup.state, FirstStartup.UNSUPPORTED);
+ }
+});