2012-08-14 14:51:48 +00:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
// Tests that the addon commands works as they should
|
|
|
|
|
2013-03-13 04:51:30 +00:00
|
|
|
let CmdAddonFlags = (Cu.import("resource:///modules/devtools/BuiltinCommands.jsm", {})).CmdAddonFlags;
|
|
|
|
|
|
|
|
let tests = {};
|
2012-09-04 11:43:58 +00:00
|
|
|
|
2012-08-14 14:51:48 +00:00
|
|
|
function test() {
|
2013-03-13 04:51:30 +00:00
|
|
|
helpers.addTabWithToolbar("about:blank", function(options) {
|
|
|
|
return helpers.runTests(options, tests);
|
2013-09-03 11:20:27 +00:00
|
|
|
}).then(finish, helpers.handleError);
|
2012-08-14 14:51:48 +00:00
|
|
|
}
|
|
|
|
|
2013-03-13 04:51:30 +00:00
|
|
|
tests.gatTest = function(options) {
|
2013-07-11 07:12:20 +00:00
|
|
|
let deferred = promise.defer();
|
2012-08-24 15:04:45 +00:00
|
|
|
|
2013-03-13 04:51:30 +00:00
|
|
|
let onGatReady = function() {
|
2013-05-09 14:15:23 +00:00
|
|
|
Services.obs.removeObserver(onGatReady, "gcli_addon_commands_ready");
|
2013-03-13 04:51:30 +00:00
|
|
|
info("gcli_addon_commands_ready notification received, running tests");
|
2012-08-24 15:04:45 +00:00
|
|
|
|
2013-03-13 04:51:30 +00:00
|
|
|
let auditDone = helpers.audit(options, [
|
|
|
|
{
|
|
|
|
setup: 'addon list dictionary',
|
|
|
|
check: {
|
|
|
|
input: 'addon list dictionary',
|
|
|
|
hints: '',
|
|
|
|
markup: 'VVVVVVVVVVVVVVVVVVVVV',
|
|
|
|
status: 'VALID'
|
2013-05-28 13:05:28 +00:00
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
output: 'There are no add-ons of that type installed.'
|
2013-03-13 04:51:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: 'addon list extension',
|
|
|
|
check: {
|
|
|
|
input: 'addon list extension',
|
|
|
|
hints: '',
|
|
|
|
markup: 'VVVVVVVVVVVVVVVVVVVV',
|
|
|
|
status: 'VALID'
|
2013-05-28 13:05:28 +00:00
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
output: [/The following/, /Mochitest/, /Special Powers/]
|
2013-03-13 04:51:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: 'addon list locale',
|
|
|
|
check: {
|
|
|
|
input: 'addon list locale',
|
|
|
|
hints: '',
|
|
|
|
markup: 'VVVVVVVVVVVVVVVVV',
|
|
|
|
status: 'VALID'
|
2013-05-28 13:05:28 +00:00
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
output: 'There are no add-ons of that type installed.'
|
2013-03-13 04:51:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: 'addon list plugin',
|
|
|
|
check: {
|
|
|
|
input: 'addon list plugin',
|
|
|
|
hints: '',
|
|
|
|
markup: 'VVVVVVVVVVVVVVVVV',
|
|
|
|
status: 'VALID'
|
2013-05-28 13:05:28 +00:00
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
output: [/Test Plug-in/, /Second Test Plug-in/]
|
2013-03-13 04:51:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: 'addon list theme',
|
|
|
|
check: {
|
|
|
|
input: 'addon list theme',
|
|
|
|
hints: '',
|
|
|
|
markup: 'VVVVVVVVVVVVVVVV',
|
|
|
|
status: 'VALID'
|
2013-05-28 13:05:28 +00:00
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
output: [/following themes/, /Default/]
|
2013-03-13 04:51:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: 'addon list all',
|
|
|
|
check: {
|
|
|
|
input: 'addon list all',
|
|
|
|
hints: '',
|
|
|
|
markup: 'VVVVVVVVVVVVVV',
|
|
|
|
status: 'VALID'
|
2013-05-28 13:05:28 +00:00
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
output: [/The following/, /Default/, /Mochitest/, /Test Plug-in/,
|
|
|
|
/Second Test Plug-in/, /Special Powers/]
|
2013-03-13 04:51:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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'
|
2013-05-28 13:05:28 +00:00
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
output: 'Test Plug-in 1.0.0.0 disabled.'
|
2013-03-13 04:51:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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: {
|
2013-05-28 13:05:28 +00:00
|
|
|
output: 'Test Plug-in 1.0.0.0 enabled.'
|
2013-03-13 04:51:30 +00:00
|
|
|
}
|
2012-08-24 15:04:45 +00:00
|
|
|
}
|
2013-03-13 04:51:30 +00:00
|
|
|
]);
|
2012-08-24 15:04:45 +00:00
|
|
|
|
2013-09-03 11:20:27 +00:00
|
|
|
auditDone.then(deferred.resolve, deferred.reject);
|
2013-03-13 04:51:30 +00:00
|
|
|
};
|
2012-08-24 15:04:45 +00:00
|
|
|
|
2013-05-09 14:15:23 +00:00
|
|
|
Services.obs.addObserver(onGatReady, "gcli_addon_commands_ready", false);
|
2012-09-04 11:43:58 +00:00
|
|
|
|
2013-03-13 04:51:30 +00:00
|
|
|
if (CmdAddonFlags.addonsLoaded) {
|
|
|
|
info("The call to AddonManager.getAllAddons in BuiltinCommands.jsm is done.");
|
|
|
|
info("Send the gcli_addon_commands_ready notification ourselves.");
|
2012-09-04 11:43:58 +00:00
|
|
|
|
|
|
|
Services.obs.notifyObservers(null, "gcli_addon_commands_ready", null);
|
|
|
|
} else {
|
2013-03-13 04:51:30 +00:00
|
|
|
info("Waiting for gcli_addon_commands_ready notification.");
|
2012-09-04 11:43:58 +00:00
|
|
|
}
|
2013-03-13 04:51:30 +00:00
|
|
|
|
|
|
|
return deferred.promise;
|
|
|
|
};
|