mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-12 14:37:50 +00:00
bcd2b911bd
--HG-- rename : browser/devtools/debugger/test/browser_dbg_createChrome.js => browser/devtools/debugger/test/browser_dbg_chrome-create.js rename : browser/devtools/debugger/test/browser_dbg_cmd_blackbox.js => browser/devtools/debugger/test/browser_dbg_cmd-blackbox.js rename : browser/devtools/debugger/test/browser_dbg_cmd_break.js => browser/devtools/debugger/test/browser_dbg_cmd-break.js rename : browser/devtools/debugger/test/browser_dbg_cmd.js => browser/devtools/debugger/test/browser_dbg_cmd-dbg.js rename : browser/devtools/debugger/test/browser_dbg_debuggerstatement.js => browser/devtools/debugger/test/browser_dbg_debugger-statement.js rename : browser/devtools/debugger/test/browser_dbg_bug731394_editor-contextmenu.js => browser/devtools/debugger/test/browser_dbg_editor-contextmenu.js rename : browser/devtools/debugger/test/browser_dbg_displayName.js => browser/devtools/debugger/test/browser_dbg_function-display-name.js rename : browser/devtools/debugger/test/browser_dbg_globalactor-01.js => browser/devtools/debugger/test/browser_dbg_globalactor.js rename : browser/devtools/debugger/test/browser_dbg_pane-collapse.js => browser/devtools/debugger/test/browser_dbg_instruments-pane-collapse.js rename : browser/devtools/debugger/test/browser_dbg_nav-01.js => browser/devtools/debugger/test/browser_dbg_navigation.js rename : browser/devtools/debugger/test/browser_dbg_bug868163_highight_on_pause.js => browser/devtools/debugger/test/browser_dbg_on-pause-highlight.js rename : browser/devtools/debugger/test/browser_dbg_bug883220_raise_on_pause.js => browser/devtools/debugger/test/browser_dbg_on-pause-raise.js rename : browser/devtools/debugger/test/browser_dbg_panesize-inner.js => browser/devtools/debugger/test/browser_dbg_panel-size.js rename : browser/devtools/debugger/test/browser_dbg_pause-exceptions.js => browser/devtools/debugger/test/browser_dbg_pause-exceptions-01.js rename : browser/devtools/debugger/test/browser_dbg_pause-exceptions-reload.js => browser/devtools/debugger/test/browser_dbg_pause-exceptions-02.js rename : browser/devtools/debugger/test/browser_dbg_reload-preferred-script.js => browser/devtools/debugger/test/browser_dbg_reload-preferred-script-01.js rename : browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-01.js => browser/devtools/debugger/test/browser_dbg_watch-expressions-01.js rename : browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-02.js => browser/devtools/debugger/test/browser_dbg_watch-expressions-02.js
102 lines
3.0 KiB
JavaScript
102 lines
3.0 KiB
JavaScript
/* 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: "", completed: false }
|
|
}]);
|
|
|
|
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",
|
|
completed: false,
|
|
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);
|
|
}
|