Skip to content

Instantly share code, notes, and snippets.

@joewalker
Created April 9, 2012 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joewalker/2343085 to your computer and use it in GitHub Desktop.
Save joewalker/2343085 to your computer and use it in GitHub Desktop.
browser_gcli_break.js
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the break command works as it should
const TEST_URI = "http://example.com/browser/browser/devtools/shared/test/browser_gcli_break.html";
function test() {
DeveloperToolbarTest.test(TEST_URI, function(browser, tab) {
testBreakCommands();
});
}
function testBreakCommands() {
DeveloperToolbarTest.checkInputStatus({
typed: "brea",
directTabText: "k",
status: "ERROR"
});
DeveloperToolbarTest.checkInputStatus({
typed: "break",
status: "ERROR"
});
DeveloperToolbarTest.checkInputStatus({
typed: "break add",
status: "ERROR"
});
DeveloperToolbarTest.checkInputStatus({
typed: "break add line",
emptyParameters: [ " <file>", " <line>" ],
status: "ERROR"
});
let pane = DebuggerUI.toggleDebugger();
pane.onConnected = function test_onConnected(aPane) {
// Wait for the initial resume.
let client = aPane.debuggerWindow.gClient;
client.addOneTimeListener("resumed", function() {
delete aPane.onConnected;
client.activeThread.addOneTimeListener("framesadded", function() {
DeveloperToolbarTest.checkInputStatus({
typed: "break add line " + TEST_URI + " " + content.wrappedJSObject.line0,
status: "VALID"
});
DeveloperToolbarTest.exec({
args: {
type: 'line',
file: TEST_URI,
line: content.wrappedJSObject.line0
},
completed: false
});
DeveloperToolbarTest.checkInputStatus({
typed: "break list",
status: "VALID"
});
DeveloperToolbarTest.exec();
client.activeThread.resume(function() {
DeveloperToolbarTest.checkInputStatus({
typed: "break del 0",
status: "VALID"
});
DeveloperToolbarTest.exec({
args: { breakid: 0 },
completed: false
});
finish();
});
});
// Trigger newScript notifications using eval.
content.wrappedJSObject.firstCall();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment