Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
2 "use strict";
4 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
5 Cu.import('resource://gre/modules/Services.jsm');
6 Cu.import('resource://gre/modules/identity/LogUtils.jsm');
8 function toggle_debug() {
9 do_test_pending();
11 function Wrapper() {
12 this.init();
13 }
14 Wrapper.prototype = {
15 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, Ci.nsIObserver]),
17 observe: function observe(aSubject, aTopic, aData) {
18 if (aTopic === "nsPref:changed") {
19 // race condition?
20 do_check_eq(Logger._debug, true);
21 do_test_finished();
22 run_next_test();
23 }
24 },
26 init: function() {
27 Services.prefs.addObserver('toolkit.identity.debug', this, false);
28 }
29 };
31 var wrapper = new Wrapper();
32 Services.prefs.setBoolPref('toolkit.identity.debug', true);
33 }
35 // test that things don't break
37 function logAlias(...args) {
38 Logger.log.apply(Logger, ["log alias"].concat(args));
39 }
40 function reportErrorAlias(...args) {
41 Logger.reportError.apply(Logger, ["report error alias"].concat(args));
42 }
44 function test_log() {
45 Logger.log("log test", "I like pie");
46 do_test_finished();
47 run_next_test();
48 }
50 function test_reportError() {
51 Logger.reportError("log test", "We are out of pies!!!");
52 do_test_finished();
53 run_next_test();
54 }
56 function test_wrappers() {
57 logAlias("I like potatoes");
58 do_test_finished();
59 reportErrorAlias("Too much red bull");
60 }
62 let TESTS = [
63 // XXX fix me
64 // toggle_debug,
65 test_log,
66 test_reportError,
67 test_wrappers,
68 ];
70 TESTS.forEach(add_test);
72 function run_test() {
73 run_next_test();
74 }