gecko-dev/browser/devtools/commandline/test/browser_cmd_addon.js

152 lines
4.2 KiB
JavaScript
Raw Normal View History

Bug 776875 - GCLI: Move existing GCLI commands into JSMs; r=jwalker --HG-- rename : browser/devtools/commandline/GcliCookieCommands.jsm => browser/devtools/commandline/CmdCookie.jsm rename : browser/devtools/commandline/GcliCommands.jsm => browser/devtools/commandline/Commands.jsm rename : browser/devtools/commandline/gcli.css => browser/devtools/commandline/commandline.css rename : browser/devtools/commandline/gclioutput.xhtml => browser/devtools/commandline/commandlineoutput.xhtml rename : browser/devtools/commandline/gclitooltip.xhtml => browser/devtools/commandline/commandlinetooltip.xhtml rename : browser/devtools/commandline/test/browser_gcli_addon.js => browser/devtools/commandline/test/browser_cmd_addon.js rename : browser/devtools/commandline/test/browser_gcli_calllog.js => browser/devtools/commandline/test/browser_cmd_calllog.js rename : browser/devtools/commandline/test/browser_gcli_commands.js => browser/devtools/commandline/test/browser_cmd_commands.js rename : browser/devtools/commandline/test/browser_gcli_cookie.js => browser/devtools/commandline/test/browser_cmd_cookie.js rename : browser/devtools/commandline/test/browser_gcli_integrate.js => browser/devtools/commandline/test/browser_cmd_integrate.js rename : browser/devtools/commandline/test/browser_gcli_jsb.js => browser/devtools/commandline/test/browser_cmd_jsb.js rename : browser/devtools/commandline/test/resources_jsb_script.js => browser/devtools/commandline/test/browser_cmd_jsb_script.jsi rename : browser/devtools/commandline/test/browser_gcli_inspect.html => browser/devtools/commandline/test/browser_cmd_pagemod_export.html rename : browser/devtools/commandline/test/browser_gcli_pagemod_export.js => browser/devtools/commandline/test/browser_cmd_pagemod_export.js rename : browser/devtools/commandline/test/browser_gcli_pref.js => browser/devtools/commandline/test/browser_cmd_pref.js rename : browser/devtools/commandline/test/browser_gcli_restart.js => browser/devtools/commandline/test/browser_cmd_restart.js rename : browser/devtools/commandline/test/browser_gcli_settings.js => browser/devtools/commandline/test/browser_cmd_settings.js rename : browser/devtools/commandline/test/resources_dbg.html => browser/devtools/commandline/test/browser_dbg_cmd.html rename : browser/devtools/commandline/test/browser_gcli_dbg.js => browser/devtools/commandline/test/browser_dbg_cmd.js rename : browser/devtools/commandline/test/browser_gcli_break.html => browser/devtools/commandline/test/browser_dbg_cmd_break.html rename : browser/devtools/commandline/test/browser_gcli_break.js => browser/devtools/commandline/test/browser_dbg_cmd_break.js rename : browser/devtools/commandline/test/browser_gcli_inspect.html => browser/devtools/highlighter/test/browser_inspector_cmd_inspect.html rename : browser/devtools/commandline/test/browser_gcli_inspect.js => browser/devtools/highlighter/test/browser_inspector_cmd_inspect.js rename : browser/devtools/commandline/test/browser_gcli_responsivemode.js => browser/devtools/responsivedesign/test/browser_responsive_cmd.js rename : browser/devtools/commandline/test/resources.html => browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html rename : browser/devtools/commandline/test/browser_gcli_edit.js => browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js rename : browser/devtools/commandline/test/resources_inpage.js => browser/devtools/styleeditor/test/resources_inpage.jsi rename : browser/devtools/commandline/test/resources_inpage1.css => browser/devtools/styleeditor/test/resources_inpage1.css rename : browser/devtools/commandline/test/resources_inpage2.css => browser/devtools/styleeditor/test/resources_inpage2.css rename : browser/devtools/commandline/GcliTiltCommands.jsm => browser/devtools/tilt/CmdTilt.jsm rename : browser/themes/gnomestripe/devtools/gcli.css => browser/themes/gnomestripe/devtools/commandline.css rename : browser/themes/pinstripe/devtools/gcli.css => browser/themes/pinstripe/devtools/commandline.css rename : browser/themes/winstripe/devtools/gcli.css => browser/themes/winstripe/devtools/commandline.css
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
let CmdAddonFlags = (Cu.import("resource:///modules/devtools/BuiltinCommands.jsm", {})).CmdAddonFlags;
let tests = {};
Bug 776875 - GCLI: Move existing GCLI commands into JSMs; r=jwalker --HG-- rename : browser/devtools/commandline/GcliCookieCommands.jsm => browser/devtools/commandline/CmdCookie.jsm rename : browser/devtools/commandline/GcliCommands.jsm => browser/devtools/commandline/Commands.jsm rename : browser/devtools/commandline/gcli.css => browser/devtools/commandline/commandline.css rename : browser/devtools/commandline/gclioutput.xhtml => browser/devtools/commandline/commandlineoutput.xhtml rename : browser/devtools/commandline/gclitooltip.xhtml => browser/devtools/commandline/commandlinetooltip.xhtml rename : browser/devtools/commandline/test/browser_gcli_addon.js => browser/devtools/commandline/test/browser_cmd_addon.js rename : browser/devtools/commandline/test/browser_gcli_calllog.js => browser/devtools/commandline/test/browser_cmd_calllog.js rename : browser/devtools/commandline/test/browser_gcli_commands.js => browser/devtools/commandline/test/browser_cmd_commands.js rename : browser/devtools/commandline/test/browser_gcli_cookie.js => browser/devtools/commandline/test/browser_cmd_cookie.js rename : browser/devtools/commandline/test/browser_gcli_integrate.js => browser/devtools/commandline/test/browser_cmd_integrate.js rename : browser/devtools/commandline/test/browser_gcli_jsb.js => browser/devtools/commandline/test/browser_cmd_jsb.js rename : browser/devtools/commandline/test/resources_jsb_script.js => browser/devtools/commandline/test/browser_cmd_jsb_script.jsi rename : browser/devtools/commandline/test/browser_gcli_inspect.html => browser/devtools/commandline/test/browser_cmd_pagemod_export.html rename : browser/devtools/commandline/test/browser_gcli_pagemod_export.js => browser/devtools/commandline/test/browser_cmd_pagemod_export.js rename : browser/devtools/commandline/test/browser_gcli_pref.js => browser/devtools/commandline/test/browser_cmd_pref.js rename : browser/devtools/commandline/test/browser_gcli_restart.js => browser/devtools/commandline/test/browser_cmd_restart.js rename : browser/devtools/commandline/test/browser_gcli_settings.js => browser/devtools/commandline/test/browser_cmd_settings.js rename : browser/devtools/commandline/test/resources_dbg.html => browser/devtools/commandline/test/browser_dbg_cmd.html rename : browser/devtools/commandline/test/browser_gcli_dbg.js => browser/devtools/commandline/test/browser_dbg_cmd.js rename : browser/devtools/commandline/test/browser_gcli_break.html => browser/devtools/commandline/test/browser_dbg_cmd_break.html rename : browser/devtools/commandline/test/browser_gcli_break.js => browser/devtools/commandline/test/browser_dbg_cmd_break.js rename : browser/devtools/commandline/test/browser_gcli_inspect.html => browser/devtools/highlighter/test/browser_inspector_cmd_inspect.html rename : browser/devtools/commandline/test/browser_gcli_inspect.js => browser/devtools/highlighter/test/browser_inspector_cmd_inspect.js rename : browser/devtools/commandline/test/browser_gcli_responsivemode.js => browser/devtools/responsivedesign/test/browser_responsive_cmd.js rename : browser/devtools/commandline/test/resources.html => browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html rename : browser/devtools/commandline/test/browser_gcli_edit.js => browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js rename : browser/devtools/commandline/test/resources_inpage.js => browser/devtools/styleeditor/test/resources_inpage.jsi rename : browser/devtools/commandline/test/resources_inpage1.css => browser/devtools/styleeditor/test/resources_inpage1.css rename : browser/devtools/commandline/test/resources_inpage2.css => browser/devtools/styleeditor/test/resources_inpage2.css rename : browser/devtools/commandline/GcliTiltCommands.jsm => browser/devtools/tilt/CmdTilt.jsm rename : browser/themes/gnomestripe/devtools/gcli.css => browser/themes/gnomestripe/devtools/commandline.css rename : browser/themes/pinstripe/devtools/gcli.css => browser/themes/pinstripe/devtools/commandline.css rename : browser/themes/winstripe/devtools/gcli.css => browser/themes/winstripe/devtools/commandline.css
2012-08-14 14:51:48 +00:00
function test() {
helpers.addTabWithToolbar("about:blank", function(options) {
return helpers.runTests(options, tests);
}).then(finish, helpers.handleError);
Bug 776875 - GCLI: Move existing GCLI commands into JSMs; r=jwalker --HG-- rename : browser/devtools/commandline/GcliCookieCommands.jsm => browser/devtools/commandline/CmdCookie.jsm rename : browser/devtools/commandline/GcliCommands.jsm => browser/devtools/commandline/Commands.jsm rename : browser/devtools/commandline/gcli.css => browser/devtools/commandline/commandline.css rename : browser/devtools/commandline/gclioutput.xhtml => browser/devtools/commandline/commandlineoutput.xhtml rename : browser/devtools/commandline/gclitooltip.xhtml => browser/devtools/commandline/commandlinetooltip.xhtml rename : browser/devtools/commandline/test/browser_gcli_addon.js => browser/devtools/commandline/test/browser_cmd_addon.js rename : browser/devtools/commandline/test/browser_gcli_calllog.js => browser/devtools/commandline/test/browser_cmd_calllog.js rename : browser/devtools/commandline/test/browser_gcli_commands.js => browser/devtools/commandline/test/browser_cmd_commands.js rename : browser/devtools/commandline/test/browser_gcli_cookie.js => browser/devtools/commandline/test/browser_cmd_cookie.js rename : browser/devtools/commandline/test/browser_gcli_integrate.js => browser/devtools/commandline/test/browser_cmd_integrate.js rename : browser/devtools/commandline/test/browser_gcli_jsb.js => browser/devtools/commandline/test/browser_cmd_jsb.js rename : browser/devtools/commandline/test/resources_jsb_script.js => browser/devtools/commandline/test/browser_cmd_jsb_script.jsi rename : browser/devtools/commandline/test/browser_gcli_inspect.html => browser/devtools/commandline/test/browser_cmd_pagemod_export.html rename : browser/devtools/commandline/test/browser_gcli_pagemod_export.js => browser/devtools/commandline/test/browser_cmd_pagemod_export.js rename : browser/devtools/commandline/test/browser_gcli_pref.js => browser/devtools/commandline/test/browser_cmd_pref.js rename : browser/devtools/commandline/test/browser_gcli_restart.js => browser/devtools/commandline/test/browser_cmd_restart.js rename : browser/devtools/commandline/test/browser_gcli_settings.js => browser/devtools/commandline/test/browser_cmd_settings.js rename : browser/devtools/commandline/test/resources_dbg.html => browser/devtools/commandline/test/browser_dbg_cmd.html rename : browser/devtools/commandline/test/browser_gcli_dbg.js => browser/devtools/commandline/test/browser_dbg_cmd.js rename : browser/devtools/commandline/test/browser_gcli_break.html => browser/devtools/commandline/test/browser_dbg_cmd_break.html rename : browser/devtools/commandline/test/browser_gcli_break.js => browser/devtools/commandline/test/browser_dbg_cmd_break.js rename : browser/devtools/commandline/test/browser_gcli_inspect.html => browser/devtools/highlighter/test/browser_inspector_cmd_inspect.html rename : browser/devtools/commandline/test/browser_gcli_inspect.js => browser/devtools/highlighter/test/browser_inspector_cmd_inspect.js rename : browser/devtools/commandline/test/browser_gcli_responsivemode.js => browser/devtools/responsivedesign/test/browser_responsive_cmd.js rename : browser/devtools/commandline/test/resources.html => browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html rename : browser/devtools/commandline/test/browser_gcli_edit.js => browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js rename : browser/devtools/commandline/test/resources_inpage.js => browser/devtools/styleeditor/test/resources_inpage.jsi rename : browser/devtools/commandline/test/resources_inpage1.css => browser/devtools/styleeditor/test/resources_inpage1.css rename : browser/devtools/commandline/test/resources_inpage2.css => browser/devtools/styleeditor/test/resources_inpage2.css rename : browser/devtools/commandline/GcliTiltCommands.jsm => browser/devtools/tilt/CmdTilt.jsm rename : browser/themes/gnomestripe/devtools/gcli.css => browser/themes/gnomestripe/devtools/commandline.css rename : browser/themes/pinstripe/devtools/gcli.css => browser/themes/pinstripe/devtools/commandline.css rename : browser/themes/winstripe/devtools/gcli.css => browser/themes/winstripe/devtools/commandline.css
2012-08-14 14:51:48 +00:00
}
tests.gatTest = function(options) {
let deferred = promise.defer();
let onGatReady = function() {
Services.obs.removeObserver(onGatReady, "gcli_addon_commands_ready");
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'
},
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' },
name: { value: 'Test Plug-in', status: 'VALID' },
}
},
exec: {
output: 'Test Plug-in 1.0.0.0 enabled.'
}
}
]);
auditDone.then(deferred.resolve, deferred.reject);
};
Services.obs.addObserver(onGatReady, "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;
};