browser/devtools/debugger/test/browser_dbg_tracing-06.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/debugger/test/browser_dbg_tracing-06.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     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 + * Test that the tracer doesn't connect to the backend when tracing is disabled.
     1.9 + */
    1.10 +
    1.11 +const TAB_URL = EXAMPLE_URL + "doc_tracing-01.html";
    1.12 +const TRACER_PREF = "devtools.debugger.tracer";
    1.13 +
    1.14 +let gTab, gDebuggee, gPanel, gDebugger;
    1.15 +let gOriginalPref = Services.prefs.getBoolPref(TRACER_PREF);
    1.16 +Services.prefs.setBoolPref(TRACER_PREF, false);
    1.17 +
    1.18 +function test() {
    1.19 +  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    1.20 +    gTab = aTab;
    1.21 +    gDebuggee = aDebuggee;
    1.22 +    gPanel = aPanel;
    1.23 +    gDebugger = gPanel.panelWin;
    1.24 +
    1.25 +    waitForSourceShown(gPanel, "code_tracing-01.js")
    1.26 +      .then(() => {
    1.27 +        ok(!gDebugger.DebuggerController.traceClient, "Should not have a trace client");
    1.28 +        closeDebuggerAndFinish(gPanel);
    1.29 +      })
    1.30 +      .then(null, aError => {
    1.31 +        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
    1.32 +      });
    1.33 +  });
    1.34 +}
    1.35 +
    1.36 +registerCleanupFunction(function() {
    1.37 +  gTab = null;
    1.38 +  gDebuggee = null;
    1.39 +  gPanel = null;
    1.40 +  gDebugger = null;
    1.41 +  Services.prefs.setBoolPref(TRACER_PREF, gOriginalPref);
    1.42 +});

mercurial