tor-browser

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

test_bug538298.js (1991B)


      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 asset lists: these define bookmarks that are used during the test
     20 */
     21 
     22 // the initial list of bookmarks to add to the browser
     23 var bookmarks_initial = {
     24  toolbar: [
     25    { uri: "http://www.google.com", title: "Google" },
     26    {
     27      uri: "http://www.cnn.com",
     28      title: "CNN",
     29      changes: {
     30        position: "Google",
     31      },
     32    },
     33    { uri: "http://www.mozilla.com", title: "Mozilla" },
     34    {
     35      uri: "http://www.firefox.com",
     36      title: "Firefox",
     37      changes: {
     38        position: "Mozilla",
     39      },
     40    },
     41  ],
     42 };
     43 
     44 var bookmarks_after_move = {
     45  toolbar: [
     46    { uri: "http://www.cnn.com", title: "CNN" },
     47    { uri: "http://www.google.com", title: "Google" },
     48    { uri: "http://www.firefox.com", title: "Firefox" },
     49    { uri: "http://www.mozilla.com", title: "Mozilla" },
     50  ],
     51 };
     52 
     53 /*
     54 * Test phases
     55 */
     56 
     57 // Add four bookmarks to the toolbar and sync.
     58 Phase("phase1", [
     59  [Bookmarks.add, bookmarks_initial],
     60  [Bookmarks.verify, bookmarks_initial],
     61  [Sync],
     62 ]);
     63 
     64 // Sync to profile2 and verify that all four bookmarks are present.
     65 Phase("phase2", [[Sync], [Bookmarks.verify, bookmarks_initial]]);
     66 
     67 // Change the order of the toolbar bookmarks, and sync.
     68 Phase("phase3", [
     69  [Sync],
     70  [Bookmarks.verify, bookmarks_initial],
     71  [Bookmarks.modify, bookmarks_initial],
     72  [Bookmarks.verify, bookmarks_after_move],
     73  [Sync],
     74 ]);
     75 
     76 // Go back to profile2, sync, and verify that the bookmarks are reordered
     77 // as expected.
     78 Phase("phase4", [[Sync], [Bookmarks.verify, bookmarks_after_move]]);