michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests that the break commands works as they should. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_cmd-break.html"; michael@0: michael@0: function test() { michael@0: let gPanel, gDebugger, gThreadClient; michael@0: let gLineNumber; michael@0: michael@0: helpers.addTabWithToolbar(TAB_URL, aOptions => { michael@0: return helpers.audit(aOptions, [ michael@0: { michael@0: setup: 'break', michael@0: check: { michael@0: input: 'break', michael@0: hints: ' add line', michael@0: markup: 'IIIII', michael@0: status: 'ERROR', michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break add', michael@0: check: { michael@0: input: 'break add', michael@0: hints: ' line', michael@0: markup: 'IIIIIVIII', michael@0: status: 'ERROR' michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break add line', michael@0: check: { michael@0: input: 'break add line', michael@0: hints: ' ', michael@0: markup: 'VVVVVVVVVVVVVV', michael@0: status: 'ERROR' michael@0: } michael@0: }, michael@0: { michael@0: name: 'open toolbox', michael@0: setup: function() { michael@0: return initDebugger(gBrowser.selectedTab).then(([aTab, aDebuggee, aPanel]) => { michael@0: // Spin the event loop before causing the debuggee to pause, to allow michael@0: // this function to return first. michael@0: executeSoon(() => aDebuggee.firstCall()); michael@0: michael@0: return waitForSourceAndCaretAndScopes(aPanel, ".html", 1).then(() => { michael@0: gPanel = aPanel; michael@0: gDebugger = gPanel.panelWin; michael@0: gThreadClient = gPanel.panelWin.gThreadClient; michael@0: gLineNumber = '' + aOptions.window.wrappedJSObject.gLineNumber; michael@0: }); michael@0: }); michael@0: }, michael@0: post: function() { michael@0: ok(gThreadClient, "Debugger client exists."); michael@0: is(gLineNumber, 1, "gLineNumber is correct."); michael@0: }, michael@0: }, michael@0: { michael@0: name: 'break add line .../doc_cmd-break.html 14', michael@0: setup: function() { michael@0: // We have to setup in a function to allow gLineNumber to be initialized. michael@0: let line = 'break add line ' + TAB_URL + ' ' + gLineNumber; michael@0: return helpers.setInput(aOptions, line); michael@0: }, michael@0: check: { michael@0: hints: '', michael@0: status: 'VALID', michael@0: message: '', michael@0: args: { michael@0: file: { value: TAB_URL, message: '' }, michael@0: line: { value: 1 } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Added breakpoint' michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break add line ' + TAB_URL + ' 17', michael@0: check: { michael@0: hints: '', michael@0: status: 'VALID', michael@0: message: '', michael@0: args: { michael@0: file: { value: TAB_URL, message: '' }, michael@0: line: { value: 17 } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Added breakpoint' michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break list', michael@0: check: { michael@0: input: 'break list', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVV', michael@0: status: 'VALID' michael@0: }, michael@0: exec: { michael@0: output: [ michael@0: /Source/, /Remove/, michael@0: /doc_cmd-break\.html:1/, michael@0: /doc_cmd-break\.html:1/ michael@0: ] michael@0: } michael@0: }, michael@0: { michael@0: name: 'cleanup', michael@0: setup: function() { michael@0: let deferred = promise.defer(); michael@0: gThreadClient.resume(deferred.resolve); michael@0: return deferred.promise; michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break del 1', michael@0: check: { michael@0: input: 'break del 1', michael@0: hints: ' -> doc_cmd-break.html:1', michael@0: markup: 'VVVVVVVVVVI', michael@0: status: 'ERROR', michael@0: args: { michael@0: breakpoint: { michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'breakpoint\'.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break del doc_cmd-break.html:1', michael@0: check: { michael@0: input: 'break del doc_cmd-break.html:1', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', michael@0: status: 'VALID', michael@0: args: { michael@0: breakpoint: { arg: ' doc_cmd-break.html:1' }, michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Breakpoint removed' michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break list', michael@0: check: { michael@0: input: 'break list', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVV', michael@0: status: 'VALID' michael@0: }, michael@0: exec: { michael@0: output: [ michael@0: /Source/, /Remove/, michael@0: /doc_cmd-break\.html:17/ michael@0: ] michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break del doc_cmd-break.html:17', michael@0: check: { michael@0: input: 'break del doc_cmd-break.html:17', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', michael@0: status: 'VALID', michael@0: args: { michael@0: breakpoint: { arg: ' doc_cmd-break.html:17' }, michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Breakpoint removed' michael@0: } michael@0: }, michael@0: { michael@0: setup: 'break list', michael@0: check: { michael@0: input: 'break list', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVV', michael@0: status: 'VALID' michael@0: }, michael@0: exec: { michael@0: output: 'No breakpoints set' michael@0: }, michael@0: post: function() { michael@0: return teardown(gPanel, { noTabRemoval: true }); michael@0: } michael@0: }, michael@0: ]); michael@0: }).then(finish); michael@0: }