Revision control
Copy as Markdown
Other Tools
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
var { GraphServer } = ChromeUtils.importESModule(
);
var { PromiseTestUtils } = ChromeUtils.importESModule(
);
var { localAccountUtils } = ChromeUtils.importESModule(
);
var { RemoteFolder } = ChromeUtils.importESModule(
);
/**
* Set up an incoming server connected to a Graph test server.
*
* @returns {[GraphServer, nsIMsgIncomingServer]}
*/
function setupBasicGraphTestServer() {
// Ensure we have an on-disk profile.
do_get_profile();
// Create a new mock Graph server, and start it.
const graphServer = new GraphServer();
graphServer.start();
// Create and configure the Graph incoming server.
const incomingServer = localAccountUtils.create_incoming_server(
"graph",
graphServer.port,
"user",
"password"
);
incomingServer.QueryInterface(Ci.IExchangeIncomingServer);
registerCleanupFunction(async () => {
incomingServer.shutdown();
incomingServer.QueryInterface(Ci.IExchangeIncomingServer);
await TestUtils.waitForCondition(
() => !incomingServer.protocolClientRunning,
"waiting for the Graph client to shut down"
);
graphServer.stop();
});
return [graphServer, incomingServer];
}