tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_extstorage.js (2412B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 EnableEngines(["addons"]);
      5 
      6 /*
      7 * The list of phases mapped to their corresponding profiles.  The object
      8 * here must be in JSON format as it will get parsed by the Python
      9 * testrunner. It is parsed by the YAML package, so it relatively flexible.
     10 */
     11 var phases = {
     12  phase1: "profile1",
     13  phase2: "profile2",
     14  phase3: "profile1",
     15  phase4: "profile2",
     16  phase5: "profile1",
     17 };
     18 
     19 /*
     20 * Test phases
     21 */
     22 
     23 Phase("phase1", [
     24  [
     25    ExtStorage.set,
     26    "ext-1",
     27    {
     28      "key-1": {
     29        sub_key_1: "value 1",
     30        sub_key_2: "value 2",
     31      },
     32      "key-2": {
     33        sk_1: "v1",
     34        sk_2: "v2",
     35      },
     36    },
     37  ],
     38  [
     39    ExtStorage.verify,
     40    "ext-1",
     41    null,
     42    {
     43      "key-1": {
     44        sub_key_1: "value 1",
     45        sub_key_2: "value 2",
     46      },
     47      "key-2": {
     48        sk_1: "v1",
     49        sk_2: "v2",
     50      },
     51    },
     52  ],
     53  [Sync],
     54 ]);
     55 
     56 Phase("phase2", [
     57  [Sync],
     58  [
     59    ExtStorage.set,
     60    "ext-1",
     61    {
     62      "key-2": "value from profile 2",
     63    },
     64  ],
     65  [
     66    ExtStorage.verify,
     67    "ext-1",
     68    null,
     69    {
     70      "key-1": {
     71        sub_key_1: "value 1",
     72        sub_key_2: "value 2",
     73      },
     74      "key-2": "value from profile 2",
     75    },
     76  ],
     77  [Sync],
     78 ]);
     79 
     80 Phase("phase3", [
     81  [Sync],
     82  [
     83    ExtStorage.verify,
     84    "ext-1",
     85    null,
     86    {
     87      "key-1": {
     88        sub_key_1: "value 1",
     89        sub_key_2: "value 2",
     90      },
     91      "key-2": "value from profile 2",
     92    },
     93  ],
     94  [
     95    ExtStorage.set,
     96    "ext-1",
     97    {
     98      "key-2": "value from profile 1",
     99    },
    100  ],
    101  // exit without syncing.
    102 ]);
    103 
    104 Phase("phase4", [
    105  [Sync],
    106  [
    107    ExtStorage.verify,
    108    "ext-1",
    109    null,
    110    {
    111      "key-1": {
    112        sub_key_1: "value 1",
    113        sub_key_2: "value 2",
    114      },
    115      "key-2": "value from profile 2",
    116    },
    117  ],
    118  [
    119    ExtStorage.set,
    120    "ext-1",
    121    {
    122      "key-2": "second value from profile 2",
    123    },
    124  ],
    125  [Sync],
    126 ]);
    127 
    128 Phase("phase5", [
    129  [
    130    ExtStorage.verify,
    131    "ext-1",
    132    null,
    133    {
    134      "key-1": {
    135        sub_key_1: "value 1",
    136        sub_key_2: "value 2",
    137      },
    138      "key-2": "value from profile 1",
    139    },
    140  ],
    141  [Sync],
    142  [
    143    ExtStorage.verify,
    144    "ext-1",
    145    null,
    146    {
    147      "key-1": {
    148        sub_key_1: "value 1",
    149        sub_key_2: "value 2",
    150      },
    151      "key-2": "second value from profile 2",
    152    },
    153  ],
    154 ]);