diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/identity/tests/unit/test_log_utils.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/identity/tests/unit/test_log_utils.js')
-rw-r--r-- | toolkit/identity/tests/unit/test_log_utils.js | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/toolkit/identity/tests/unit/test_log_utils.js b/toolkit/identity/tests/unit/test_log_utils.js new file mode 100644 index 000000000..ac43c297d --- /dev/null +++ b/toolkit/identity/tests/unit/test_log_utils.js @@ -0,0 +1,74 @@ + +"use strict"; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import('resource://gre/modules/Services.jsm'); +Cu.import('resource://gre/modules/identity/LogUtils.jsm'); + +function toggle_debug() { + do_test_pending(); + + function Wrapper() { + this.init(); + } + Wrapper.prototype = { + QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, Ci.nsIObserver]), + + observe: function observe(aSubject, aTopic, aData) { + if (aTopic === "nsPref:changed") { + // race condition? + do_check_eq(Logger._debug, true); + do_test_finished(); + run_next_test(); + } + }, + + init: function() { + Services.prefs.addObserver('toolkit.identity.debug', this, false); + } + }; + + var wrapper = new Wrapper(); + Services.prefs.setBoolPref('toolkit.identity.debug', true); +} + +// test that things don't break + +function logAlias(...args) { + Logger.log.apply(Logger, ["log alias"].concat(args)); +} +function reportErrorAlias(...args) { + Logger.reportError.apply(Logger, ["report error alias"].concat(args)); +} + +function test_log() { + Logger.log("log test", "I like pie"); + do_test_finished(); + run_next_test(); +} + +function test_reportError() { + Logger.reportError("log test", "We are out of pies!!!"); + do_test_finished(); + run_next_test(); +} + +function test_wrappers() { + logAlias("I like potatoes"); + do_test_finished(); + reportErrorAlias("Too much red bull"); +} + +var TESTS = [ +// XXX fix me +// toggle_debug, + test_log, + test_reportError, + test_wrappers, +]; + +TESTS.forEach(add_test); + +function run_test() { + run_next_test(); +} |