Bug 671066 - Unknown error on conclusion of easy setup of second client. r=rnewman

This commit is contained in:
Philipp von Weitershausen 2011-07-12 16:36:43 -07:00
Родитель 3b0739c8f1
Коммит 554c00fde6
2 изменённых файлов: 38 добавлений и 1 удалений

Просмотреть файл

@ -1066,7 +1066,7 @@ WeaveSvc.prototype = {
return;
}
let reason = this._checkSync([kSyncNotLoggedIn, kFirstSyncChoiceNotMade]);
let reason = this._checkSync([kSyncNotLoggedIn]);
// Can't autoconnect if we're missing these values.
if (!reason) {

Просмотреть файл

@ -357,6 +357,43 @@ add_test(function test_sync_at_startup() {
Service.delayedAutoConnect(0);
});
let timer;
add_test(function test_no_autoconnect_during_wizard() {
let server = sync_httpd_setup();
setUp();
// Simulate the Sync setup wizard.
Svc.Prefs.set("firstSync", "notReady");
// Ensure we don't actually try to sync.
function onSyncStart() {
do_throw("Should not get here!");
}
Svc.Obs.add("weave:service:sync:start", onSyncStart);
// First wait >100ms (nsITimers can take up to that much time to fire, so
// we can account for the timer in delayedAutoconnect) and then two event
// loop ticks (to account for the Utils.nextTick() in _autoConnect).
let ticks = 2;
function wait() {
if (ticks) {
ticks -= 1;
Utils.nextTick(wait);
return;
}
Svc.Obs.remove("weave:service:sync:start", onSyncStart);
Svc.Prefs.resetBranch("");
SyncScheduler.setDefaults();
Clients.resetClient();
server.stop(run_next_test);
}
timer = Utils.namedTimer(wait, 150, {}, "timer");
Service.delayedAutoConnect(0);
});
add_test(function test_idle_adjustSyncInterval() {
// Confirm defaults.
do_check_eq(SyncScheduler.idle, false);