|
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(["bookmarks"]); |
|
10 |
|
11 var phases = { "phase1": "profile1", |
|
12 "phase2": "profile2", |
|
13 "phase3": "profile1", |
|
14 "phase4": "profile2" }; |
|
15 |
|
16 /* |
|
17 * Bookmark lists |
|
18 */ |
|
19 |
|
20 // the initial list of bookmarks to add to the browser |
|
21 var bookmarks_initial = { |
|
22 "menu": [ |
|
23 { uri: "http://www.google.com", |
|
24 loadInSidebar: true, |
|
25 tags: [ "google", "computers", "internet", "www"] |
|
26 }, |
|
27 { uri: "http://bugzilla.mozilla.org/show_bug.cgi?id=%s", |
|
28 title: "Bugzilla", |
|
29 keyword: "bz" |
|
30 }, |
|
31 { folder: "foldera" }, |
|
32 { uri: "http://www.mozilla.com" }, |
|
33 { separator: true }, |
|
34 { folder: "folderb" } |
|
35 ], |
|
36 "menu/foldera": [ |
|
37 { uri: "http://www.yahoo.com", |
|
38 title: "testing Yahoo" |
|
39 }, |
|
40 { uri: "http://www.cnn.com", |
|
41 description: "This is a description of the site a at www.cnn.com" |
|
42 }, |
|
43 { livemark: "Livemark1", |
|
44 feedUri: "http://rss.wunderground.com/blog/JeffMasters/rss.xml", |
|
45 siteUri: "http://www.wunderground.com/blog/JeffMasters/show.html" |
|
46 } |
|
47 ], |
|
48 "menu/folderb": [ |
|
49 { uri: "http://www.apple.com", |
|
50 tags: [ "apple", "mac" ] |
|
51 } |
|
52 ], |
|
53 "toolbar": [ |
|
54 { uri: "place:queryType=0&sort=8&maxResults=10&beginTimeRef=1&beginTime=0", |
|
55 title: "Visited Today" |
|
56 } |
|
57 ] |
|
58 }; |
|
59 |
|
60 // a list of bookmarks to delete during a 'delete' action |
|
61 var bookmarks_to_delete = { |
|
62 "menu": [ |
|
63 { uri: "http://www.google.com", |
|
64 loadInSidebar: true, |
|
65 tags: [ "google", "computers", "internet", "www"] |
|
66 } |
|
67 ], |
|
68 "menu/foldera": [ |
|
69 { uri: "http://www.yahoo.com", |
|
70 title: "testing Yahoo" |
|
71 } |
|
72 ] |
|
73 }; |
|
74 |
|
75 /* |
|
76 * Test phases |
|
77 */ |
|
78 |
|
79 // add bookmarks to profile1 and sync |
|
80 Phase('phase1', [ |
|
81 [Bookmarks.add, bookmarks_initial], |
|
82 [Bookmarks.verify, bookmarks_initial], |
|
83 [Sync] |
|
84 ]); |
|
85 |
|
86 // sync to profile2 and verify that the bookmarks are present |
|
87 Phase('phase2', [ |
|
88 [Sync], |
|
89 [Bookmarks.verify, bookmarks_initial] |
|
90 ]); |
|
91 |
|
92 // delete some bookmarks from profile1, then sync with "wipe-client" |
|
93 // set; finally, verify that the deleted bookmarks were restored. |
|
94 Phase('phase3', [ |
|
95 [Bookmarks.delete, bookmarks_to_delete], |
|
96 [Bookmarks.verifyNot, bookmarks_to_delete], |
|
97 [Sync, SYNC_WIPE_CLIENT], |
|
98 [Bookmarks.verify, bookmarks_initial] |
|
99 ]); |
|
100 |
|
101 // sync profile2 again, verify no bookmarks have been deleted |
|
102 Phase('phase4', [ |
|
103 [Sync], |
|
104 [Bookmarks.verify, bookmarks_initial] |
|
105 ]); |