зеркало из https://github.com/mozilla/pjs.git
Bug 676042 - Track Clients engine score in global sync score; r=philikon
This commit is contained in:
Родитель
2228dda3d5
Коммит
9c7f9bcbfc
|
@ -236,7 +236,7 @@ let SyncScheduler = {
|
|||
},
|
||||
|
||||
calculateScore: function calculateScore() {
|
||||
var engines = Engines.getEnabled();
|
||||
let engines = [Clients].concat(Engines.getEnabled());
|
||||
for (let i = 0;i < engines.length;i++) {
|
||||
this._log.trace(engines[i].name + ": score: " + engines[i].score);
|
||||
this.globalScore += engines[i].score;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
Cu.import("resource://services-sync/engines.js");
|
||||
Cu.import("resource://services-sync/engines/clients.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
Cu.import("resource://services-sync/policies.js");
|
||||
|
||||
|
@ -95,3 +96,25 @@ add_test(function test_sync_triggered() {
|
|||
tracker.score += SCORE_INCREMENT_XLARGE;
|
||||
});
|
||||
|
||||
add_test(function test_clients_engine_sync_triggered() {
|
||||
_("Ensure that client engine score changes trigger a sync.");
|
||||
|
||||
// The clients engine is not registered like other engines. Therefore,
|
||||
// it needs special treatment throughout the code. Here, we verify the
|
||||
// global score tracker gives it that treatment. See bug 676042 for more.
|
||||
|
||||
let server = sync_httpd_setup();
|
||||
setUp();
|
||||
Service.login();
|
||||
|
||||
const TOPIC = "weave:service:sync:finish";
|
||||
Svc.Obs.add(TOPIC, function onSyncFinish() {
|
||||
Svc.Obs.remove(TOPIC, onSyncFinish);
|
||||
_("Sync due to clients engine change completed.");
|
||||
server.stop(run_next_test);
|
||||
});
|
||||
|
||||
SyncScheduler.syncThreshold = MULTI_DEVICE_THRESHOLD;
|
||||
Clients._tracker.score += SCORE_INCREMENT_XLARGE;
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче