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);
|
|
|
|
}).then(finish);
|
2012-08-14 14:51:48 +00:00
|
|
|
}
|
|
|
|
|
2013-03-13 04:51:30 +00:00
|
|
|
tests.gatTest = function(options) {
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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
|
|
|
|
}
|
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-03-13 04:51:30 +00:00
|
|
|
auditDone.then(function() {
|
|
|
|
deferred.resolve();
|
|
|
|
});
|
|
|
|
};
|
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;
|
|
|
|
};
|