browser/devtools/commandline/test/browser_cmd_cookie.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 // Tests that the cookie commands works as they should
michael@0 5
michael@0 6 const TEST_URI = "http://example.com/browser/browser/devtools/commandline/"+
michael@0 7 "test/browser_cmd_cookie.html";
michael@0 8
michael@0 9 function test() {
michael@0 10 helpers.addTabWithToolbar(TEST_URI, function(options) {
michael@0 11 return helpers.audit(options, [
michael@0 12 {
michael@0 13 setup: 'cookie',
michael@0 14 check: {
michael@0 15 input: 'cookie',
michael@0 16 hints: ' list',
michael@0 17 markup: 'IIIIII',
michael@0 18 status: 'ERROR'
michael@0 19 },
michael@0 20 },
michael@0 21 {
michael@0 22 setup: 'cookie lis',
michael@0 23 check: {
michael@0 24 input: 'cookie lis',
michael@0 25 hints: 't',
michael@0 26 markup: 'IIIIIIVIII',
michael@0 27 status: 'ERROR'
michael@0 28 },
michael@0 29 },
michael@0 30 {
michael@0 31 setup: 'cookie list',
michael@0 32 check: {
michael@0 33 input: 'cookie list',
michael@0 34 hints: '',
michael@0 35 markup: 'VVVVVVVVVVV',
michael@0 36 status: 'VALID'
michael@0 37 },
michael@0 38 },
michael@0 39 {
michael@0 40 setup: 'cookie remove',
michael@0 41 check: {
michael@0 42 input: 'cookie remove',
michael@0 43 hints: ' <name>',
michael@0 44 markup: 'VVVVVVVVVVVVV',
michael@0 45 status: 'ERROR'
michael@0 46 },
michael@0 47 },
michael@0 48 {
michael@0 49 setup: 'cookie set',
michael@0 50 check: {
michael@0 51 input: 'cookie set',
michael@0 52 hints: ' <name> <value> [options]',
michael@0 53 markup: 'VVVVVVVVVV',
michael@0 54 status: 'ERROR'
michael@0 55 },
michael@0 56 },
michael@0 57 {
michael@0 58 setup: 'cookie set fruit',
michael@0 59 check: {
michael@0 60 input: 'cookie set fruit',
michael@0 61 hints: ' <value> [options]',
michael@0 62 markup: 'VVVVVVVVVVVVVVVV',
michael@0 63 status: 'ERROR'
michael@0 64 },
michael@0 65 },
michael@0 66 {
michael@0 67 setup: 'cookie set fruit ban',
michael@0 68 check: {
michael@0 69 input: 'cookie set fruit ban',
michael@0 70 hints: ' [options]',
michael@0 71 markup: 'VVVVVVVVVVVVVVVVVVVV',
michael@0 72 status: 'VALID',
michael@0 73 args: {
michael@0 74 name: { value: 'fruit' },
michael@0 75 value: { value: 'ban' },
michael@0 76 secure: { value: false },
michael@0 77 }
michael@0 78 },
michael@0 79 },
michael@0 80 {
michael@0 81 setup: 'cookie set fruit ban --path ""',
michael@0 82 check: {
michael@0 83 input: 'cookie set fruit ban --path ""',
michael@0 84 hints: ' [options]',
michael@0 85 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
michael@0 86 status: 'VALID',
michael@0 87 args: {
michael@0 88 name: { value: 'fruit' },
michael@0 89 value: { value: 'ban' },
michael@0 90 path: { value: '' },
michael@0 91 secure: { value: false },
michael@0 92 }
michael@0 93 },
michael@0 94 },
michael@0 95 {
michael@0 96 setup: "cookie list",
michael@0 97 exec: {
michael@0 98 output: [ /zap=zep/, /zip=zop/, /Edit/ ]
michael@0 99 }
michael@0 100 },
michael@0 101 {
michael@0 102 setup: "cookie set zup banana",
michael@0 103 check: {
michael@0 104 args: {
michael@0 105 name: { value: 'zup' },
michael@0 106 value: { value: 'banana' },
michael@0 107 }
michael@0 108 },
michael@0 109 exec: {
michael@0 110 output: ""
michael@0 111 }
michael@0 112 },
michael@0 113 {
michael@0 114 setup: "cookie list",
michael@0 115 exec: {
michael@0 116 output: [ /zap=zep/, /zip=zop/, /zup=banana/, /Edit/ ]
michael@0 117 }
michael@0 118 },
michael@0 119 {
michael@0 120 setup: "cookie remove zip",
michael@0 121 exec: { },
michael@0 122 },
michael@0 123 {
michael@0 124 setup: "cookie list",
michael@0 125 exec: {
michael@0 126 output: [ /zap=zep/, /zup=banana/, /Edit/ ]
michael@0 127 },
michael@0 128 post: function(output, text) {
michael@0 129 ok(!text.contains("zip"), "");
michael@0 130 ok(!text.contains("zop"), "");
michael@0 131 }
michael@0 132 },
michael@0 133 {
michael@0 134 setup: "cookie remove zap",
michael@0 135 exec: { },
michael@0 136 },
michael@0 137 {
michael@0 138 setup: "cookie list",
michael@0 139 exec: {
michael@0 140 output: [ /zup=banana/, /Edit/ ]
michael@0 141 },
michael@0 142 post: function(output, text) {
michael@0 143 ok(!text.contains("zap"), "");
michael@0 144 ok(!text.contains("zep"), "");
michael@0 145 ok(!text.contains("zip"), "");
michael@0 146 ok(!text.contains("zop"), "");
michael@0 147 }
michael@0 148 },
michael@0 149 {
michael@0 150 setup: "cookie remove zup",
michael@0 151 exec: { }
michael@0 152 },
michael@0 153 {
michael@0 154 setup: "cookie list",
michael@0 155 exec: {
michael@0 156 output: 'No cookies found for host example.com'
michael@0 157 },
michael@0 158 post: function(output, text) {
michael@0 159 ok(!text.contains("zap"), "");
michael@0 160 ok(!text.contains("zep"), "");
michael@0 161 ok(!text.contains("zip"), "");
michael@0 162 ok(!text.contains("zop"), "");
michael@0 163 ok(!text.contains("zup"), "");
michael@0 164 ok(!text.contains("banana"), "");
michael@0 165 ok(!text.contains("Edit"), "");
michael@0 166 }
michael@0 167 },
michael@0 168 ]);
michael@0 169 }).then(finish, helpers.handleError);
michael@0 170 }

mercurial