services/sync/tests/tps/test_passwords.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(["passwords"]);
    11 var phases = { "phase1": "profile1",
    12                "phase2": "profile2",
    13                "phase3": "profile1",
    14                "phase4": "profile2" };
    16 /*
    17  * Password asset lists: these define password entries that are used during
    18  * the test
    19  */
    21 // initial password list to be loaded into the browser
    22 var passwords_initial = [
    23   { hostname: "http://www.example.com",
    24     submitURL: "http://login.example.com",
    25     username: "joe",
    26     password: "SeCrEt123",
    27     usernameField: "uname",
    28     passwordField: "pword",
    29     changes: {
    30       password: "zippity-do-dah"
    31     }
    32   },
    33   { hostname: "http://www.example.com",
    34     realm: "login",
    35     username: "joe",
    36     password: "secretlogin"
    37   }
    38 ];
    40 // expected state of passwords after the changes in the above list are applied
    41 var passwords_after_first_update = [
    42   { hostname: "http://www.example.com",
    43     submitURL: "http://login.example.com",
    44     username: "joe",
    45     password: "zippity-do-dah",
    46     usernameField: "uname",
    47     passwordField: "pword"
    48   },
    49   { hostname: "http://www.example.com",
    50     realm: "login",
    51     username: "joe",
    52     password: "secretlogin"
    53   }
    54 ];
    56 var passwords_to_delete = [
    57   { hostname: "http://www.example.com",
    58     realm: "login",
    59     username: "joe",
    60     password: "secretlogin"
    61   }
    62 ];
    64 var passwords_absent = [
    65   { hostname: "http://www.example.com",
    66     realm: "login",
    67     username: "joe",
    68     password: "secretlogin"
    69   }
    70 ];
    72 // expected state of passwords after the delete operation
    73 var passwords_after_second_update = [
    74   { hostname: "http://www.example.com",
    75     submitURL: "http://login.example.com",
    76     username: "joe",
    77     password: "zippity-do-dah",
    78     usernameField: "uname",
    79     passwordField: "pword"
    80   }
    81 ];
    83 /*
    84  * Test phases
    85  */
    87 Phase('phase1', [
    88   [Passwords.add, passwords_initial],
    89   [Sync]
    90 ]);
    92 Phase('phase2', [
    93   [Sync],
    94   [Passwords.verify, passwords_initial],
    95   [Passwords.modify, passwords_initial],
    96   [Passwords.verify, passwords_after_first_update],
    97   [Sync]
    98 ]);
   100 Phase('phase3', [
   101   [Sync],
   102   [Passwords.verify, passwords_after_first_update],
   103   [Passwords.delete, passwords_to_delete],
   104   [Passwords.verify, passwords_after_second_update],
   105   [Passwords.verifyNot, passwords_absent],
   106   [Sync]
   107 ]);
   109 Phase('phase4', [
   110   [Sync],
   111   [Passwords.verify, passwords_after_second_update],
   112   [Passwords.verifyNot, passwords_absent]
   113 ]);

mercurial