services/sync/tests/tps/test_bug563989.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/services/sync/tests/tps/test_bug563989.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,106 @@
     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 +EnableEngines(["bookmarks"]);
    1.13 +
    1.14 +var phases = { "phase1": "profile1",
    1.15 +               "phase2": "profile2",
    1.16 +               "phase3": "profile1",
    1.17 +               "phase4": "profile2" };
    1.18 +
    1.19 +/*
    1.20 + * Bookmark asset lists: these define bookmarks that are used during the test
    1.21 + */
    1.22 +
    1.23 +// the initial list of bookmarks to add to the browser
    1.24 +var bookmarks_initial = {
    1.25 +  "menu": [
    1.26 +    { uri: "http://www.google.com",
    1.27 +      loadInSidebar: true,
    1.28 +      tags: [ "google", "computers", "internet", "www" ]
    1.29 +    },
    1.30 +    { uri: "http://bugzilla.mozilla.org/show_bug.cgi?id=%s",
    1.31 +      title: "Bugzilla",
    1.32 +      keyword: "bz"
    1.33 +    },
    1.34 +    { folder: "foldera" },
    1.35 +    { uri: "http://www.mozilla.com" },
    1.36 +    { separator: true },
    1.37 +    { folder: "folderb" }
    1.38 +  ],
    1.39 +  "menu/foldera": [
    1.40 +    { uri: "http://www.yahoo.com",
    1.41 +      title: "testing Yahoo"
    1.42 +    },
    1.43 +    { uri: "http://www.cnn.com",
    1.44 +      description: "This is a description of the site a at www.cnn.com"
    1.45 +    },
    1.46 +    { livemark: "Livemark1",
    1.47 +      feedUri: "http://rss.wunderground.com/blog/JeffMasters/rss.xml",
    1.48 +      siteUri: "http://www.wunderground.com/blog/JeffMasters/show.html"
    1.49 +    }
    1.50 +  ],
    1.51 +  "menu/folderb": [
    1.52 +    { uri: "http://www.apple.com",
    1.53 +      tags: [ "apple", "mac" ]
    1.54 +    }
    1.55 +  ],
    1.56 +  "toolbar": [
    1.57 +    { uri: "place:queryType=0&sort=8&maxResults=10&beginTimeRef=1&beginTime=0",
    1.58 +      title: "Visited Today"
    1.59 +    }
    1.60 +  ]
    1.61 +};
    1.62 +
    1.63 +// a list of bookmarks to delete during a 'delete' action
    1.64 +var bookmarks_to_delete = {
    1.65 +  "menu/folderb": [
    1.66 +    { uri: "http://www.apple.com",
    1.67 +      tags: [ "apple", "mac" ]
    1.68 +    }
    1.69 +  ],
    1.70 +  "toolbar": [
    1.71 +    { uri: "place:queryType=0&sort=8&maxResults=10&beginTimeRef=1&beginTime=0",
    1.72 +      title: "Visited Today"
    1.73 +    }
    1.74 +  ]
    1.75 +};
    1.76 +
    1.77 +/*
    1.78 + * Test phases
    1.79 + */
    1.80 +
    1.81 +// Add bookmarks to profile1 and sync.
    1.82 +Phase('phase1', [
    1.83 +  [Bookmarks.add, bookmarks_initial],
    1.84 +  [Bookmarks.verify, bookmarks_initial],
    1.85 +  [Sync],
    1.86 +]);
    1.87 +
    1.88 +// Sync to profile2 and verify that the bookmarks are present.  Delete 
    1.89 +// some bookmarks, and verify that they're not present, but don't sync again.
    1.90 +Phase('phase2', [
    1.91 +  [Sync],
    1.92 +  [Bookmarks.verify, bookmarks_initial],
    1.93 +  [Bookmarks.delete, bookmarks_to_delete],
    1.94 +  [Bookmarks.verifyNot, bookmarks_to_delete]
    1.95 +]);
    1.96 +
    1.97 +// Using profile1, sync again with wipe-server set to true.  Verify our
    1.98 +// initial bookmarks are still all present.
    1.99 +Phase('phase3', [
   1.100 +  [Sync, SYNC_WIPE_REMOTE],
   1.101 +  [Bookmarks.verify, bookmarks_initial]
   1.102 +]);
   1.103 +
   1.104 +// Back in profile2, do a sync and verify that the bookmarks we had
   1.105 +// deleted earlier are now restored.
   1.106 +Phase('phase4', [
   1.107 +  [Sync],
   1.108 +  [Bookmarks.verify, bookmarks_initial]
   1.109 +]);

mercurial