browser/devtools/debugger/test/browser_dbg_cmd-break.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests that the break commands works as they should.
michael@0 6 */
michael@0 7
michael@0 8 const TAB_URL = EXAMPLE_URL + "doc_cmd-break.html";
michael@0 9
michael@0 10 function test() {
michael@0 11 let gPanel, gDebugger, gThreadClient;
michael@0 12 let gLineNumber;
michael@0 13
michael@0 14 helpers.addTabWithToolbar(TAB_URL, aOptions => {
michael@0 15 return helpers.audit(aOptions, [
michael@0 16 {
michael@0 17 setup: 'break',
michael@0 18 check: {
michael@0 19 input: 'break',
michael@0 20 hints: ' add line',
michael@0 21 markup: 'IIIII',
michael@0 22 status: 'ERROR',
michael@0 23 }
michael@0 24 },
michael@0 25 {
michael@0 26 setup: 'break add',
michael@0 27 check: {
michael@0 28 input: 'break add',
michael@0 29 hints: ' line',
michael@0 30 markup: 'IIIIIVIII',
michael@0 31 status: 'ERROR'
michael@0 32 }
michael@0 33 },
michael@0 34 {
michael@0 35 setup: 'break add line',
michael@0 36 check: {
michael@0 37 input: 'break add line',
michael@0 38 hints: ' <file> <line>',
michael@0 39 markup: 'VVVVVVVVVVVVVV',
michael@0 40 status: 'ERROR'
michael@0 41 }
michael@0 42 },
michael@0 43 {
michael@0 44 name: 'open toolbox',
michael@0 45 setup: function() {
michael@0 46 return initDebugger(gBrowser.selectedTab).then(([aTab, aDebuggee, aPanel]) => {
michael@0 47 // Spin the event loop before causing the debuggee to pause, to allow
michael@0 48 // this function to return first.
michael@0 49 executeSoon(() => aDebuggee.firstCall());
michael@0 50
michael@0 51 return waitForSourceAndCaretAndScopes(aPanel, ".html", 1).then(() => {
michael@0 52 gPanel = aPanel;
michael@0 53 gDebugger = gPanel.panelWin;
michael@0 54 gThreadClient = gPanel.panelWin.gThreadClient;
michael@0 55 gLineNumber = '' + aOptions.window.wrappedJSObject.gLineNumber;
michael@0 56 });
michael@0 57 });
michael@0 58 },
michael@0 59 post: function() {
michael@0 60 ok(gThreadClient, "Debugger client exists.");
michael@0 61 is(gLineNumber, 1, "gLineNumber is correct.");
michael@0 62 },
michael@0 63 },
michael@0 64 {
michael@0 65 name: 'break add line .../doc_cmd-break.html 14',
michael@0 66 setup: function() {
michael@0 67 // We have to setup in a function to allow gLineNumber to be initialized.
michael@0 68 let line = 'break add line ' + TAB_URL + ' ' + gLineNumber;
michael@0 69 return helpers.setInput(aOptions, line);
michael@0 70 },
michael@0 71 check: {
michael@0 72 hints: '',
michael@0 73 status: 'VALID',
michael@0 74 message: '',
michael@0 75 args: {
michael@0 76 file: { value: TAB_URL, message: '' },
michael@0 77 line: { value: 1 }
michael@0 78 }
michael@0 79 },
michael@0 80 exec: {
michael@0 81 output: 'Added breakpoint'
michael@0 82 }
michael@0 83 },
michael@0 84 {
michael@0 85 setup: 'break add line ' + TAB_URL + ' 17',
michael@0 86 check: {
michael@0 87 hints: '',
michael@0 88 status: 'VALID',
michael@0 89 message: '',
michael@0 90 args: {
michael@0 91 file: { value: TAB_URL, message: '' },
michael@0 92 line: { value: 17 }
michael@0 93 }
michael@0 94 },
michael@0 95 exec: {
michael@0 96 output: 'Added breakpoint'
michael@0 97 }
michael@0 98 },
michael@0 99 {
michael@0 100 setup: 'break list',
michael@0 101 check: {
michael@0 102 input: 'break list',
michael@0 103 hints: '',
michael@0 104 markup: 'VVVVVVVVVV',
michael@0 105 status: 'VALID'
michael@0 106 },
michael@0 107 exec: {
michael@0 108 output: [
michael@0 109 /Source/, /Remove/,
michael@0 110 /doc_cmd-break\.html:1/,
michael@0 111 /doc_cmd-break\.html:1/
michael@0 112 ]
michael@0 113 }
michael@0 114 },
michael@0 115 {
michael@0 116 name: 'cleanup',
michael@0 117 setup: function() {
michael@0 118 let deferred = promise.defer();
michael@0 119 gThreadClient.resume(deferred.resolve);
michael@0 120 return deferred.promise;
michael@0 121 }
michael@0 122 },
michael@0 123 {
michael@0 124 setup: 'break del 1',
michael@0 125 check: {
michael@0 126 input: 'break del 1',
michael@0 127 hints: ' -> doc_cmd-break.html:1',
michael@0 128 markup: 'VVVVVVVVVVI',
michael@0 129 status: 'ERROR',
michael@0 130 args: {
michael@0 131 breakpoint: {
michael@0 132 status: 'INCOMPLETE',
michael@0 133 message: 'Value required for \'breakpoint\'.'
michael@0 134 }
michael@0 135 }
michael@0 136 }
michael@0 137 },
michael@0 138 {
michael@0 139 setup: 'break del doc_cmd-break.html:1',
michael@0 140 check: {
michael@0 141 input: 'break del doc_cmd-break.html:1',
michael@0 142 hints: '',
michael@0 143 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
michael@0 144 status: 'VALID',
michael@0 145 args: {
michael@0 146 breakpoint: { arg: ' doc_cmd-break.html:1' },
michael@0 147 }
michael@0 148 },
michael@0 149 exec: {
michael@0 150 output: 'Breakpoint removed'
michael@0 151 }
michael@0 152 },
michael@0 153 {
michael@0 154 setup: 'break list',
michael@0 155 check: {
michael@0 156 input: 'break list',
michael@0 157 hints: '',
michael@0 158 markup: 'VVVVVVVVVV',
michael@0 159 status: 'VALID'
michael@0 160 },
michael@0 161 exec: {
michael@0 162 output: [
michael@0 163 /Source/, /Remove/,
michael@0 164 /doc_cmd-break\.html:17/
michael@0 165 ]
michael@0 166 }
michael@0 167 },
michael@0 168 {
michael@0 169 setup: 'break del doc_cmd-break.html:17',
michael@0 170 check: {
michael@0 171 input: 'break del doc_cmd-break.html:17',
michael@0 172 hints: '',
michael@0 173 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
michael@0 174 status: 'VALID',
michael@0 175 args: {
michael@0 176 breakpoint: { arg: ' doc_cmd-break.html:17' },
michael@0 177 }
michael@0 178 },
michael@0 179 exec: {
michael@0 180 output: 'Breakpoint removed'
michael@0 181 }
michael@0 182 },
michael@0 183 {
michael@0 184 setup: 'break list',
michael@0 185 check: {
michael@0 186 input: 'break list',
michael@0 187 hints: '',
michael@0 188 markup: 'VVVVVVVVVV',
michael@0 189 status: 'VALID'
michael@0 190 },
michael@0 191 exec: {
michael@0 192 output: 'No breakpoints set'
michael@0 193 },
michael@0 194 post: function() {
michael@0 195 return teardown(gPanel, { noTabRemoval: true });
michael@0 196 }
michael@0 197 },
michael@0 198 ]);
michael@0 199 }).then(finish);
michael@0 200 }

mercurial