browser/devtools/commandline/test/browser_cmd_pref2.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 // 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-pref2";
    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 tabSizeOrig = prefBranch.getIntPref("devtools.editor.tabsize");
    23   info("originally: devtools.editor.tabsize = " + tabSizeOrig);
    25   yield helpers.audit(options, [
    26     {
    27       setup: 'pref show devtools.editor.tabsize',
    28       check: {
    29         args: {
    30           setting: { value: settings.getSetting("devtools.editor.tabsize") }
    31         },
    32       },
    33       exec: {
    34         output: "devtools.editor.tabsize: " + tabSizeOrig,
    35       },
    36     },
    37     {
    38       setup: 'pref set devtools.editor.tabsize 20',
    39       check: {
    40         args: {
    41           setting: { value: settings.getSetting("devtools.editor.tabsize") },
    42           value: { value: 20 }
    43         },
    44       },
    45       exec: {
    46         output: '',
    47       },
    48       post: function() {
    49         is(prefBranch.getIntPref("devtools.editor.tabsize"), 20,
    50                                  "devtools.editor.tabsize is 20");
    51       }
    52     },
    53     {
    54       setup: 'pref show devtools.editor.tabsize',
    55       check: {
    56         args: {
    57           setting: { value: settings.getSetting("devtools.editor.tabsize") }
    58         },
    59       },
    60       exec: {
    61         output: "devtools.editor.tabsize: 20",
    62       }
    63     },
    64     {
    65       setup: 'pref set devtools.editor.tabsize 1',
    66       check: {
    67         args: {
    68           setting: { value: settings.getSetting("devtools.editor.tabsize") },
    69           value: { value: 1 }
    70         },
    71       },
    72       exec: {
    73         output: '',
    74       },
    75     },
    76     {
    77       setup: 'pref show devtools.editor.tabsize',
    78       check: {
    79         args: {
    80           setting: { value: settings.getSetting("devtools.editor.tabsize") }
    81         },
    82       },
    83       exec: {
    84         output: "devtools.editor.tabsize: 1",
    85       },
    86       post: function() {
    87         is(prefBranch.getIntPref("devtools.editor.tabsize"), 1,
    88                                  "devtools.editor.tabsize is 1");
    89       }
    90     },
    91   ]);
    93   prefBranch.setIntPref("devtools.editor.tabsize", tabSizeOrig);
    95   yield helpers.closeToolbar(options);
    96   yield helpers.closeTab(options);
    97 }

mercurial