michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // Tests that the pref commands work michael@0: michael@0: let prefBranch = Cc["@mozilla.org/preferences-service;1"] michael@0: .getService(Ci.nsIPrefService).getBranch(null) michael@0: .QueryInterface(Ci.nsIPrefBranch2); michael@0: michael@0: let settings = require("gcli/settings"); michael@0: michael@0: const TEST_URI = "data:text/html;charset=utf-8,gcli-pref1"; michael@0: michael@0: function test() { michael@0: return Task.spawn(spawnTest).then(finish, helpers.handleError); michael@0: } michael@0: michael@0: function spawnTest() { michael@0: let options = yield helpers.openTab(TEST_URI); michael@0: yield helpers.openToolbar(options); michael@0: michael@0: let tiltEnabledOrig = prefBranch.getBoolPref("devtools.tilt.enabled"); michael@0: info("originally: devtools.tilt.enabled = " + tiltEnabledOrig); michael@0: michael@0: yield helpers.audit(options, [ michael@0: { michael@0: setup: 'pref', michael@0: check: { michael@0: input: 'pref', michael@0: hints: ' reset', michael@0: markup: 'IIII', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref s', michael@0: check: { michael@0: input: 'pref s', michael@0: hints: 'et', michael@0: markup: 'IIIIVI', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref sh', michael@0: check: { michael@0: input: 'pref sh', michael@0: hints: 'ow', michael@0: markup: 'IIIIVII', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref show ', michael@0: check: { michael@0: input: 'pref show ', michael@0: markup: 'VVVVVVVVVV', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref show usetexttospeech', michael@0: check: { michael@0: input: 'pref show usetexttospeech', michael@0: hints: ' -> accessibility.usetexttospeech', michael@0: markup: 'VVVVVVVVVVIIIIIIIIIIIIIII', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref show devtools.til', michael@0: check: { michael@0: input: 'pref show devtools.til', michael@0: hints: 't.enabled', michael@0: markup: 'VVVVVVVVVVIIIIIIIIIIII', michael@0: status: 'ERROR', michael@0: tooltipState: 'true:importantFieldFlag', michael@0: args: { michael@0: setting: { value: undefined, status: 'INCOMPLETE' }, michael@0: } michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref reset devtools.tilt.enabled', michael@0: check: { michael@0: input: 'pref reset devtools.tilt.enabled', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', michael@0: status: 'VALID' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref show devtools.tilt.enabled 4', michael@0: check: { michael@0: input: 'pref show devtools.tilt.enabled 4', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref set devtools.tilt.enabled 4', michael@0: check: { michael@0: input: 'pref set devtools.tilt.enabled 4', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE', michael@0: status: 'ERROR', michael@0: args: { michael@0: setting: { arg: ' devtools.tilt.enabled' }, michael@0: value: { status: 'ERROR', message: 'Can\'t use \'4\'.' }, michael@0: } michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref set devtools.editor.tabsize 4', michael@0: check: { michael@0: input: 'pref set devtools.editor.tabsize 4', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', michael@0: status: 'VALID', michael@0: args: { michael@0: setting: { arg: ' devtools.editor.tabsize' }, michael@0: value: { value: 4 }, michael@0: } michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref list', michael@0: check: { michael@0: input: 'pref list', michael@0: hints: ' -> pref set', michael@0: markup: 'IIIIVIIII', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'pref show devtools.tilt.enabled', michael@0: check: { michael@0: args: { michael@0: setting: { value: settings.getSetting("devtools.tilt.enabled") } michael@0: }, michael@0: }, michael@0: exec: { michael@0: output: "devtools.tilt.enabled: " + tiltEnabledOrig, michael@0: }, michael@0: post: function() { michael@0: prefBranch.setBoolPref("devtools.tilt.enabled", tiltEnabledOrig); michael@0: } michael@0: }, michael@0: ]); michael@0: michael@0: yield helpers.closeToolbar(options); michael@0: yield helpers.closeTab(options); michael@0: }