toolkit/components/startup/tests/browser/browser_crash_detection.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/startup/tests/browser/browser_crash_detection.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + *    http://creativecommons.org/publicdomain/zero/1.0/
     1.6 + */
     1.7 +
     1.8 +function test() {
     1.9 +  function checkLastSuccess() {
    1.10 +    let lastSuccess = Services.prefs.getIntPref("toolkit.startup.last_success");
    1.11 +    let si = Services.startup.getStartupInfo();
    1.12 +    is(lastSuccess, parseInt(si["main"].getTime() / 1000, 10),
    1.13 +       "Startup tracking pref should be set after a delay at the end of startup");
    1.14 +    finish();
    1.15 +  }
    1.16 +
    1.17 +  if (Services.prefs.getPrefType("toolkit.startup.max_resumed_crashes") == Services.prefs.PREF_INVALID) {
    1.18 +    info("Skipping this test since startup crash detection is disabled");
    1.19 +    return;
    1.20 +  }
    1.21 +
    1.22 +  const startupCrashEndDelay = 35 * 1000;
    1.23 +  waitForExplicitFinish();
    1.24 +  requestLongerTimeout(2);
    1.25 +  setTimeout(checkLastSuccess, startupCrashEndDelay);
    1.26 +}

mercurial