diff options
Diffstat (limited to 'toolkit/components/places/tests/maintenance/test_corrupt_telemetry.js')
-rw-r--r-- | toolkit/components/places/tests/maintenance/test_corrupt_telemetry.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/toolkit/components/places/tests/maintenance/test_corrupt_telemetry.js b/toolkit/components/places/tests/maintenance/test_corrupt_telemetry.js new file mode 100644 index 0000000000..d6659267da --- /dev/null +++ b/toolkit/components/places/tests/maintenance/test_corrupt_telemetry.js @@ -0,0 +1,24 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that history initialization correctly handles a request to forcibly +// replace the current database. + +add_task(async function () { + await createCorruptDb("places.sqlite"); + + let count = Services.telemetry + .getHistogramById("PLACES_DATABASE_CORRUPTION_HANDLING_STAGE") + .snapshot().values[3]; + Assert.equal(count, undefined, "There should be no telemetry"); + + Assert.equal( + PlacesUtils.history.databaseStatus, + PlacesUtils.history.DATABASE_STATUS_CORRUPT + ); + + count = Services.telemetry + .getHistogramById("PLACES_DATABASE_CORRUPTION_HANDLING_STAGE") + .snapshot().values[3]; + Assert.equal(count, 1, "Telemetry should have been added"); +}); |