browser/devtools/commandline/test/browser_cmd_pref1.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 // Tests that the pref commands work
     6 let prefBranch = Cc["@mozilla.org/preferences-service;1"]
     7                     .getService(Ci.nsIPrefService).getBranch(null)
     8                     .QueryInterface(Ci.nsIPrefBranch2);
    10 let settings = require("gcli/settings");
    12 const TEST_URI = "data:text/html;charset=utf-8,gcli-pref1";
    14 function test() {
    15   return Task.spawn(spawnTest).then(finish, helpers.handleError);
    16 }
    18 function spawnTest() {
    19   let options = yield helpers.openTab(TEST_URI);
    20   yield helpers.openToolbar(options);
    22   let tiltEnabledOrig = prefBranch.getBoolPref("devtools.tilt.enabled");
    23   info("originally: devtools.tilt.enabled = " + tiltEnabledOrig);
    25   yield helpers.audit(options, [
    26     {
    27       setup: 'pref',
    28       check: {
    29         input:  'pref',
    30         hints:      ' reset',
    31         markup: 'IIII',
    32         status: 'ERROR'
    33       },
    34     },
    35     {
    36       setup: 'pref s',
    37       check: {
    38         input:  'pref s',
    39         hints:        'et',
    40         markup: 'IIIIVI',
    41         status: 'ERROR'
    42       },
    43     },
    44     {
    45       setup: 'pref sh',
    46       check: {
    47         input:  'pref sh',
    48         hints:         'ow',
    49         markup: 'IIIIVII',
    50         status: 'ERROR'
    51       },
    52     },
    53     {
    54       setup: 'pref show ',
    55       check: {
    56         input:  'pref show ',
    57         markup: 'VVVVVVVVVV',
    58         status: 'ERROR'
    59       },
    60     },
    61     {
    62       setup: 'pref show usetexttospeech',
    63       check: {
    64         input:  'pref show usetexttospeech',
    65         hints:                           ' -> accessibility.usetexttospeech',
    66         markup: 'VVVVVVVVVVIIIIIIIIIIIIIII',
    67         status: 'ERROR'
    68       },
    69     },
    70     {
    71       setup: 'pref show devtools.til',
    72       check: {
    73         input:  'pref show devtools.til',
    74         hints:                        't.enabled',
    75         markup: 'VVVVVVVVVVIIIIIIIIIIII',
    76         status: 'ERROR',
    77         tooltipState: 'true:importantFieldFlag',
    78         args: {
    79           setting: { value: undefined, status: 'INCOMPLETE' },
    80         }
    81       },
    82     },
    83     {
    84       setup: 'pref reset devtools.tilt.enabled',
    85       check: {
    86         input:  'pref reset devtools.tilt.enabled',
    87         hints:                                  '',
    88         markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
    89         status: 'VALID'
    90       },
    91     },
    92     {
    93       setup: 'pref show devtools.tilt.enabled 4',
    94       check: {
    95         input:  'pref show devtools.tilt.enabled 4',
    96         hints:                                   '',
    97         markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE',
    98         status: 'ERROR'
    99       },
   100     },
   101     {
   102       setup: 'pref set devtools.tilt.enabled 4',
   103       check: {
   104         input:  'pref set devtools.tilt.enabled 4',
   105         hints:                                  '',
   106         markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE',
   107         status: 'ERROR',
   108         args: {
   109           setting: { arg: ' devtools.tilt.enabled' },
   110           value: { status: 'ERROR', message: 'Can\'t use \'4\'.' },
   111         }
   112       },
   113     },
   114     {
   115       setup: 'pref set devtools.editor.tabsize 4',
   116       check: {
   117         input:  'pref set devtools.editor.tabsize 4',
   118         hints:                                    '',
   119         markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
   120         status: 'VALID',
   121         args: {
   122           setting: { arg: ' devtools.editor.tabsize' },
   123           value: { value: 4 },
   124         }
   125       },
   126     },
   127     {
   128       setup: 'pref list',
   129       check: {
   130         input:  'pref list',
   131         hints:           ' -> pref set',
   132         markup: 'IIIIVIIII',
   133         status: 'ERROR'
   134       },
   135     },
   136     {
   137       setup: 'pref show devtools.tilt.enabled',
   138       check: {
   139         args: {
   140           setting: { value: settings.getSetting("devtools.tilt.enabled") }
   141         },
   142       },
   143       exec: {
   144         output: "devtools.tilt.enabled: " + tiltEnabledOrig,
   145       },
   146       post: function() {
   147         prefBranch.setBoolPref("devtools.tilt.enabled", tiltEnabledOrig);
   148       }
   149     },
   150   ]);
   152   yield helpers.closeToolbar(options);
   153   yield helpers.closeTab(options);
   154 }

mercurial