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