tor-browser

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

test_client_wipe.js (3566B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 /*
      5 * The list of phases mapped to their corresponding profiles.  The object
      6 * here must be in JSON format as it will get parsed by the Python
      7 * testrunner. It is parsed by the YAML package, so it relatively flexible.
      8 */
      9 var phases = { phase1: "profile1", phase2: "profile2", phase3: "profile1" };
     10 
     11 /*
     12 * Bookmark lists
     13 */
     14 
     15 // the initial list of bookmarks to add to the browser
     16 var bookmarks_initial = {
     17  toolbar: [
     18    { uri: "http://www.google.com", title: "Google" },
     19    {
     20      uri: "http://www.cnn.com",
     21      title: "CNN",
     22      changes: {
     23        position: "Google",
     24      },
     25    },
     26    { uri: "http://www.mozilla.com", title: "Mozilla" },
     27    {
     28      uri: "http://www.firefox.com",
     29      title: "Firefox",
     30      changes: {
     31        position: "Mozilla",
     32      },
     33    },
     34  ],
     35 };
     36 
     37 var bookmarks_after_move = {
     38  toolbar: [
     39    { uri: "http://www.cnn.com", title: "CNN" },
     40    { uri: "http://www.google.com", title: "Google" },
     41    { uri: "http://www.firefox.com", title: "Firefox" },
     42    { uri: "http://www.mozilla.com", title: "Mozilla" },
     43  ],
     44 };
     45 
     46 /*
     47 * Password data
     48 */
     49 
     50 // Initial password data
     51 var passwords_initial = [
     52  {
     53    hostname: "http://www.example.com",
     54    submitURL: "http://login.example.com",
     55    username: "joe",
     56    password: "secret",
     57    usernameField: "uname",
     58    passwordField: "pword",
     59    changes: {
     60      password: "SeCrEt$$$",
     61    },
     62  },
     63  {
     64    hostname: "http://www.example.com",
     65    realm: "login",
     66    username: "jack",
     67    password: "secretlogin",
     68  },
     69 ];
     70 
     71 // Password after first modify action has been performed
     72 var passwords_after_change = [
     73  {
     74    hostname: "http://www.example.com",
     75    submitURL: "http://login.example.com",
     76    username: "joe",
     77    password: "SeCrEt$$$",
     78    usernameField: "uname",
     79    passwordField: "pword",
     80    changes: {
     81      username: "james",
     82    },
     83  },
     84  {
     85    hostname: "http://www.example.com",
     86    realm: "login",
     87    username: "jack",
     88    password: "secretlogin",
     89  },
     90 ];
     91 
     92 /*
     93 * Prefs to use in the test
     94 */
     95 var prefs1 = [
     96  { name: "browser.startup.homepage", value: "http://www.getfirefox.com" },
     97  { name: "browser.urlbar.maxRichResults", value: 20 },
     98  { name: "privacy.clearOnShutdown.siteSettings", value: true },
     99 ];
    100 
    101 var prefs2 = [
    102  { name: "browser.startup.homepage", value: "http://www.mozilla.com" },
    103  { name: "browser.urlbar.maxRichResults", value: 18 },
    104  { name: "privacy.clearOnShutdown.siteSettings", value: false },
    105 ];
    106 
    107 /*
    108 * Test phases
    109 */
    110 
    111 // Add prefs,passwords and bookmarks to profile1 and sync.
    112 Phase("phase1", [
    113  [Passwords.add, passwords_initial],
    114  [Bookmarks.add, bookmarks_initial],
    115  [Prefs.modify, prefs1],
    116  [Prefs.verify, prefs1],
    117  [Sync],
    118 ]);
    119 
    120 // Sync profile2 and verify same prefs,passwords and bookmarks are present.
    121 Phase("phase2", [
    122  [Sync],
    123  [Prefs.verify, prefs1],
    124  [Passwords.verify, passwords_initial],
    125  [Bookmarks.verify, bookmarks_initial],
    126 ]);
    127 
    128 // Using profile1, change some prefs,bookmarks and pwds, then do another sync with wipe-client.
    129 // Verify that the cloud's  settings are restored, and the recent local changes
    130 // discarded.
    131 Phase("phase3", [
    132  [Prefs.modify, prefs2],
    133  [Passwords.modify, passwords_initial],
    134  [Bookmarks.modify, bookmarks_initial],
    135  [Prefs.verify, prefs2],
    136  [Passwords.verify, passwords_after_change],
    137  [Bookmarks.verify, bookmarks_after_move],
    138  [Sync, SYNC_WIPE_CLIENT],
    139  [Prefs.verify, prefs1],
    140  [Passwords.verify, passwords_initial],
    141  [Bookmarks.verify, bookmarks_initial],
    142 ]);