services/sync/tests/tps/test_bug562515.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/services/sync/tests/tps/test_bug562515.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,105 @@
     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 lists
    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": [
    1.66 +    { uri: "http://www.google.com",
    1.67 +      loadInSidebar: true,
    1.68 +      tags: [ "google", "computers", "internet", "www"]
    1.69 +    }
    1.70 +  ],
    1.71 +  "menu/foldera": [
    1.72 +    { uri: "http://www.yahoo.com",
    1.73 +      title: "testing Yahoo"
    1.74 +    }
    1.75 +  ]
    1.76 +};
    1.77 +
    1.78 +/*
    1.79 + * Test phases
    1.80 + */
    1.81 +
    1.82 +// add bookmarks to profile1 and sync
    1.83 +Phase('phase1', [
    1.84 +  [Bookmarks.add, bookmarks_initial],
    1.85 +  [Bookmarks.verify, bookmarks_initial],
    1.86 +  [Sync]
    1.87 +]);
    1.88 +
    1.89 +// sync to profile2 and verify that the bookmarks are present
    1.90 +Phase('phase2', [
    1.91 +  [Sync],
    1.92 +  [Bookmarks.verify, bookmarks_initial]
    1.93 +]);
    1.94 +
    1.95 +// delete some bookmarks from profile1, then sync with "wipe-client"
    1.96 +// set; finally, verify that the deleted bookmarks were restored.
    1.97 +Phase('phase3', [
    1.98 +  [Bookmarks.delete, bookmarks_to_delete],
    1.99 +  [Bookmarks.verifyNot, bookmarks_to_delete],
   1.100 +  [Sync, SYNC_WIPE_CLIENT],
   1.101 +  [Bookmarks.verify, bookmarks_initial]
   1.102 +]);
   1.103 +
   1.104 +// sync profile2 again, verify no bookmarks have been deleted
   1.105 +Phase('phase4', [
   1.106 +  [Sync],
   1.107 +  [Bookmarks.verify, bookmarks_initial]
   1.108 +]);

mercurial