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.

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

mercurial