File: browser_dbg_cmd-break.js

package info (click to toggle)
iceweasel 31.6.0esr-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 1,368,576 kB
  • sloc: cpp: 3,692,968; ansic: 1,797,194; python: 193,401; java: 180,622; asm: 133,557; xml: 89,288; sh: 71,748; perl: 22,087; makefile: 21,687; objc: 4,014; yacc: 1,995; pascal: 1,292; lex: 950; exp: 449; lisp: 228; awk: 211; php: 113; sed: 43; csh: 31; ada: 16; ruby: 3
file content (200 lines) | stat: -rw-r--r-- 5,304 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

/**
 * Tests that the break commands works as they should.
 */

const TAB_URL = EXAMPLE_URL + "doc_cmd-break.html";

function test() {
  let gPanel, gDebugger, gThreadClient;
  let gLineNumber;

  helpers.addTabWithToolbar(TAB_URL, aOptions => {
    return helpers.audit(aOptions, [
      {
        setup: 'break',
        check: {
          input:  'break',
          hints:       ' add line',
          markup: 'IIIII',
          status: 'ERROR',
        }
      },
      {
        setup: 'break add',
        check: {
          input:  'break add',
          hints:           ' line',
          markup: 'IIIIIVIII',
          status: 'ERROR'
        }
      },
      {
        setup: 'break add line',
        check: {
          input:  'break add line',
          hints:                ' <file> <line>',
          markup: 'VVVVVVVVVVVVVV',
          status: 'ERROR'
        }
      },
      {
        name: 'open toolbox',
        setup: function() {
          return initDebugger(gBrowser.selectedTab).then(([aTab, aDebuggee, aPanel]) => {
            // Spin the event loop before causing the debuggee to pause, to allow
            // this function to return first.
            executeSoon(() => aDebuggee.firstCall());

            return waitForSourceAndCaretAndScopes(aPanel, ".html", 1).then(() => {
              gPanel = aPanel;
              gDebugger = gPanel.panelWin;
              gThreadClient = gPanel.panelWin.gThreadClient;
              gLineNumber = '' + aOptions.window.wrappedJSObject.gLineNumber;
            });
          });
        },
        post: function() {
          ok(gThreadClient, "Debugger client exists.");
          is(gLineNumber, 1, "gLineNumber is correct.");
        },
      },
      {
        name: 'break add line .../doc_cmd-break.html 14',
        setup: function() {
          // We have to setup in a function to allow gLineNumber to be initialized.
          let line = 'break add line ' + TAB_URL + ' ' + gLineNumber;
          return helpers.setInput(aOptions, line);
        },
        check: {
          hints: '',
          status: 'VALID',
          message: '',
          args: {
            file: { value: TAB_URL, message: '' },
            line: { value: 1 }
          }
        },
        exec: {
          output: 'Added breakpoint'
        }
      },
      {
        setup: 'break add line ' + TAB_URL + ' 17',
        check: {
          hints: '',
          status: 'VALID',
          message: '',
          args: {
            file: { value: TAB_URL, message: '' },
            line: { value: 17 }
          }
        },
        exec: {
          output: 'Added breakpoint'
        }
      },
      {
        setup: 'break list',
        check: {
          input:  'break list',
          hints:            '',
          markup: 'VVVVVVVVVV',
          status: 'VALID'
        },
        exec: {
          output: [
            /Source/, /Remove/,
            /doc_cmd-break\.html:1/,
            /doc_cmd-break\.html:1/
          ]
        }
      },
      {
        name: 'cleanup',
        setup: function() {
          let deferred = promise.defer();
          gThreadClient.resume(deferred.resolve);
          return deferred.promise;
        }
      },
      {
        setup: 'break del 1',
        check: {
          input:  'break del 1',
          hints:              ' -> doc_cmd-break.html:1',
          markup: 'VVVVVVVVVVI',
          status: 'ERROR',
          args: {
            breakpoint: {
              status: 'INCOMPLETE',
              message: 'Value required for \'breakpoint\'.'
            }
          }
        }
      },
      {
        setup: 'break del doc_cmd-break.html:1',
        check: {
          input:  'break del doc_cmd-break.html:1',
          hints:                                 '',
          markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
          status: 'VALID',
          args: {
            breakpoint: { arg: ' doc_cmd-break.html:1' },
          }
        },
        exec: {
          output: 'Breakpoint removed'
        }
      },
      {
        setup: 'break list',
        check: {
          input:  'break list',
          hints:            '',
          markup: 'VVVVVVVVVV',
          status: 'VALID'
        },
        exec: {
          output: [
            /Source/, /Remove/,
            /doc_cmd-break\.html:17/
          ]
        }
      },
      {
        setup: 'break del doc_cmd-break.html:17',
        check: {
          input:  'break del doc_cmd-break.html:17',
          hints:                                 '',
          markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
          status: 'VALID',
          args: {
            breakpoint: { arg: ' doc_cmd-break.html:17' },
          }
        },
        exec: {
          output: 'Breakpoint removed'
        }
      },
      {
        setup: 'break list',
        check: {
          input:  'break list',
          hints:            '',
          markup: 'VVVVVVVVVV',
          status: 'VALID'
        },
        exec: {
          output: 'No breakpoints set'
        },
        post: function() {
          return teardown(gPanel, { noTabRemoval: true });
        }
      },
    ]);
  }).then(finish);
}