services/sync/tests/tps/test_client_wipe.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/services/sync/tests/tps/test_client_wipe.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,164 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/*
     1.8 + * The list of phases mapped to their corresponding profiles.  The object
     1.9 + * here must be in strict JSON format, as it will get parsed by the Python
    1.10 + * testrunner (no single quotes, extra comma's, etc).
    1.11 + */
    1.12 +
    1.13 +var phases = { "phase1": "profile1",
    1.14 +               "phase2": "profile2",
    1.15 +               "phase3": "profile1"};
    1.16 +
    1.17 +/*
    1.18 + * Bookmark lists
    1.19 + */
    1.20 +
    1.21 +// the initial list of bookmarks to add to the browser
    1.22 +var bookmarks_initial = {
    1.23 +  toolbar: [
    1.24 +    { uri: "http://www.google.com",
    1.25 +      title: "Google"
    1.26 +    },
    1.27 +    { uri: "http://www.cnn.com",
    1.28 +      title: "CNN",
    1.29 +      changes: {
    1.30 +        position: "Google"
    1.31 +      }
    1.32 +    },
    1.33 +    { uri: "http://www.mozilla.com",
    1.34 +      title: "Mozilla"
    1.35 +    },
    1.36 +    { uri: "http://www.firefox.com",
    1.37 +      title: "Firefox",
    1.38 +      changes: {
    1.39 +        position: "Mozilla"
    1.40 +      }
    1.41 +    }
    1.42 +  ]
    1.43 +};
    1.44 +
    1.45 +var bookmarks_after_move = {
    1.46 +  toolbar: [
    1.47 +    { uri: "http://www.cnn.com",
    1.48 +      title: "CNN"
    1.49 +    },
    1.50 +    { uri: "http://www.google.com",
    1.51 +      title: "Google"
    1.52 +    },
    1.53 +    { uri: "http://www.firefox.com",
    1.54 +      title: "Firefox"
    1.55 +    },
    1.56 +    { uri: "http://www.mozilla.com",
    1.57 +      title: "Mozilla"
    1.58 +    }
    1.59 +  ]
    1.60 +};
    1.61 +
    1.62 +/*
    1.63 + * Password data
    1.64 + */
    1.65 +
    1.66 +// Initial password data
    1.67 +var passwords_initial = [
    1.68 +   { hostname: "http://www.example.com",
    1.69 +     submitURL: "http://login.example.com",
    1.70 +     username: "joe",
    1.71 +     password: "secret",
    1.72 +     usernameField: "uname",
    1.73 +     passwordField: "pword",
    1.74 +     changes: {
    1.75 +       password: "SeCrEt$$$"
    1.76 +     }
    1.77 +   },
    1.78 +   { hostname: "http://www.example.com",
    1.79 +     realm: "login",
    1.80 +     username: "jack",
    1.81 +     password: "secretlogin"
    1.82 +   }
    1.83 +];
    1.84 +
    1.85 +// Password after first modify action has been performed
    1.86 +var passwords_after_change = [
    1.87 +   { hostname: "http://www.example.com",
    1.88 +     submitURL: "http://login.example.com",
    1.89 +     username: "joe",
    1.90 +     password: "SeCrEt$$$",
    1.91 +     usernameField: "uname",
    1.92 +     passwordField: "pword",
    1.93 +     changes: {
    1.94 +        username: "james"
    1.95 +     }
    1.96 +   },
    1.97 +   { hostname: "http://www.example.com",
    1.98 +     realm: "login",
    1.99 +     username: "jack",
   1.100 +     password: "secretlogin"
   1.101 +   }
   1.102 +];
   1.103 +
   1.104 +/*
   1.105 + * Prefs to use in the test
   1.106 + */
   1.107 +var prefs1 = [
   1.108 +  { name: "browser.startup.homepage",
   1.109 +    value: "http://www.getfirefox.com"
   1.110 +  },
   1.111 +  { name: "browser.urlbar.maxRichResults",
   1.112 +    value: 20
   1.113 +  },
   1.114 +  { name: "security.OCSP.require",
   1.115 +    value: true
   1.116 +  }
   1.117 +];
   1.118 +
   1.119 +var prefs2 = [
   1.120 +  { name: "browser.startup.homepage",
   1.121 +    value: "http://www.mozilla.com"
   1.122 +  },
   1.123 +  { name: "browser.urlbar.maxRichResults",
   1.124 +    value: 18
   1.125 +  },
   1.126 +  { name: "security.OCSP.require",
   1.127 +    value: false
   1.128 +  }
   1.129 +];
   1.130 +
   1.131 +/*
   1.132 + * Test phases
   1.133 + */
   1.134 +
   1.135 +// Add prefs,passwords and bookmarks to profile1 and sync.
   1.136 +Phase('phase1', [
   1.137 +  [Passwords.add, passwords_initial],
   1.138 +  [Bookmarks.add, bookmarks_initial],
   1.139 +  [Prefs.modify, prefs1],
   1.140 +  [Prefs.verify, prefs1],
   1.141 +  [Sync]
   1.142 +]);
   1.143 +
   1.144 +// Sync profile2 and verify same prefs,passwords and bookmarks are present.
   1.145 +Phase('phase2', [
   1.146 +  [Sync],
   1.147 +  [Prefs.verify, prefs1],
   1.148 +  [Passwords.verify, passwords_initial],
   1.149 +  [Bookmarks.verify, bookmarks_initial]
   1.150 +]);
   1.151 +
   1.152 +// Using profile1, change some prefs,bookmarks and pwds, then do another sync with wipe-client.
   1.153 +// Verify that the cloud's  settings are restored, and the recent local changes
   1.154 +// discarded.
   1.155 +Phase('phase3', [
   1.156 +  [Prefs.modify, prefs2],
   1.157 +  [Passwords.modify, passwords_initial],
   1.158 +  [Bookmarks.modify, bookmarks_initial],
   1.159 +  [Prefs.verify, prefs2],
   1.160 +  [Passwords.verify, passwords_after_change],
   1.161 +  [Bookmarks.verify, bookmarks_after_move],
   1.162 +  [Sync, SYNC_WIPE_CLIENT],
   1.163 +  [Prefs.verify, prefs1],
   1.164 +  [Passwords.verify, passwords_initial],
   1.165 +  [Bookmarks.verify, bookmarks_initial]
   1.166 +]);
   1.167 +

mercurial