1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/commandline/test/browser_cmd_pref1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,154 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +// Tests that the pref commands work 1.8 + 1.9 +let prefBranch = Cc["@mozilla.org/preferences-service;1"] 1.10 + .getService(Ci.nsIPrefService).getBranch(null) 1.11 + .QueryInterface(Ci.nsIPrefBranch2); 1.12 + 1.13 +let settings = require("gcli/settings"); 1.14 + 1.15 +const TEST_URI = "data:text/html;charset=utf-8,gcli-pref1"; 1.16 + 1.17 +function test() { 1.18 + return Task.spawn(spawnTest).then(finish, helpers.handleError); 1.19 +} 1.20 + 1.21 +function spawnTest() { 1.22 + let options = yield helpers.openTab(TEST_URI); 1.23 + yield helpers.openToolbar(options); 1.24 + 1.25 + let tiltEnabledOrig = prefBranch.getBoolPref("devtools.tilt.enabled"); 1.26 + info("originally: devtools.tilt.enabled = " + tiltEnabledOrig); 1.27 + 1.28 + yield helpers.audit(options, [ 1.29 + { 1.30 + setup: 'pref', 1.31 + check: { 1.32 + input: 'pref', 1.33 + hints: ' reset', 1.34 + markup: 'IIII', 1.35 + status: 'ERROR' 1.36 + }, 1.37 + }, 1.38 + { 1.39 + setup: 'pref s', 1.40 + check: { 1.41 + input: 'pref s', 1.42 + hints: 'et', 1.43 + markup: 'IIIIVI', 1.44 + status: 'ERROR' 1.45 + }, 1.46 + }, 1.47 + { 1.48 + setup: 'pref sh', 1.49 + check: { 1.50 + input: 'pref sh', 1.51 + hints: 'ow', 1.52 + markup: 'IIIIVII', 1.53 + status: 'ERROR' 1.54 + }, 1.55 + }, 1.56 + { 1.57 + setup: 'pref show ', 1.58 + check: { 1.59 + input: 'pref show ', 1.60 + markup: 'VVVVVVVVVV', 1.61 + status: 'ERROR' 1.62 + }, 1.63 + }, 1.64 + { 1.65 + setup: 'pref show usetexttospeech', 1.66 + check: { 1.67 + input: 'pref show usetexttospeech', 1.68 + hints: ' -> accessibility.usetexttospeech', 1.69 + markup: 'VVVVVVVVVVIIIIIIIIIIIIIII', 1.70 + status: 'ERROR' 1.71 + }, 1.72 + }, 1.73 + { 1.74 + setup: 'pref show devtools.til', 1.75 + check: { 1.76 + input: 'pref show devtools.til', 1.77 + hints: 't.enabled', 1.78 + markup: 'VVVVVVVVVVIIIIIIIIIIII', 1.79 + status: 'ERROR', 1.80 + tooltipState: 'true:importantFieldFlag', 1.81 + args: { 1.82 + setting: { value: undefined, status: 'INCOMPLETE' }, 1.83 + } 1.84 + }, 1.85 + }, 1.86 + { 1.87 + setup: 'pref reset devtools.tilt.enabled', 1.88 + check: { 1.89 + input: 'pref reset devtools.tilt.enabled', 1.90 + hints: '', 1.91 + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', 1.92 + status: 'VALID' 1.93 + }, 1.94 + }, 1.95 + { 1.96 + setup: 'pref show devtools.tilt.enabled 4', 1.97 + check: { 1.98 + input: 'pref show devtools.tilt.enabled 4', 1.99 + hints: '', 1.100 + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE', 1.101 + status: 'ERROR' 1.102 + }, 1.103 + }, 1.104 + { 1.105 + setup: 'pref set devtools.tilt.enabled 4', 1.106 + check: { 1.107 + input: 'pref set devtools.tilt.enabled 4', 1.108 + hints: '', 1.109 + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE', 1.110 + status: 'ERROR', 1.111 + args: { 1.112 + setting: { arg: ' devtools.tilt.enabled' }, 1.113 + value: { status: 'ERROR', message: 'Can\'t use \'4\'.' }, 1.114 + } 1.115 + }, 1.116 + }, 1.117 + { 1.118 + setup: 'pref set devtools.editor.tabsize 4', 1.119 + check: { 1.120 + input: 'pref set devtools.editor.tabsize 4', 1.121 + hints: '', 1.122 + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', 1.123 + status: 'VALID', 1.124 + args: { 1.125 + setting: { arg: ' devtools.editor.tabsize' }, 1.126 + value: { value: 4 }, 1.127 + } 1.128 + }, 1.129 + }, 1.130 + { 1.131 + setup: 'pref list', 1.132 + check: { 1.133 + input: 'pref list', 1.134 + hints: ' -> pref set', 1.135 + markup: 'IIIIVIIII', 1.136 + status: 'ERROR' 1.137 + }, 1.138 + }, 1.139 + { 1.140 + setup: 'pref show devtools.tilt.enabled', 1.141 + check: { 1.142 + args: { 1.143 + setting: { value: settings.getSetting("devtools.tilt.enabled") } 1.144 + }, 1.145 + }, 1.146 + exec: { 1.147 + output: "devtools.tilt.enabled: " + tiltEnabledOrig, 1.148 + }, 1.149 + post: function() { 1.150 + prefBranch.setBoolPref("devtools.tilt.enabled", tiltEnabledOrig); 1.151 + } 1.152 + }, 1.153 + ]); 1.154 + 1.155 + yield helpers.closeToolbar(options); 1.156 + yield helpers.closeTab(options); 1.157 +}