gecko/services/sync/tests/unit/test_service_sync_locked.js
Gregory Szorc 4242b1314b Bug 787273 - Part 6: Remove Weave export from service.js; r=rnewman
This is mostly minor cosmetic changes. Weave was being exported from
service.js for no apparent reason. It was mostly used by tests.

There was a reference to it in engines.js, which should have been caught
when the engines were associated with a service instance. engines.js now
does the right thing.

Weave is no longer exported by service.js. Tests and modules no longer
import main.js.

WeaveSvc was also renamed to Sync11Service because why not.

Weave continues to be the main public API.
2012-09-14 16:02:33 -07:00

37 lines
1.0 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js");
function run_test() {
let debug = [];
let info = [];
function augmentLogger(old) {
let d = old.debug;
let i = old.info;
old.debug = function(m) { debug.push(m); d.call(old, m); }
old.info = function(m) { info.push(m); i.call(old, m); }
return old;
}
Log4Moz.repository.rootLogger.addAppender(new Log4Moz.DumpAppender());
augmentLogger(Service._log);
// Avoid daily ping
Svc.Prefs.set("lastPing", Math.floor(Date.now() / 1000));
_("Check that sync will log appropriately if already in 'progress'.");
Service._locked = true;
Service.sync();
Service._locked = false;
do_check_eq(debug[debug.length - 2],
"Exception: Could not acquire lock. Label: \"service.js: login\". No traceback available");
do_check_eq(info[info.length - 1],
"Cannot start sync: already syncing?");
}