gecko-dev/browser/devtools/commandline/test/browser_cmd_addon.js
Joe Walker 344fe4e6ea Bug 685526 - GCLI should allow basic async types; r=dcamp,past,harthur,mratcliffe
--HG--
rename : browser/devtools/commandline/test/browser_dbg_cmd.html => browser/devtools/debugger/test/browser_dbg_cmd.html
rename : browser/devtools/commandline/test/browser_dbg_cmd.js => browser/devtools/debugger/test/browser_dbg_cmd.js
rename : browser/devtools/commandline/test/browser_dbg_cmd_break.html => browser/devtools/debugger/test/browser_dbg_cmd_break.html
rename : browser/devtools/commandline/test/browser_dbg_cmd_break.js => browser/devtools/debugger/test/browser_dbg_cmd_break.js
2013-03-13 04:51:30 +00:00

137 lines
3.7 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
let CmdAddonFlags = (Cu.import("resource:///modules/devtools/BuiltinCommands.jsm", {})).CmdAddonFlags;
let tests = {};
function test() {
helpers.addTabWithToolbar("about:blank", function(options) {
return helpers.runTests(options, tests);
}).then(finish);
}
tests.gatTest = function(options) {
let deferred = Promise.defer();
// hack to reduce stack size as a result of bug 842347
let onGatReadyInterjection = function() {
executeSoon(onGatReady);
};
let onGatReady = function() {
Services.obs.removeObserver(onGatReadyInterjection, "gcli_addon_commands_ready", false);
info("gcli_addon_commands_ready notification received, running tests");
let auditDone = helpers.audit(options, [
{
setup: 'addon list dictionary',
check: {
input: 'addon list dictionary',
hints: '',
markup: 'VVVVVVVVVVVVVVVVVVVVV',
status: 'VALID'
}
},
{
setup: 'addon list extension',
check: {
input: 'addon list extension',
hints: '',
markup: 'VVVVVVVVVVVVVVVVVVVV',
status: 'VALID'
}
},
{
setup: 'addon list locale',
check: {
input: 'addon list locale',
hints: '',
markup: 'VVVVVVVVVVVVVVVVV',
status: 'VALID'
}
},
{
setup: 'addon list plugin',
check: {
input: 'addon list plugin',
hints: '',
markup: 'VVVVVVVVVVVVVVVVV',
status: 'VALID'
}
},
{
setup: 'addon list theme',
check: {
input: 'addon list theme',
hints: '',
markup: 'VVVVVVVVVVVVVVVV',
status: 'VALID'
}
},
{
setup: 'addon list all',
check: {
input: 'addon list all',
hints: '',
markup: 'VVVVVVVVVVVVVV',
status: 'VALID'
}
},
{
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'
}
},
{
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' },
name: { value: 'Test Plug-in', status: 'VALID' },
}
},
exec: {
completed: false
}
}
]);
auditDone.then(function() {
deferred.resolve();
});
};
Services.obs.addObserver(onGatReadyInterjection, "gcli_addon_commands_ready", false);
if (CmdAddonFlags.addonsLoaded) {
info("The call to AddonManager.getAllAddons in BuiltinCommands.jsm is done.");
info("Send the gcli_addon_commands_ready notification ourselves.");
Services.obs.notifyObservers(null, "gcli_addon_commands_ready", null);
} else {
info("Waiting for gcli_addon_commands_ready notification.");
}
return deferred.promise;
};