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/telemetry/tests/unit/test_TelemetryLockCount.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/telemetry/tests/unit/test_TelemetryLockCount.js')
-rw-r--r-- | toolkit/components/telemetry/tests/unit/test_TelemetryLockCount.js | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryLockCount.js b/toolkit/components/telemetry/tests/unit/test_TelemetryLockCount.js deleted file mode 100644 index 808f2f3ec..000000000 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryLockCount.js +++ /dev/null @@ -1,53 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ -*/ -/* A testcase to make sure reading the failed profile lock count works. */ - -Cu.import("resource://gre/modules/Services.jsm", this); - -const LOCK_FILE_NAME = "Telemetry.FailedProfileLocks.txt"; -const N_FAILED_LOCKS = 10; - -// Constants from prio.h for nsIFileOutputStream.init -const PR_WRONLY = 0x2; -const PR_CREATE_FILE = 0x8; -const PR_TRUNCATE = 0x20; -const RW_OWNER = parseInt("0600", 8); - -function write_string_to_file(file, contents) { - let ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"] - .createInstance(Ci.nsIFileOutputStream); - ostream.init(file, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, - RW_OWNER, ostream.DEFER_OPEN); - ostream.write(contents, contents.length); - ostream.QueryInterface(Ci.nsISafeOutputStream).finish(); - ostream.close(); -} - -function construct_file() { - let profileDirectory = Services.dirsvc.get("ProfD", Ci.nsIFile); - let file = profileDirectory.clone(); - file.append(LOCK_FILE_NAME); - return file; -} - -function run_test() { - do_get_profile(); - - do_check_eq(Telemetry.failedProfileLockCount, 0); - - write_string_to_file(construct_file(), N_FAILED_LOCKS.toString()); - - // Make sure that we're not eagerly reading the count now that the - // file exists. - do_check_eq(Telemetry.failedProfileLockCount, 0); - - do_test_pending(); - Telemetry.asyncFetchTelemetryData(actual_test); -} - -function actual_test() { - do_check_eq(Telemetry.failedProfileLockCount, N_FAILED_LOCKS); - do_check_false(construct_file().exists()); - do_test_finished(); -} |