tor-browser

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

test_bug562515.js (2396B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 EnableEngines(["bookmarks"]);
      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 };
     17 
     18 /*
     19 * Bookmark lists
     20 */
     21 
     22 // the initial list of bookmarks to add to the browser
     23 var bookmarks_initial = {
     24  menu: [
     25    {
     26      uri: "http://www.google.com",
     27      tags: ["google", "computers", "internet", "www"],
     28    },
     29    {
     30      uri: "http://bugzilla.mozilla.org/show_bug.cgi?id=%s",
     31      title: "Bugzilla",
     32      keyword: "bz",
     33    },
     34    { folder: "foldera" },
     35    { uri: "http://www.mozilla.com" },
     36    { separator: true },
     37    { folder: "folderb" },
     38  ],
     39  "menu/foldera": [
     40    { uri: "http://www.yahoo.com", title: "testing Yahoo" },
     41    {
     42      uri: "http://www.cnn.com",
     43      description: "This is a description of the site a at www.cnn.com",
     44    },
     45  ],
     46  "menu/folderb": [{ uri: "http://www.apple.com", tags: ["apple", "mac"] }],
     47  toolbar: [
     48    {
     49      uri: "place:queryType=0&sort=8&maxResults=10&beginTimeRef=1&beginTime=0",
     50      title: "Visited Today",
     51    },
     52  ],
     53 };
     54 
     55 // a list of bookmarks to delete during a 'delete' action
     56 var bookmarks_to_delete = {
     57  menu: [
     58    {
     59      uri: "http://www.google.com",
     60      tags: ["google", "computers", "internet", "www"],
     61    },
     62  ],
     63  "menu/foldera": [{ uri: "http://www.yahoo.com", title: "testing Yahoo" }],
     64 };
     65 
     66 /*
     67 * Test phases
     68 */
     69 
     70 // add bookmarks to profile1 and sync
     71 Phase("phase1", [
     72  [Bookmarks.add, bookmarks_initial],
     73  [Bookmarks.verify, bookmarks_initial],
     74  [Sync],
     75 ]);
     76 
     77 // sync to profile2 and verify that the bookmarks are present
     78 Phase("phase2", [[Sync], [Bookmarks.verify, bookmarks_initial]]);
     79 
     80 // delete some bookmarks from profile1, then sync with "wipe-client"
     81 // set; finally, verify that the deleted bookmarks were restored.
     82 Phase("phase3", [
     83  [Bookmarks.delete, bookmarks_to_delete],
     84  [Bookmarks.verifyNot, bookmarks_to_delete],
     85  [Sync, SYNC_WIPE_CLIENT],
     86  [Bookmarks.verify, bookmarks_initial],
     87 ]);
     88 
     89 // sync profile2 again, verify no bookmarks have been deleted
     90 Phase("phase4", [[Sync], [Bookmarks.verify, bookmarks_initial]]);