browser/devtools/debugger/test/browser_dbg_variables-view-popup-12.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.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests that the clicking "Watch" button twice, for the same expression, only adds it
michael@0 6 * once.
michael@0 7 */
michael@0 8
michael@0 9 const TAB_URL = EXAMPLE_URL + "doc_watch-expression-button.html";
michael@0 10
michael@0 11 function test() {
michael@0 12 Task.spawn(function() {
michael@0 13 let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
michael@0 14 let win = panel.panelWin;
michael@0 15 let events = win.EVENTS;
michael@0 16 let watch = win.DebuggerView.WatchExpressions;
michael@0 17 let bubble = win.DebuggerView.VariableBubble;
michael@0 18 let tooltip = bubble._tooltip.panel;
michael@0 19
michael@0 20 function verifyContent(aExpression, aItemCount) {
michael@0 21
michael@0 22 ok(watch.getItemAtIndex(0),
michael@0 23 "The expression at index 0 should be available.");
michael@0 24 is(watch.getItemAtIndex(0).attachment.initialExpression, aExpression,
michael@0 25 "The expression at index 0 is correct.");
michael@0 26 is(watch.itemCount, aItemCount,
michael@0 27 "The expression count is correct.");
michael@0 28 }
michael@0 29
michael@0 30 // Allow this generator function to yield first.
michael@0 31 executeSoon(() => debuggee.start());
michael@0 32 yield waitForSourceAndCaretAndScopes(panel, ".html", 19);
michael@0 33
michael@0 34 // Inspect primitive value variable.
michael@0 35 yield openVarPopup(panel, { line: 15, ch: 12 });
michael@0 36 let popupHiding = once(tooltip, "popuphiding");
michael@0 37 let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
michael@0 38 tooltip.querySelector("button").click();
michael@0 39 verifyContent("a", 1);
michael@0 40 yield promise.all([popupHiding, expressionsEvaluated]);
michael@0 41 ok(true, "The new watch expressions were re-evaluated and the panel got hidden (1).");
michael@0 42
michael@0 43 // Inspect property of an object.
michael@0 44 let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
michael@0 45 yield openVarPopup(panel, { line: 17, ch: 10 });
michael@0 46 yield expressionsEvaluated;
michael@0 47 ok(true, "The watch expressions were re-evaluated when a new panel opened (1).");
michael@0 48
michael@0 49 let popupHiding = once(tooltip, "popuphiding");
michael@0 50 let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
michael@0 51 tooltip.querySelector("button").click();
michael@0 52 verifyContent("b.a", 2);
michael@0 53 yield promise.all([popupHiding, expressionsEvaluated]);
michael@0 54 ok(true, "The new watch expressions were re-evaluated and the panel got hidden (2).");
michael@0 55
michael@0 56 // Re-inspect primitive value variable.
michael@0 57 let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
michael@0 58 yield openVarPopup(panel, { line: 15, ch: 12 });
michael@0 59 yield expressionsEvaluated;
michael@0 60 ok(true, "The watch expressions were re-evaluated when a new panel opened (2).");
michael@0 61
michael@0 62 let popupHiding = once(tooltip, "popuphiding");
michael@0 63 let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
michael@0 64 tooltip.querySelector("button").click();
michael@0 65 verifyContent("b.a", 2);
michael@0 66 yield promise.all([popupHiding, expressionsEvaluated]);
michael@0 67 ok(true, "The new watch expressions were re-evaluated and the panel got hidden (3).");
michael@0 68
michael@0 69 yield resumeDebuggerThenCloseAndFinish(panel);
michael@0 70 });
michael@0 71 }

mercurial