gecko/browser/devtools/commandline/test/browser_cmd_addon.js
Joe Walker ffa9c6e99c Bug 984365 - Refactor and split out BuiltinCommands.jsm; r=mratcliffe,robcee,panos
BuiltinCommands.jsm was huge to avoid slowing things down by having many
modules loading.

To avoid splitting it up from slowing things down we want to delay loading
commands. Create [add|remove]ItemsByModule to allow us to lazily add modules,
and convert all command modules to use this.

Then break up BuiltinCommands into a set of files, for each command, and do
some refactoring to use JS files rather than JSMs and use "use strict".

--HG--
rename : browser/devtools/commandline/Commands.jsm => browser/devtools/commandline/commands-index.js
rename : browser/devtools/debugger/CmdDebugger.jsm => browser/devtools/debugger/debugger-commands.js
rename : browser/devtools/inspector/CmdInspect.jsm => browser/devtools/inspector/inspector-commands.js
rename : browser/devtools/responsivedesign/CmdResize.jsm => browser/devtools/responsivedesign/resize-commands.js
rename : browser/devtools/scratchpad/CmdScratchpad.jsm => browser/devtools/scratchpad/scratchpad-commands.js
rename : browser/devtools/styleeditor/CmdEdit.jsm => browser/devtools/styleeditor/styleeditor-commands.js
rename : browser/devtools/tilt/CmdTilt.jsm => browser/devtools/tilt/tilt-commands.js
2014-04-13 07:47:27 +01:00

135 lines
3.4 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the addon commands works as they should
function test() {
return Task.spawn(spawnTest).then(finish, helpers.handleError);
}
function spawnTest() {
let options = yield helpers.openTab("about:blank");
yield helpers.openToolbar(options);
yield helpers.audit(options, [
{
setup: 'addon list dictionary',
check: {
input: 'addon list dictionary',
hints: '',
markup: 'VVVVVVVVVVVVVVVVVVVVV',
status: 'VALID'
},
exec: {
output: 'There are no add-ons of that type installed.'
}
},
{
setup: 'addon list extension',
check: {
input: 'addon list extension',
hints: '',
markup: 'VVVVVVVVVVVVVVVVVVVV',
status: 'VALID'
},
exec: {
output: [/The following/, /Mochitest/, /Special Powers/]
}
},
{
setup: 'addon list locale',
check: {
input: 'addon list locale',
hints: '',
markup: 'VVVVVVVVVVVVVVVVV',
status: 'VALID'
},
exec: {
output: 'There are no add-ons of that type installed.'
}
},
{
setup: 'addon list plugin',
check: {
input: 'addon list plugin',
hints: '',
markup: 'VVVVVVVVVVVVVVVVV',
status: 'VALID'
},
exec: {
output: [/Test Plug-in/, /Second Test Plug-in/]
}
},
{
setup: 'addon list theme',
check: {
input: 'addon list theme',
hints: '',
markup: 'VVVVVVVVVVVVVVVV',
status: 'VALID'
},
exec: {
output: [/following themes/, /Default/]
}
},
{
setup: 'addon list all',
check: {
input: 'addon list all',
hints: '',
markup: 'VVVVVVVVVVVVVV',
status: 'VALID'
},
exec: {
output: [/The following/, /Default/, /Mochitest/, /Test Plug-in/,
/Second Test Plug-in/, /Special Powers/]
}
},
{
setup: 'addon disable Test_Plug-in_1.0.0.0',
check: {
input: 'addon disable Test_Plug-in_1.0.0.0',
hints: '',
markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
status: 'VALID'
},
exec: {
output: 'Test Plug-in 1.0.0.0 disabled.'
}
},
{
setup: 'addon disable WRONG',
check: {
input: 'addon disable WRONG',
hints: '',
markup: 'VVVVVVVVVVVVVVEEEEE',
status: 'ERROR'
}
},
{
setup: 'addon enable Test_Plug-in_1.0.0.0',
check: {
input: 'addon enable Test_Plug-in_1.0.0.0',
hints: '',
markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
status: 'VALID',
args: {
command: { name: 'addon enable' },
addon: {
value: function(addon) {
is(addon.name, 'Test Plug-in', 'test plugin name');
},
status: 'VALID'
}
}
},
exec: {
output: 'Test Plug-in 1.0.0.0 enabled.'
}
}
]);
yield helpers.closeToolbar(options);
yield helpers.closeTab(options);
}