1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/services/sync/tests/unit/test_bookmark_batch_fail.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,23 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +_("Making sure a failing sync reports a useful error"); 1.8 +Cu.import("resource://services-sync/engines/bookmarks.js"); 1.9 +Cu.import("resource://services-sync/service.js"); 1.10 + 1.11 +function run_test() { 1.12 + let engine = new BookmarksEngine(Service); 1.13 + engine._syncStartup = function() { 1.14 + throw "FAIL!"; 1.15 + }; 1.16 + 1.17 + try { 1.18 + _("Try calling the sync that should throw right away"); 1.19 + engine._sync(); 1.20 + do_throw("Should have failed sync!"); 1.21 + } 1.22 + catch(ex) { 1.23 + _("Making sure what we threw ended up as the exception:", ex); 1.24 + do_check_eq(ex, "FAIL!"); 1.25 + } 1.26 +}