Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | Cu.import("resource://services-sync/service.js"); |
michael@0 | 5 | Cu.import("resource://services-sync/util.js"); |
michael@0 | 6 | |
michael@0 | 7 | function run_test() { |
michael@0 | 8 | let debug = []; |
michael@0 | 9 | let info = []; |
michael@0 | 10 | |
michael@0 | 11 | function augmentLogger(old) { |
michael@0 | 12 | let d = old.debug; |
michael@0 | 13 | let i = old.info; |
michael@0 | 14 | old.debug = function(m) { debug.push(m); d.call(old, m); } |
michael@0 | 15 | old.info = function(m) { info.push(m); i.call(old, m); } |
michael@0 | 16 | return old; |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | Log.repository.rootLogger.addAppender(new Log.DumpAppender()); |
michael@0 | 20 | |
michael@0 | 21 | augmentLogger(Service._log); |
michael@0 | 22 | |
michael@0 | 23 | // Avoid daily ping |
michael@0 | 24 | Svc.Prefs.set("lastPing", Math.floor(Date.now() / 1000)); |
michael@0 | 25 | |
michael@0 | 26 | _("Check that sync will log appropriately if already in 'progress'."); |
michael@0 | 27 | Service._locked = true; |
michael@0 | 28 | Service.sync(); |
michael@0 | 29 | Service._locked = false; |
michael@0 | 30 | |
michael@0 | 31 | do_check_eq(debug[debug.length - 2], |
michael@0 | 32 | "Exception: Could not acquire lock. Label: \"service.js: login\". No traceback available"); |
michael@0 | 33 | do_check_eq(info[info.length - 1], |
michael@0 | 34 | "Cannot start sync: already syncing?"); |
michael@0 | 35 | } |
michael@0 | 36 |