gecko/browser/devtools/commandline/test/browser_cmd_cookie.js
Joe Walker 1eb830ff5a Bug 773565 - GCLI Autocomplete goes wild when boolean params are used in a group; r=dcamp
--HG--
rename : browser/devtools/highlighter/test/helper.js => browser/devtools/highlighter/test/helpers.js
rename : browser/devtools/responsivedesign/test/helper.js => browser/devtools/responsivedesign/test/helpers.js
rename : browser/devtools/shared/test/helper.js => browser/devtools/shared/test/helpers.js
rename : browser/devtools/styleeditor/test/helper.js => browser/devtools/styleeditor/test/helpers.js
2012-08-24 16:04:45 +01:00

99 lines
2.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the cookie commands works as they should
const TEST_URI = "data:text/html;charset=utf-8,gcli-cookie";
function test() {
DeveloperToolbarTest.test(TEST_URI, [ testCookieCheck, testCookieExec ]);
}
function testCookieCheck() {
helpers.setInput('cookie');
helpers.check({
input: 'cookie',
hints: '',
markup: 'IIIIII',
status: 'ERROR'
});
helpers.setInput('cookie lis');
helpers.check({
input: 'cookie lis',
hints: 't',
markup: 'IIIIIIVIII',
status: 'ERROR'
});
helpers.setInput('cookie list');
helpers.check({
input: 'cookie list',
hints: '',
markup: 'VVVVVVVVVVV',
status: 'VALID'
});
helpers.setInput('cookie remove');
helpers.check({
input: 'cookie remove',
hints: ' <key>',
markup: 'VVVVVVVVVVVVV',
status: 'ERROR'
});
helpers.setInput('cookie set');
helpers.check({
input: 'cookie set',
hints: ' <key> <value> [options]',
markup: 'VVVVVVVVVV',
status: 'ERROR'
});
helpers.setInput('cookie set fruit');
helpers.check({
input: 'cookie set fruit',
hints: ' <value> [options]',
markup: 'VVVVVVVVVVVVVVVV',
status: 'ERROR'
});
helpers.setInput('cookie set fruit ban');
helpers.check({
input: 'cookie set fruit ban',
hints: ' [options]',
markup: 'VVVVVVVVVVVVVVVVVVVV',
status: 'VALID',
args: {
key: { value: 'fruit' },
value: { value: 'ban' },
secure: { value: false },
}
});
}
function testCookieExec() {
DeveloperToolbarTest.exec({
typed: "cookie set fruit banana",
args: {
key: "fruit",
value: "banana",
path: "/",
domain: null,
secure: false
},
blankOutput: true,
});
DeveloperToolbarTest.exec({
typed: "cookie list",
outputMatch: /Key/
});
DeveloperToolbarTest.exec({
typed: "cookie remove fruit",
args: { key: "fruit" },
blankOutput: true,
});
}