fune/browser/base/content/test/sync/head.js
Kit Cambridge 94aaf48948 Bug 1448929 - Fix first sync check in gSync.syncConfiguredAndLoading. r=eoger
MozReview-Commit-ID: 8Xk6DMHroTm

--HG--
extra : rebase_source : eba433ff16f9b3088958878cdc7223ec68f68e18
2018-03-26 09:35:29 -07:00

25 lines
918 B
JavaScript

/* global sinon */
Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js");
ChromeUtils.import("resource://services-sync/UIState.jsm", this);
registerCleanupFunction(function() {
delete window.sinon;
});
function promiseSyncReady() {
let service = Cc["@mozilla.org/weave/service;1"]
.getService(Ci.nsISupports)
.wrappedJSObject;
return service.whenLoaded();
}
function setupSendTabMocks({ syncReady, clientsSynced, remoteClients, state, isSendableURI }) {
const sandbox = sinon.sandbox.create();
sandbox.stub(gSync, "syncReady").get(() => syncReady);
sandbox.stub(Weave.Service.clientsEngine, "isFirstSync").get(() => !clientsSynced);
sandbox.stub(gSync, "remoteClients").get(() => remoteClients);
sandbox.stub(UIState, "get").returns({ status: state });
sandbox.stub(gSync, "isSendableURI").returns(isSendableURI);
return sandbox;
}