tor-browser

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

test_history.js (2845B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 EnableEngines(["history"]);
      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 = { phase1: "profile1", phase2: "profile2" };
     12 
     13 /*
     14 * History asset lists: these define history entries that are used during
     15 * the test
     16 */
     17 
     18 // the initial list of history items to add to the browser
     19 var history1 = [
     20  {
     21    uri: "http://www.google.com/",
     22    title: "Google",
     23    visits: [
     24      { type: 1, date: 0 },
     25      { type: 2, date: -1 },
     26    ],
     27  },
     28  {
     29    uri: "http://www.cnn.com/",
     30    title: "CNN",
     31    visits: [
     32      { type: 1, date: -1 },
     33      { type: 2, date: -36 },
     34    ],
     35  },
     36  {
     37    uri: "http://www.google.com/language_tools?hl=en",
     38    title: "Language Tools",
     39    visits: [
     40      { type: 1, date: 0 },
     41      { type: 2, date: -40 },
     42    ],
     43  },
     44  {
     45    uri: "http://www.mozilla.com/",
     46    title: "Mozilla",
     47    visits: [
     48      { type: 1, date: 0 },
     49      { type: 1, date: -1 },
     50      { type: 1, date: -20 },
     51      { type: 2, date: -36 },
     52    ],
     53  },
     54 ];
     55 
     56 // a list of items to delete from the history
     57 var history_to_delete = [
     58  { uri: "http://www.cnn.com/" },
     59  { begin: -24, end: -1 },
     60  { host: "www.google.com" },
     61 ];
     62 
     63 // a list which reflects items that should be in the history after
     64 // the above items are deleted
     65 var history2 = [
     66  {
     67    uri: "http://www.mozilla.com/",
     68    title: "Mozilla",
     69    visits: [
     70      { type: 1, date: 0 },
     71      { type: 2, date: -36 },
     72    ],
     73  },
     74 ];
     75 
     76 // a list which includes history entries that should not be present
     77 // after deletion of the history_to_delete entries
     78 var history_not = [
     79  {
     80    uri: "http://www.google.com/",
     81    title: "Google",
     82    visits: [
     83      { type: 1, date: 0 },
     84      { type: 2, date: -1 },
     85    ],
     86  },
     87  {
     88    uri: "http://www.cnn.com/",
     89    title: "CNN",
     90    visits: [
     91      { type: 1, date: -1 },
     92      { type: 2, date: -36 },
     93    ],
     94  },
     95  {
     96    uri: "http://www.google.com/language_tools?hl=en",
     97    title: "Language Tools",
     98    visits: [
     99      { type: 1, date: 0 },
    100      { type: 2, date: -40 },
    101    ],
    102  },
    103  {
    104    uri: "http://www.mozilla.com/",
    105    title: "Mozilla",
    106    visits: [
    107      { type: 1, date: -1 },
    108      { type: 1, date: -20 },
    109    ],
    110  },
    111 ];
    112 
    113 /*
    114 * Test phases
    115 * Note:  there is no test phase in which deleted history entries are
    116 * synced to other clients.  This functionality is not supported by
    117 * Sync, see bug 446517.
    118 */
    119 
    120 Phase("phase1", [[History.add, history1], [Sync]]);
    121 
    122 Phase("phase2", [
    123  [Sync],
    124  [History.verify, history1],
    125  [History.delete, history_to_delete],
    126  [History.verify, history2],
    127  [History.verifyNot, history_not],
    128  [Sync],
    129 ]);