services/sync/tests/tps/test_bug563989.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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  */
     9 EnableEngines(["bookmarks"]);
    11 var phases = { "phase1": "profile1",
    12                "phase2": "profile2",
    13                "phase3": "profile1",
    14                "phase4": "profile2" };
    16 /*
    17  * Bookmark asset lists: these define bookmarks that are used during the test
    18  */
    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 };
    60 // a list of bookmarks to delete during a 'delete' action
    61 var bookmarks_to_delete = {
    62   "menu/folderb": [
    63     { uri: "http://www.apple.com",
    64       tags: [ "apple", "mac" ]
    65     }
    66   ],
    67   "toolbar": [
    68     { uri: "place:queryType=0&sort=8&maxResults=10&beginTimeRef=1&beginTime=0",
    69       title: "Visited Today"
    70     }
    71   ]
    72 };
    74 /*
    75  * Test phases
    76  */
    78 // Add bookmarks to profile1 and sync.
    79 Phase('phase1', [
    80   [Bookmarks.add, bookmarks_initial],
    81   [Bookmarks.verify, bookmarks_initial],
    82   [Sync],
    83 ]);
    85 // Sync to profile2 and verify that the bookmarks are present.  Delete 
    86 // some bookmarks, and verify that they're not present, but don't sync again.
    87 Phase('phase2', [
    88   [Sync],
    89   [Bookmarks.verify, bookmarks_initial],
    90   [Bookmarks.delete, bookmarks_to_delete],
    91   [Bookmarks.verifyNot, bookmarks_to_delete]
    92 ]);
    94 // Using profile1, sync again with wipe-server set to true.  Verify our
    95 // initial bookmarks are still all present.
    96 Phase('phase3', [
    97   [Sync, SYNC_WIPE_REMOTE],
    98   [Bookmarks.verify, bookmarks_initial]
    99 ]);
   101 // Back in profile2, do a sync and verify that the bookmarks we had
   102 // deleted earlier are now restored.
   103 Phase('phase4', [
   104   [Sync],
   105   [Bookmarks.verify, bookmarks_initial]
   106 ]);

mercurial