summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/new/test/mochitest/browser_dbg-console.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/new/test/mochitest/browser_dbg-console.js')
-rw-r--r--devtools/client/debugger/new/test/mochitest/browser_dbg-console.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-console.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-console.js
new file mode 100644
index 000000000..c57103663
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-console.js
@@ -0,0 +1,34 @@
+// Return a promise with a reference to jsterm, opening the split
+// console if necessary. This cleans up the split console pref so
+// it won't pollute other tests.
+function getSplitConsole(dbg) {
+ const { toolbox, win } = dbg;
+
+ registerCleanupFunction(() => {
+ Services.prefs.clearUserPref("devtools.toolbox.splitconsoleEnabled");
+ });
+
+ if (!win) {
+ win = toolbox.win;
+ }
+
+ if (!toolbox.splitConsole) {
+ EventUtils.synthesizeKey("VK_ESCAPE", {}, win);
+ }
+
+ return new Promise(resolve => {
+ toolbox.getPanelWhenReady("webconsole").then(() => {
+ ok(toolbox.splitConsole, "Split console is shown.");
+ let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
+ resolve(jsterm);
+ });
+ });
+}
+
+add_task(function* () {
+ Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
+ const dbg = yield initDebugger("doc-script-switching.html");
+
+ yield getSplitConsole(dbg);
+ ok(dbg.toolbox.splitConsole, "Split console is shown.");
+});