зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1446975 - Replace synced Tabs sidebar device icons. r=eoger
MozReview-Commit-ID: GnawrVrfpEz
This commit is contained in:
Родитель
c0298c8c10
Коммит
5150d18a19
|
@ -9,6 +9,7 @@ add_task(async function setup() {
|
|||
await promiseSyncReady();
|
||||
// gSync.init() is called in a requestIdleCallback. Force its initialization.
|
||||
gSync.init();
|
||||
sinon.stub(Weave.Service.clientsEngine, "getClientType").returns("desktop");
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla");
|
||||
});
|
||||
|
||||
|
@ -193,6 +194,7 @@ add_task(async function test_page_contextmenu_fxa_disabled() {
|
|||
// However, browser_contextmenu.js contains tests that verify its presence.
|
||||
|
||||
add_task(async function teardown() {
|
||||
Weave.Service.clientsEngine.getClientType.restore();
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
|
|
|
@ -269,6 +269,7 @@ add_task(async function sendToDevice_syncNotReady_configured() {
|
|||
syncReady.get(() => true);
|
||||
lastSync.get(() => Date.now());
|
||||
sandbox.stub(gSync, "remoteClients").get(() => mockRemoteClients);
|
||||
sandbox.stub(Weave.Service.clientsEngine, "getClientType").callsFake(id => mockRemoteClients.find(c => c.id == id).type);
|
||||
});
|
||||
|
||||
let onShowingSubview = BrowserPageActions.sendToDevice.onShowingSubview;
|
||||
|
@ -405,6 +406,7 @@ add_task(async function sendToDevice_noDevices() {
|
|||
sandbox.stub(UIState, "get").returns({ status: UIState.STATUS_SIGNED_IN });
|
||||
sandbox.stub(gSync, "isSendableURI").returns(true);
|
||||
sandbox.stub(gSync, "remoteClients").get(() => []);
|
||||
sandbox.stub(Weave.Service.clientsEngine, "getClientType").callsFake(id => mockRemoteClients.find(c => c.id == id).type);
|
||||
|
||||
let cleanUp = () => {
|
||||
sandbox.restore();
|
||||
|
@ -470,6 +472,7 @@ add_task(async function sendToDevice_devices() {
|
|||
sandbox.stub(UIState, "get").returns({ status: UIState.STATUS_SIGNED_IN });
|
||||
sandbox.stub(gSync, "isSendableURI").returns(true);
|
||||
sandbox.stub(gSync, "remoteClients").get(() => mockRemoteClients);
|
||||
sandbox.stub(Weave.Service.clientsEngine, "getClientType").callsFake(id => mockRemoteClients.find(c => c.id == id).type);
|
||||
|
||||
let cleanUp = () => {
|
||||
sandbox.restore();
|
||||
|
@ -534,6 +537,7 @@ add_task(async function sendToDevice_inUrlbar() {
|
|||
sandbox.stub(UIState, "get").returns({ status: UIState.STATUS_SIGNED_IN });
|
||||
sandbox.stub(gSync, "isSendableURI").returns(true);
|
||||
sandbox.stub(gSync, "remoteClients").get(() => mockRemoteClients);
|
||||
sandbox.stub(Weave.Service.clientsEngine, "getClientType").callsFake(id => mockRemoteClients.find(c => c.id == id).type);
|
||||
|
||||
let cleanUp = () => {
|
||||
sandbox.restore();
|
||||
|
|
|
@ -52,6 +52,10 @@ let MockClientsEngine = {
|
|||
}
|
||||
return tabsEngine.clients[id].clientName;
|
||||
},
|
||||
|
||||
getClientType(id) {
|
||||
return "desktop";
|
||||
}
|
||||
};
|
||||
|
||||
function configureClients(clients, clientSettings = {}) {
|
||||
|
|
|
@ -25,15 +25,14 @@ MockTabsEngine.prototype = {
|
|||
|
||||
// A clients engine that doesn't need to be a constructor.
|
||||
let MockClientsEngine = {
|
||||
isMobile(guid) {
|
||||
getClientType(guid) {
|
||||
Assert.ok(guid.endsWith("desktop") || guid.endsWith("mobile"));
|
||||
return guid.endsWith("mobile");
|
||||
},
|
||||
return guid.endsWith("mobile") ? "phone" : "desktop";
|
||||
}
|
||||
};
|
||||
|
||||
// Tell Sync about the mocks.
|
||||
Weave.Service.engineManager.register(MockTabsEngine);
|
||||
Weave.Service.clientsEngine = MockClientsEngine;
|
||||
|
||||
// Tell the Sync XPCOM service it is initialized.
|
||||
let weaveXPCService = Cc["@mozilla.org/weave/service;1"]
|
||||
|
@ -46,6 +45,7 @@ function configureEngine(clients) {
|
|||
// Configure the instance Sync created.
|
||||
let engine = Weave.Service.engineManager.get("tabs");
|
||||
engine.clients = clients;
|
||||
Weave.Service.clientsEngine = MockClientsEngine;
|
||||
// Send an observer that pretends the engine just finished a sync.
|
||||
Services.obs.notifyObservers(null, "weave:engine:sync:finish", "tabs");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче