summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js')
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js80
1 files changed, 80 insertions, 0 deletions
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;
+});