tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_console_shouldLog.js (973B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 add_task(async function test_shouldLog_maxLogLevel() {
      5  let ci = console.createInstance({ maxLogLevel: "Warn" });
      6 
      7  Assert.ok(
      8    ci.shouldLog("Error"),
      9    "Should return true for logging a higher level"
     10  );
     11  Assert.ok(
     12    ci.shouldLog("Warn"),
     13    "Should return true for logging the same level"
     14  );
     15  Assert.ok(
     16    !ci.shouldLog("Debug"),
     17    "Should return false for logging a lower level;"
     18  );
     19 });
     20 
     21 add_task(async function test_shouldLog_maxLogLevelPref() {
     22  Services.prefs.setStringPref("test.log", "Warn");
     23  let ci = console.createInstance({ maxLogLevelPref: "test.log" });
     24 
     25  Assert.ok(
     26    !ci.shouldLog("Debug"),
     27    "Should return false for logging a lower level;"
     28  );
     29 
     30  Services.prefs.setStringPref("test.log", "Debug");
     31  Assert.ok(
     32    ci.shouldLog("Debug"),
     33    "Should return true for logging a lower level after pref update"
     34  );
     35 });