Wed, 31 Dec 2014 06:09:35 +0100
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 */
10 var phases = { "phase1": "profile1",
11 "phase2": "profile2",
12 "phase3": "profile1"};
14 /*
15 * Bookmark lists
16 */
18 // the initial list of bookmarks to add to the browser
19 var bookmarks_initial = {
20 toolbar: [
21 { uri: "http://www.google.com",
22 title: "Google"
23 },
24 { uri: "http://www.cnn.com",
25 title: "CNN",
26 changes: {
27 position: "Google"
28 }
29 },
30 { uri: "http://www.mozilla.com",
31 title: "Mozilla"
32 },
33 { uri: "http://www.firefox.com",
34 title: "Firefox",
35 changes: {
36 position: "Mozilla"
37 }
38 }
39 ]
40 };
42 var bookmarks_after_move = {
43 toolbar: [
44 { uri: "http://www.cnn.com",
45 title: "CNN"
46 },
47 { uri: "http://www.google.com",
48 title: "Google"
49 },
50 { uri: "http://www.firefox.com",
51 title: "Firefox"
52 },
53 { uri: "http://www.mozilla.com",
54 title: "Mozilla"
55 }
56 ]
57 };
59 /*
60 * Password data
61 */
63 // Initial password data
64 var passwords_initial = [
65 { hostname: "http://www.example.com",
66 submitURL: "http://login.example.com",
67 username: "joe",
68 password: "secret",
69 usernameField: "uname",
70 passwordField: "pword",
71 changes: {
72 password: "SeCrEt$$$"
73 }
74 },
75 { hostname: "http://www.example.com",
76 realm: "login",
77 username: "jack",
78 password: "secretlogin"
79 }
80 ];
82 // Password after first modify action has been performed
83 var passwords_after_change = [
84 { hostname: "http://www.example.com",
85 submitURL: "http://login.example.com",
86 username: "joe",
87 password: "SeCrEt$$$",
88 usernameField: "uname",
89 passwordField: "pword",
90 changes: {
91 username: "james"
92 }
93 },
94 { hostname: "http://www.example.com",
95 realm: "login",
96 username: "jack",
97 password: "secretlogin"
98 }
99 ];
101 /*
102 * Prefs to use in the test
103 */
104 var prefs1 = [
105 { name: "browser.startup.homepage",
106 value: "http://www.getfirefox.com"
107 },
108 { name: "browser.urlbar.maxRichResults",
109 value: 20
110 },
111 { name: "security.OCSP.require",
112 value: true
113 }
114 ];
116 var prefs2 = [
117 { name: "browser.startup.homepage",
118 value: "http://www.mozilla.com"
119 },
120 { name: "browser.urlbar.maxRichResults",
121 value: 18
122 },
123 { name: "security.OCSP.require",
124 value: false
125 }
126 ];
128 /*
129 * Test phases
130 */
132 // Add prefs,passwords and bookmarks to profile1 and sync.
133 Phase('phase1', [
134 [Passwords.add, passwords_initial],
135 [Bookmarks.add, bookmarks_initial],
136 [Prefs.modify, prefs1],
137 [Prefs.verify, prefs1],
138 [Sync]
139 ]);
141 // Sync profile2 and verify same prefs,passwords and bookmarks are present.
142 Phase('phase2', [
143 [Sync],
144 [Prefs.verify, prefs1],
145 [Passwords.verify, passwords_initial],
146 [Bookmarks.verify, bookmarks_initial]
147 ]);
149 // Using profile1, change some prefs,bookmarks and pwds, then do another sync with wipe-client.
150 // Verify that the cloud's settings are restored, and the recent local changes
151 // discarded.
152 Phase('phase3', [
153 [Prefs.modify, prefs2],
154 [Passwords.modify, passwords_initial],
155 [Bookmarks.modify, bookmarks_initial],
156 [Prefs.verify, prefs2],
157 [Passwords.verify, passwords_after_change],
158 [Bookmarks.verify, bookmarks_after_move],
159 [Sync, SYNC_WIPE_CLIENT],
160 [Prefs.verify, prefs1],
161 [Passwords.verify, passwords_initial],
162 [Bookmarks.verify, bookmarks_initial]
163 ]);