VulpesOS/gaia/apps/system/fxa/test/marionette/lib/server.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

39 lines
832 B
JavaScript
Executable file

'use strict';
function Server(child) {
this.child = child;
}
Server.prototype = {
/**
* Sends signal to stop child process and stop server.
*
* TODO: Bug 1056186:
* [FxA] Create unit tests for Firefox Accounts mock server process
*/
stop: function() {
this.child.kill('SIGTERM');
}
};
/**
* Spawn the child process where the FxA mock server lives.
*
* @param args - [ host, port, path ]
* @param callback
*/
function create(args, callback) {
var child = require('child_process')
.fork(__dirname + '/server_mock_fxa.js', args)
.on('message', function(data) {
if (Array.isArray(data) && data[0] === 'start') {
callback(null, new Server(child));
}
})
.on('error', function (err) {
callback(err);
});
}
Server.create = create;
module.exports = Server;