diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/debugger/test/mochitest/browser_dbg_cmd-dbg.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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_cmd-dbg.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg_cmd-dbg.js | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_cmd-dbg.js b/devtools/client/debugger/test/mochitest/browser_dbg_cmd-dbg.js new file mode 100644 index 000000000..e843d0cd5 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg_cmd-dbg.js @@ -0,0 +1,102 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests that the debugger commands work as they should. + */ + +const TEST_URI = EXAMPLE_URL + "doc_cmd-dbg.html"; + +function test() { + return Task.spawn(function* () { + let options = yield helpers.openTab(TEST_URI); + yield helpers.openToolbar(options); + + yield helpers.audit(options, [{ + setup: "dbg open", + exec: { output: "" } + }]); + + let [gTab, gDebuggee, gPanel] = yield initDebugger(gBrowser.selectedTab); + let gDebugger = gPanel.panelWin; + let gThreadClient = gDebugger.gThreadClient; + + yield helpers.audit(options, [{ + setup: "dbg list", + exec: { output: /doc_cmd-dbg.html/ } + }]); + + let button = gDebuggee.document.querySelector("input[type=button]"); + let output = gDebuggee.document.querySelector("input[type=text]"); + + let cmd = function (aTyped, aState) { + return promise.all([ + waitForThreadEvents(gPanel, aState), + helpers.audit(options, [{ setup: aTyped, exec: { output: "" } }]) + ]); + }; + + let click = function (aElement, aState) { + return promise.all([ + waitForThreadEvents(gPanel, aState), + executeSoon(() => EventUtils.sendMouseEvent({ type: "click" }, aElement, gDebuggee)) + ]); + }; + + yield cmd("dbg interrupt", "paused"); + is(gThreadClient.state, "paused", "Debugger is paused."); + + yield cmd("dbg continue", "resumed"); + isnot(gThreadClient.state, "paused", "Debugger has continued."); + + yield click(button, "paused"); + is(gThreadClient.state, "paused", "Debugger is paused again."); + + yield cmd("dbg step in", "paused"); + yield cmd("dbg step in", "paused"); + yield cmd("dbg step in", "paused"); + is(output.value, "step in", "Debugger stepped in."); + + yield cmd("dbg step over", "paused"); + is(output.value, "step over", "Debugger stepped over."); + + yield cmd("dbg step out", "paused"); + is(output.value, "step out", "Debugger stepped out."); + + yield cmd("dbg continue", "paused"); + is(output.value, "dbg continue", "Debugger continued."); + + let closeDebugger = function () { + let deferred = promise.defer(); + + helpers.audit(options, [{ + setup: "dbg close", + exec: { output: "" } + }]) + .then(() => { + let toolbox = gDevTools.getToolbox(options.target); + if (!toolbox) { + ok(true, "Debugger is closed."); + deferred.resolve(); + } else { + toolbox.on("destroyed", () => { + ok(true, "Debugger just closed."); + deferred.resolve(); + }); + } + }); + + return deferred.promise; + }; + + // We close the debugger twice to ensure 'dbg close' doesn't error when + // toolbox is already closed. See bug 884638 for more info. + yield closeDebugger(); + yield closeDebugger(); + yield helpers.closeToolbar(options); + yield helpers.closeTab(options); + + }).then(finish, helpers.handleError); +} |