diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/osfile/tests/xpcshell/test_telemetry.js | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/osfile/tests/xpcshell/test_telemetry.js')
-rw-r--r-- | toolkit/components/osfile/tests/xpcshell/test_telemetry.js | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/toolkit/components/osfile/tests/xpcshell/test_telemetry.js b/toolkit/components/osfile/tests/xpcshell/test_telemetry.js deleted file mode 100644 index dc5104443..000000000 --- a/toolkit/components/osfile/tests/xpcshell/test_telemetry.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; - -var {OS: {File, Path, Constants}} = Components.utils.import("resource://gre/modules/osfile.jsm", {}); -var {Services} = Components.utils.import("resource://gre/modules/Services.jsm", {}); - -// Ensure that we have a profile but that the OS.File worker is not launched -add_task(function* init() { - do_get_profile(); - yield File.resetWorker(); -}); - -function getCount(histogram) { - if (histogram == null) { - return 0; - } - - let total = 0; - for (let i of histogram.counts) { - total += i; - } - return total; -} - -// Ensure that launching the OS.File worker adds data to the relevant -// histograms -add_task(function* test_startup() { - let LAUNCH = "OSFILE_WORKER_LAUNCH_MS"; - let READY = "OSFILE_WORKER_READY_MS"; - - let before = Services.telemetry.histogramSnapshots; - - // Launch the OS.File worker - yield File.getCurrentDirectory(); - - let after = Services.telemetry.histogramSnapshots; - - - do_print("Ensuring that we have recorded measures for histograms"); - do_check_eq(getCount(after[LAUNCH]), getCount(before[LAUNCH]) + 1); - do_check_eq(getCount(after[READY]), getCount(before[READY]) + 1); - - do_print("Ensuring that launh <= ready"); - do_check_true(after[LAUNCH].sum <= after[READY].sum); -}); - -// Ensure that calling writeAtomic adds data to the relevant histograms -add_task(function* test_writeAtomic() { - let LABEL = "OSFILE_WRITEATOMIC_JANK_MS"; - - let before = Services.telemetry.histogramSnapshots; - - // Perform a write. - let path = Path.join(Constants.Path.profileDir, "test_osfile_telemetry.tmp"); - yield File.writeAtomic(path, LABEL, { tmpPath: path + ".tmp" } ); - - let after = Services.telemetry.histogramSnapshots; - - do_check_eq(getCount(after[LABEL]), getCount(before[LABEL]) + 1); -}); - -function run_test() { - run_next_test(); -} |