Bug 1045421 - Remove date time bomb from test_crash_manager.js, add logging; r=gfritzsche

There was a hard-coded date in test_crash_manager.js of around August 3,
2013. This meant that about a year later we would start to run into
boundary issues since we weren't wrapping Date.now() inside
CrashManager.jsm.

It turns out the actual value of DUMMY_DATE doesn't really matter. So,
the test has been changed to produce a value that is reasonably modern.

While I was debugging this, I noticed we're not getting logging in the
tests. So I added that.

--HG--
extra : rebase_source : 4e5534f5df70b01268790396481bdd3236dd8e8e
extra : amend_source : d73ea0a333fa9b0b9c65d890d6f34cb923861acd
This commit is contained in:
Gregory Szorc 2014-07-29 09:47:59 -07:00
parent 322cce646f
commit 30f5396657
3 changed files with 20 additions and 2 deletions

View File

@ -12,17 +12,34 @@
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
this.EXPORTED_SYMBOLS = [
"configureLogging",
"getManager",
"sleep",
"TestingCrashManager",
];
Cu.import("resource://gre/modules/CrashManager.jsm", this);
Cu.import("resource://gre/modules/Log.jsm", this);
Cu.import("resource://gre/modules/osfile.jsm", this);
Cu.import("resource://gre/modules/Promise.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/Timer.jsm", this);
let loggingConfigured = false;
this.configureLogging = function () {
if (loggingConfigured) {
return;
}
let log = Log.repository.getLogger("Crashes.CrashManager");
log.level = Log.Level.All;
let appender = new Log.DumpAppender();
appender.level = Log.Level.All;
log.addAppender(appender);
loggingConfigured = true;
};
this.sleep = function (wait) {
let deferred = Promise.defer();

View File

@ -12,10 +12,12 @@ Cu.import("resource://gre/modules/osfile.jsm", this);
Cu.import("resource://testing-common/CrashManagerTest.jsm", this);
const DUMMY_DATE = new Date(1391043519000);
const DUMMY_DATE = new Date(Date.now() - 10 * 24 * 60 * 60 * 1000);
DUMMY_DATE.setMilliseconds(0);
function run_test() {
do_get_profile();
configureLogging();
run_next_test();
}

View File

@ -3,6 +3,5 @@ head =
tail =
[test_crash_manager.js]
skip-if = true # Bug 1045421
[test_crash_service.js]
[test_crash_store.js]