services/sync/tests/tps/test_client_wipe.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.

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

mercurial