michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // Tests that the cookie commands works as they should michael@0: michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/commandline/"+ michael@0: "test/browser_cmd_cookie.html"; michael@0: michael@0: function test() { michael@0: helpers.addTabWithToolbar(TEST_URI, function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: 'cookie', michael@0: check: { michael@0: input: 'cookie', michael@0: hints: ' list', michael@0: markup: 'IIIIII', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'cookie lis', michael@0: check: { michael@0: input: 'cookie lis', michael@0: hints: 't', michael@0: markup: 'IIIIIIVIII', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'cookie list', michael@0: check: { michael@0: input: 'cookie list', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVV', michael@0: status: 'VALID' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'cookie remove', michael@0: check: { michael@0: input: 'cookie remove', michael@0: hints: ' ', michael@0: markup: 'VVVVVVVVVVVVV', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'cookie set', michael@0: check: { michael@0: input: 'cookie set', michael@0: hints: ' [options]', michael@0: markup: 'VVVVVVVVVV', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'cookie set fruit', michael@0: check: { michael@0: input: 'cookie set fruit', michael@0: hints: ' [options]', michael@0: markup: 'VVVVVVVVVVVVVVVV', michael@0: status: 'ERROR' michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'cookie set fruit ban', michael@0: check: { michael@0: input: 'cookie set fruit ban', michael@0: hints: ' [options]', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVV', michael@0: status: 'VALID', michael@0: args: { michael@0: name: { value: 'fruit' }, michael@0: value: { value: 'ban' }, michael@0: secure: { value: false }, michael@0: } michael@0: }, michael@0: }, michael@0: { michael@0: setup: 'cookie set fruit ban --path ""', michael@0: check: { michael@0: input: 'cookie set fruit ban --path ""', michael@0: hints: ' [options]', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', michael@0: status: 'VALID', michael@0: args: { michael@0: name: { value: 'fruit' }, michael@0: value: { value: 'ban' }, michael@0: path: { value: '' }, michael@0: secure: { value: false }, michael@0: } michael@0: }, michael@0: }, michael@0: { michael@0: setup: "cookie list", michael@0: exec: { michael@0: output: [ /zap=zep/, /zip=zop/, /Edit/ ] michael@0: } michael@0: }, michael@0: { michael@0: setup: "cookie set zup banana", michael@0: check: { michael@0: args: { michael@0: name: { value: 'zup' }, michael@0: value: { value: 'banana' }, michael@0: } michael@0: }, michael@0: exec: { michael@0: output: "" michael@0: } michael@0: }, michael@0: { michael@0: setup: "cookie list", michael@0: exec: { michael@0: output: [ /zap=zep/, /zip=zop/, /zup=banana/, /Edit/ ] michael@0: } michael@0: }, michael@0: { michael@0: setup: "cookie remove zip", michael@0: exec: { }, michael@0: }, michael@0: { michael@0: setup: "cookie list", michael@0: exec: { michael@0: output: [ /zap=zep/, /zup=banana/, /Edit/ ] michael@0: }, michael@0: post: function(output, text) { michael@0: ok(!text.contains("zip"), ""); michael@0: ok(!text.contains("zop"), ""); michael@0: } michael@0: }, michael@0: { michael@0: setup: "cookie remove zap", michael@0: exec: { }, michael@0: }, michael@0: { michael@0: setup: "cookie list", michael@0: exec: { michael@0: output: [ /zup=banana/, /Edit/ ] michael@0: }, michael@0: post: function(output, text) { michael@0: ok(!text.contains("zap"), ""); michael@0: ok(!text.contains("zep"), ""); michael@0: ok(!text.contains("zip"), ""); michael@0: ok(!text.contains("zop"), ""); michael@0: } michael@0: }, michael@0: { michael@0: setup: "cookie remove zup", michael@0: exec: { } michael@0: }, michael@0: { michael@0: setup: "cookie list", michael@0: exec: { michael@0: output: 'No cookies found for host example.com' michael@0: }, michael@0: post: function(output, text) { michael@0: ok(!text.contains("zap"), ""); michael@0: ok(!text.contains("zep"), ""); michael@0: ok(!text.contains("zip"), ""); michael@0: ok(!text.contains("zop"), ""); michael@0: ok(!text.contains("zup"), ""); michael@0: ok(!text.contains("banana"), ""); michael@0: ok(!text.contains("Edit"), ""); michael@0: } michael@0: }, michael@0: ]); michael@0: }).then(finish, helpers.handleError); michael@0: }