From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../browser_dbg_variables-view-popup-17.js | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js new file mode 100644 index 000000000..bdfe1a42b --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js @@ -0,0 +1,80 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests opening the variable inspection popup while stopped at a debugger statement, + * clicking "step in" and verifying that the popup is gone. + */ + +const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; + +let gTab, gPanel, gDebugger; +let actions, gSources, gVariables; + +function test() { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { + gTab = aTab; + gPanel = aPanel; + gDebugger = gPanel.panelWin; + actions = bindActionCreators(gPanel); + gSources = gDebugger.DebuggerView.Sources; + gVariables = gDebugger.DebuggerView.Variables; + let bubble = gDebugger.DebuggerView.VariableBubble; + let tooltip = bubble._tooltip.panel; + let testPopupHiding = Task.async(function* () { + yield addBreakpoint(); + yield ensureThreadClientState(gPanel, "resumed"); + yield pauseDebuggee(); + yield openVarPopup(gPanel, { line: 20, ch: 17 }); + is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1, + "The popup should be open with a simple text entry"); + // Now we're stopped at a breakpoint with an open popup + // we'll send a keypress and check if the popup closes + executeSoon(() => EventUtils.synthesizeKey("VK_F11", {})); + // The keypress should cause one resumed event and one paused event + yield waitForThreadEvents(gPanel, "resumed"); + yield waitForThreadEvents(gPanel, "paused"); + // Here's the state we're actually interested in checking.. + checkVariablePopupClosed(bubble); + yield resumeDebuggerThenCloseAndFinish(gPanel); + }); + testPopupHiding(); + }); +} + +function addBreakpoint() { + return actions.addBreakpoint({ actor: gSources.selectedValue, line: 21 }); +} + +function pauseDebuggee() { + generateMouseClickInTab(gTab, "content.document.querySelector('button')"); + + // The first 'with' scope should be expanded by default, but the + // variables haven't been fetched yet. This is how 'with' scopes work. + return promise.all([ + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) + ]); +} + +function checkVariablePopupClosed(bubble) { + ok(!bubble.contentsShown(), + "When stepping, popup should close and be hidden."); + ok(bubble._tooltip.isEmpty(), + "The variable inspection popup should now be empty."); + ok(!bubble._markedText, + "The marked text in the editor was removed."); +} + +registerCleanupFunction(function () { + gTab = null; + gPanel = null; + gDebugger = null; + actions = null; + gSources = null; + gVariables = null; +}); -- cgit v1.2.3