Bug 1367543 - Make sync's TPS tests handle cases where resyncs are triggered r?kitcambridge
MozReview-Commit-ID: 4owlGyLw5jU
--- a/services/sync/modules/policies.js
+++ b/services/sync/modules/policies.js
@@ -179,19 +179,21 @@ SyncScheduler.prototype = {
// changed during the last sync, and we should schedule an immediate
// follow-up sync.
this._resyncs++;
if (this._resyncs <= this.maxResyncs) {
sync_interval = 0;
} else {
this._log.warn(`Resync attempt ${this._resyncs} exceeded ` +
`maximum ${this.maxResyncs}`);
+ Svc.Obs.notify("weave:service:resyncs-finished");
}
} else {
this._resyncs = 0;
+ Svc.Obs.notify("weave:service:resyncs-finished");
}
this._syncErrors = 0;
if (Status.sync == NO_SYNC_NODE_FOUND) {
// If we don't have a Sync node, override the interval, even if we've
// scheduled a follow-up sync.
this._log.trace("Scheduling a sync at interval NO_SYNC_NODE_FOUND.");
sync_interval = NO_SYNC_NODE_INTERVAL;
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -95,17 +95,18 @@ const OBSERVER_TOPICS = ["fxaccounts:onl
"sessionstore-windows-restored",
"weave:engine:start-tracking",
"weave:engine:stop-tracking",
"weave:service:login:error",
"weave:service:setup-complete",
"weave:service:sync:finish",
"weave:service:sync:delayed",
"weave:service:sync:error",
- "weave:service:sync:start"
+ "weave:service:sync:start",
+ "weave:service:resyncs-finished",
];
var TPS = {
_currentAction: -1,
_currentPhase: -1,
_enabledEngines: null,
_errors: 0,
_isTracking: false,
@@ -208,17 +209,17 @@ var TPS = {
} else {
this._triggeredSync = false;
this.DumpError("Sync error; aborting test");
return;
}
break;
- case "weave:service:sync:finish":
+ case "weave:service:resyncs-finished":
this._syncActive = false;
this._syncErrors = 0;
this._triggeredSync = false;
this.delayAutoSync();
// Wait a second before continuing, otherwise we can get
// 'sync not complete' errors.
@@ -1112,17 +1113,17 @@ var TPS = {
}
},
/**
* Waits for Sync to be finished before returning
*/
waitForSyncFinished: function TPS__waitForSyncFinished() {
if (this._syncActive) {
- this.waitForEvent("weave:service:sync:finished");
+ this.waitForEvent("weave:service:resyncs-finished");
}
},
/**
* Waits for Sync to start tracking before returning.
*/
waitForTracking: function waitForTracking() {
if (!this._isTracking) {