gecko/browser/devtools/commandline/test/browser_gcli_integrate.js
Michael Ratcliffe bc1448c41d Bug 777355 - Move Console.jsm somewhere into toolkit to fix comm-central's busted XPCShell tests.; r=rcampbell
--HG--
rename : browser/devtools/shared/Console.jsm => toolkit/devtools/Console.jsm
2012-07-25 18:34:34 +01:00

52 lines
1.4 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that source URLs in the Web Console can be clicked to display the
// standard View Source window.
function test() {
testCreateCommands();
testRemoveCommands();
}
let [ define, require ] = (function() {
let tempScope = {};
Components.utils.import("resource://gre/modules/devtools/Require.jsm", tempScope);
return [ tempScope.define, tempScope.require ];
})();
registerCleanupFunction(function tearDown() {
define = undefined;
require = undefined;
});
let tselarr = {
name: 'tselarr',
params: [
{ name: 'num', type: { name: 'selection', data: [ '1', '2', '3' ] } },
{ name: 'arr', type: { name: 'array', subtype: 'string' } },
],
exec: function(args, env) {
return "flu " + args.num + "-" + args.arr.join("_");
}
};
function testCreateCommands() {
let gcliIndex = require("gcli/index");
gcliIndex.addCommand(tselarr);
let canon = require("gcli/canon");
let tselcmd = canon.getCommand("tselarr");
ok(tselcmd != null, "tselarr exists in the canon");
ok(tselcmd instanceof canon.Command, "canon storing commands");
}
function testRemoveCommands() {
let gcliIndex = require("gcli/index");
gcliIndex.removeCommand(tselarr);
let canon = require("gcli/canon");
let tselcmd = canon.getCommand("tselarr");
ok(tselcmd == null, "tselcmd removed from the canon");
}