browser/devtools/debugger/test/browser_dbg_variables-view-popup-11.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests that the watch expression button is added in variable view popup.
     6  */
     8 const TAB_URL = EXAMPLE_URL + "doc_watch-expression-button.html";
    10 function test() {
    11   Task.spawn(function() {
    12     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
    13     let win = panel.panelWin;
    14     let events = win.EVENTS;
    15     let watch = win.DebuggerView.WatchExpressions;
    16     let bubble = win.DebuggerView.VariableBubble;
    17     let tooltip = bubble._tooltip.panel;
    19     let label = win.L10N.getStr("addWatchExpressionButton");
    20     let className = "dbg-expression-button";
    22     function testExpressionButton(aLabel, aClassName, aExpression) {
    23       ok(tooltip.querySelector("button"),
    24         "There should be a button available in variable view popup.");
    25       is(tooltip.querySelector("button").label, aLabel,
    26         "The button available is labeled correctly.");
    27       is(tooltip.querySelector("button").className, aClassName,
    28         "The button available is styled correctly.");
    30       tooltip.querySelector("button").click();
    32       ok(!tooltip.querySelector("button"),
    33         "There should be no button available in variable view popup.");
    34       ok(watch.getItemAtIndex(0),
    35         "The expression at index 0 should be available.");
    36       is(watch.getItemAtIndex(0).attachment.initialExpression, aExpression,
    37         "The expression at index 0 is correct.");
    38     }
    40     // Allow this generator function to yield first.
    41     executeSoon(() => debuggee.start());
    42     yield waitForSourceAndCaretAndScopes(panel, ".html", 19);
    44     // Inspect primitive value variable.
    45     yield openVarPopup(panel, { line: 15, ch: 12 });
    46     let popupHiding = once(tooltip, "popuphiding");
    47     let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
    48     testExpressionButton(label, className, "a");
    49     yield promise.all([popupHiding, expressionsEvaluated]);
    50     ok(true, "The new watch expressions were re-evaluated and the panel got hidden (1).");
    52     // Inspect non primitive value variable.
    53     let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
    54     yield openVarPopup(panel, { line: 16, ch: 12 }, true);
    55     yield expressionsEvaluated;
    56     ok(true, "The watch expressions were re-evaluated when a new panel opened (1).");
    58     let popupHiding = once(tooltip, "popuphiding");
    59     let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
    60     testExpressionButton(label, className, "b");
    61     yield promise.all([popupHiding, expressionsEvaluated]);
    62     ok(true, "The new watch expressions were re-evaluated and the panel got hidden (2).");
    64     // Inspect property of an object.
    65     let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
    66     yield openVarPopup(panel, { line: 17, ch: 10 });
    67     yield expressionsEvaluated;
    68     ok(true, "The watch expressions were re-evaluated when a new panel opened (2).");
    70     let popupHiding = once(tooltip, "popuphiding");
    71     let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
    72     testExpressionButton(label, className, "b.a");
    73     yield promise.all([popupHiding, expressionsEvaluated]);
    74     ok(true, "The new watch expressions were re-evaluated and the panel got hidden (3).");
    76     yield resumeDebuggerThenCloseAndFinish(panel);
    77   });
    78 }

mercurial