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.

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

mercurial