summaryrefslogtreecommitdiffstats
path: root/toolkit/modules/tests/xpcshell/test_ProfileAge.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /toolkit/modules/tests/xpcshell/test_ProfileAge.js
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz
firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/tests/xpcshell/test_ProfileAge.js')
-rw-r--r--toolkit/modules/tests/xpcshell/test_ProfileAge.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/toolkit/modules/tests/xpcshell/test_ProfileAge.js b/toolkit/modules/tests/xpcshell/test_ProfileAge.js
index 9a659a5894..e717b0dcd0 100644
--- a/toolkit/modules/tests/xpcshell/test_ProfileAge.js
+++ b/toolkit/modules/tests/xpcshell/test_ProfileAge.js
@@ -38,6 +38,7 @@ add_task(
withDummyProfile(async profile => {
const CREATED_TIME = Date.now() - 2000;
const RESET_TIME = Date.now() - 1000;
+ const RECOVERY_TIME = Date.now() - 500;
await IOUtils.writeJSON(PathUtils.join(profile, "times.json"), {
created: CREATED_TIME,
@@ -66,12 +67,21 @@ add_task(
);
await promise;
+ let recoveryPromise = times.recordRecoveredFromBackup(RECOVERY_TIME);
+ Assert.equal(
+ await times2.recoveredFromBackup,
+ RECOVERY_TIME,
+ "Should have seen the right backup recovery time in the second instance immediately."
+ );
+ await recoveryPromise;
+
let results = await IOUtils.readJSON(PathUtils.join(profile, "times.json"));
Assert.deepEqual(
results,
{
created: CREATED_TIME,
reset: RESET_TIME,
+ recoveredFromBackup: RECOVERY_TIME,
},
"Should have seen the right results."
);
@@ -118,3 +128,24 @@ add_task(
);
})
);
+
+add_task(
+ withDummyProfile(async profile => {
+ const RECOVERY_TIME = Date.now() - 1000;
+ const RECOVERY_TIME2 = Date.now() - 2000;
+
+ // The last call to recordRecoveredFromBackup should always win.
+ let times = await ProfileAge(profile);
+ await Promise.all([
+ times.recordRecoveredFromBackup(RECOVERY_TIME),
+ times.recordRecoveredFromBackup(RECOVERY_TIME2),
+ ]);
+
+ let results = await IOUtils.readJSON(PathUtils.join(profile, "times.json"));
+ Assert.equal(
+ results.recoveredFromBackup,
+ RECOVERY_TIME2,
+ "Should have seen the right results."
+ );
+ })
+);