browser/devtools/debugger/test/browser_dbg_location-changes-01-simple.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_location-changes-01-simple.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     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 + * Make sure that changing the tab location URL works.
     1.9 + */
    1.10 +
    1.11 +const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
    1.12 +
    1.13 +let gTab, gDebuggee, gPanel, gDebugger;
    1.14 +let gEditor, gSources, gFrames;
    1.15 +
    1.16 +function test() {
    1.17 +  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    1.18 +    gTab = aTab;
    1.19 +    gDebuggee = aDebuggee;
    1.20 +    gPanel = aPanel;
    1.21 +    gDebugger = gPanel.panelWin;
    1.22 +    gEditor = gDebugger.DebuggerView.editor;
    1.23 +    gSources = gDebugger.DebuggerView.Sources;
    1.24 +    gFrames = gDebugger.DebuggerView.StackFrames;
    1.25 +
    1.26 +    waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest);
    1.27 +    gDebuggee.simpleCall();
    1.28 +  });
    1.29 +}
    1.30 +
    1.31 +function performTest() {
    1.32 +  is(gDebugger.gThreadClient.state, "paused",
    1.33 +    "Should only be getting stack frames while paused.");
    1.34 +
    1.35 +  is(gFrames.itemCount, 1,
    1.36 +    "Should have only one frame.");
    1.37 +
    1.38 +  is(gSources.itemCount, 1,
    1.39 +    "Found the expected number of entries in the sources widget.");
    1.40 +
    1.41 +  isnot(gSources.selectedValue, null,
    1.42 +    "There should be a selected source value.");
    1.43 +  isnot(gEditor.getText().length, 0,
    1.44 +    "The source editor should have some text displayed.");
    1.45 +  isnot(gEditor.getText(), gDebugger.L10N.getStr("loadingText"),
    1.46 +    "The source editor text should not be 'Loading...'");
    1.47 +
    1.48 +  is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice-container").length, 0,
    1.49 +    "The sources widget should not display any notice at this point (1).");
    1.50 +  is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice").length, 0,
    1.51 +    "The sources widget should not display any notice at this point (2).");
    1.52 +  is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-notice > label"), null,
    1.53 +    "The sources widget should not display a notice at this point (3).");
    1.54 +
    1.55 +  gDebugger.gThreadClient.resume(() => {
    1.56 +    testLocationChange();
    1.57 +  });
    1.58 +}
    1.59 +
    1.60 +function testLocationChange() {
    1.61 +  navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => {
    1.62 +    closeDebuggerAndFinish(gPanel);
    1.63 +  });
    1.64 +}
    1.65 +
    1.66 +registerCleanupFunction(function() {
    1.67 +  gTab = null;
    1.68 +  gDebuggee = null;
    1.69 +  gPanel = null;
    1.70 +  gDebugger = null;
    1.71 +  gEditor = null;
    1.72 +  gSources = null;
    1.73 +  gFrames = null;
    1.74 +});

mercurial