tor-browser

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

test_privbrw_passwords.js (2358B)


      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 strict JSON format, as it will get parsed by the Python
      7 * testrunner (no single quotes, extra comma's, etc).
      8 */
      9 EnableEngines(["passwords"]);
     10 
     11 var phases = {
     12  phase1: "profile1",
     13  phase2: "profile2",
     14  phase3: "profile1",
     15  phase4: "profile2",
     16 };
     17 
     18 /*
     19 * Password data
     20 */
     21 
     22 // Initial password data
     23 var passwords_initial = [
     24  {
     25    hostname: "http://www.example.com",
     26    submitURL: "http://login.example.com",
     27    username: "joe",
     28    password: "secret",
     29    usernameField: "uname",
     30    passwordField: "pword",
     31    changes: {
     32      password: "SeCrEt$$$",
     33    },
     34  },
     35  {
     36    hostname: "http://www.example.com",
     37    realm: "login",
     38    username: "jack",
     39    password: "secretlogin",
     40  },
     41 ];
     42 
     43 // Password after first modify action has been performed
     44 var passwords_after_first_change = [
     45  {
     46    hostname: "http://www.example.com",
     47    submitURL: "http://login.example.com",
     48    username: "joe",
     49    password: "SeCrEt$$$",
     50    usernameField: "uname",
     51    passwordField: "pword",
     52    changes: {
     53      username: "james",
     54    },
     55  },
     56  {
     57    hostname: "http://www.example.com",
     58    realm: "login",
     59    username: "jack",
     60    password: "secretlogin",
     61  },
     62 ];
     63 
     64 // Password after second modify action has been performed
     65 var passwords_after_second_change = [
     66  {
     67    hostname: "http://www.example.com",
     68    submitURL: "http://login.example.com",
     69    username: "james",
     70    password: "SeCrEt$$$",
     71    usernameField: "uname",
     72    passwordField: "pword",
     73  },
     74  {
     75    hostname: "http://www.example.com",
     76    realm: "login",
     77    username: "jack",
     78    password: "secretlogin",
     79  },
     80 ];
     81 
     82 /*
     83 * Test phases
     84 */
     85 
     86 Phase("phase1", [[Passwords.add, passwords_initial], [Sync]]);
     87 
     88 Phase("phase2", [
     89  [Sync],
     90  [Passwords.verify, passwords_initial],
     91  [Passwords.modify, passwords_initial],
     92  [Passwords.verify, passwords_after_first_change],
     93  [Sync],
     94 ]);
     95 
     96 Phase("phase3", [
     97  [Sync],
     98  [Windows.add, { private: true }],
     99  [Passwords.verify, passwords_after_first_change],
    100  [Passwords.modify, passwords_after_first_change],
    101  [Passwords.verify, passwords_after_second_change],
    102  [Sync],
    103 ]);
    104 
    105 Phase("phase4", [[Sync], [Passwords.verify, passwords_after_second_change]]);