services/sync/tests/tps/test_bug538298.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/services/sync/tests/tps/test_bug538298.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,93 @@
     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 +  "toolbar": [
    1.26 +    { uri: "http://www.google.com",
    1.27 +      title: "Google"
    1.28 +    },
    1.29 +    { uri: "http://www.cnn.com",
    1.30 +      title: "CNN",
    1.31 +      changes: {
    1.32 +        position: "Google"
    1.33 +      }
    1.34 +    },
    1.35 +    { uri: "http://www.mozilla.com",
    1.36 +      title: "Mozilla"
    1.37 +    },
    1.38 +    { uri: "http://www.firefox.com",
    1.39 +      title: "Firefox",
    1.40 +      changes: {
    1.41 +        position: "Mozilla"
    1.42 +      }
    1.43 +    }
    1.44 +  ]
    1.45 +};
    1.46 +
    1.47 +var bookmarks_after_move = {
    1.48 +  "toolbar": [
    1.49 +    { uri: "http://www.cnn.com",
    1.50 +      title: "CNN"
    1.51 +    },
    1.52 +    { uri: "http://www.google.com",
    1.53 +      title: "Google"
    1.54 +    },
    1.55 +    { uri: "http://www.firefox.com",
    1.56 +      title: "Firefox"
    1.57 +    },
    1.58 +    { uri: "http://www.mozilla.com",
    1.59 +      title: "Mozilla"
    1.60 +    }
    1.61 +  ]
    1.62 +};
    1.63 +
    1.64 +/*
    1.65 + * Test phases
    1.66 + */
    1.67 +
    1.68 +// Add four bookmarks to the toolbar and sync.
    1.69 +Phase('phase1', [
    1.70 +  [Bookmarks.add, bookmarks_initial],
    1.71 +  [Bookmarks.verify, bookmarks_initial],
    1.72 +  [Sync]
    1.73 +]);
    1.74 +
    1.75 +// Sync to profile2 and verify that all four bookmarks are present.
    1.76 +Phase('phase2', [
    1.77 +  [Sync],
    1.78 +  [Bookmarks.verify, bookmarks_initial]
    1.79 +]);
    1.80 +
    1.81 +// Change the order of the toolbar bookmarks, and sync.
    1.82 +Phase('phase3', [
    1.83 +  [Sync],
    1.84 +  [Bookmarks.verify, bookmarks_initial],
    1.85 +  [Bookmarks.modify, bookmarks_initial],
    1.86 +  [Bookmarks.verify, bookmarks_after_move],
    1.87 +  [Sync],
    1.88 +]);
    1.89 +
    1.90 +// Go back to profile2, sync, and verify that the bookmarks are reordered
    1.91 +// as expected.
    1.92 +Phase('phase4', [
    1.93 +  [Sync],
    1.94 +  [Bookmarks.verify, bookmarks_after_move]
    1.95 +]);
    1.96 +

mercurial