services/sync/tests/tps/test_history.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 /*
     5  * The list of phases mapped to their corresponding profiles.  The object
     6  * here must be in strict JSON format, as it will get parsed by the Python
     7  * testrunner (no single quotes, extra comma's, etc).
     8  */
     9 EnableEngines(["history"]);
    11 var phases = { "phase1": "profile1",
    12                "phase2": "profile2" };
    14 /*
    15  * History asset lists: these define history entries that are used during
    16  * the test
    17  */
    19 // the initial list of history items to add to the browser
    20 var history1 = [
    21   { uri: "http://www.google.com/",
    22     title: "Google",
    23     visits: [
    24       { type: 1,
    25         date: 0
    26       },
    27       { type: 2,
    28         date: -1
    29       }
    30     ]
    31   },
    32   { uri: "http://www.cnn.com/",
    33     title: "CNN",
    34     visits: [
    35       { type: 1,
    36         date: -1
    37       },
    38       { type: 2,
    39         date: -36
    40       }
    41     ]
    42   },
    43   { uri: "http://www.google.com/language_tools?hl=en",
    44     title: "Language Tools",
    45     visits: [
    46       { type: 1,
    47         date: 0
    48       },
    49       { type: 2,
    50         date: -40
    51       }
    52     ]
    53   },
    54   { uri: "http://www.mozilla.com/",
    55     title: "Mozilla",
    56     visits: [
    57       { type: 1,
    58         date: 0
    59       },
    60       { type: 1,
    61         date: -1
    62       },
    63       { type: 1,
    64         date: -20
    65       },
    66       { type: 2,
    67         date: -36
    68       }
    69     ]
    70   }
    71 ];
    73 // a list of items to delete from the history
    74 var history_to_delete = [
    75   { uri: "http://www.cnn.com/" },
    76   { begin: -24,
    77     end: -1
    78   },
    79   { host: "www.google.com" }
    80 ];
    82 // a list which reflects items that should be in the history after
    83 // the above items are deleted
    84 var history2 = [
    85   { uri: "http://www.mozilla.com/",
    86     title: "Mozilla",
    87     visits: [
    88       { type: 1,
    89         date: 0
    90       },
    91       { type: 2,
    92         date: -36
    93       }
    94     ]
    95   }
    96 ];
    98 // a list which includes history entries that should not be present
    99 // after deletion of the history_to_delete entries
   100 var history_not = [
   101   { uri: "http://www.google.com/",
   102     title: "Google",
   103     visits: [
   104       { type: 1,
   105         date: 0
   106       },
   107       { type: 2,
   108         date: -1
   109       }
   110     ]
   111   },
   112   { uri: "http://www.cnn.com/",
   113     title: "CNN",
   114     visits: [
   115       { type: 1,
   116         date: -1
   117       },
   118       { type: 2,
   119         date: -36
   120       }
   121     ]
   122   },
   123   { uri: "http://www.google.com/language_tools?hl=en",
   124     title: "Language Tools",
   125     visits: [
   126       { type: 1,
   127         date: 0
   128       },
   129       { type: 2,
   130         date: -40
   131       }
   132     ]
   133   },
   134   { uri: "http://www.mozilla.com/",
   135     title: "Mozilla",
   136     visits: [
   137       { type: 1,
   138         date: -1
   139       },
   140       { type: 1,
   141         date: -20
   142       }
   143     ]
   144   }
   145 ];
   147 /*
   148  * Test phases
   149  * Note:  there is no test phase in which deleted history entries are
   150  * synced to other clients.  This functionality is not supported by
   151  * Sync, see bug 446517.
   152  */
   154 Phase('phase1', [
   155   [History.add, history1],
   156   [Sync],
   157 ]);
   159 Phase('phase2', [
   160   [Sync],
   161   [History.verify, history1],
   162   [History.delete, history_to_delete],
   163   [History.verify, history2],
   164   [History.verifyNot, history_not],
   165   [Sync]
   166 ]);

mercurial