2017-10-28 22:16:34 +00:00
|
|
|
import mkdirp from 'mkdirp';
|
2017-11-18 22:47:54 +00:00
|
|
|
import events from 'events';
|
|
|
|
|
2017-06-30 03:30:22 +00:00
|
|
|
const RANDOM_STRING = Math.random().toString().replace('.', '');
|
|
|
|
|
2017-11-17 12:10:37 +00:00
|
|
|
const remote = {
|
|
|
|
app: {
|
|
|
|
getPath (name) {
|
|
|
|
const dir = `/tmp/insomnia-tests-${RANDOM_STRING}/${name}`;
|
|
|
|
mkdirp.sync(dir);
|
|
|
|
return dir;
|
2017-11-18 22:47:54 +00:00
|
|
|
},
|
|
|
|
getLocale () {
|
|
|
|
return 'en-US';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
request (url) {
|
|
|
|
const req = new events.EventEmitter();
|
|
|
|
req.end = function () {};
|
|
|
|
return req;
|
2017-11-17 12:10:37 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
BrowserWindow: {
|
|
|
|
getAllWindows () {
|
|
|
|
return [];
|
2017-11-18 22:47:54 +00:00
|
|
|
},
|
|
|
|
getFocusedWindow () {
|
|
|
|
return {
|
|
|
|
getContentBounds () {
|
|
|
|
return {width: 1900, height: 1060};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
|
|
|
screen: {
|
|
|
|
getPrimaryDisplay () {
|
|
|
|
return {workAreaSize: {width: 1920, height: 1080}};
|
2017-11-17 12:10:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-03-03 01:44:07 +00:00
|
|
|
module.exports = {
|
2017-11-17 12:10:37 +00:00
|
|
|
...remote,
|
|
|
|
remote: remote,
|
|
|
|
ipcMain: {
|
|
|
|
on () {
|
|
|
|
|
2017-11-20 16:07:36 +00:00
|
|
|
},
|
|
|
|
once () {
|
|
|
|
|
2016-09-03 04:32:45 +00:00
|
|
|
}
|
2016-11-23 23:42:10 +00:00
|
|
|
},
|
|
|
|
ipcRenderer: {
|
|
|
|
on () {
|
|
|
|
|
2017-11-20 16:07:36 +00:00
|
|
|
},
|
|
|
|
once () {
|
|
|
|
|
|
|
|
},
|
|
|
|
send () {
|
|
|
|
|
2016-11-23 23:42:10 +00:00
|
|
|
}
|
2016-09-03 04:32:45 +00:00
|
|
|
}
|
2017-03-03 01:44:07 +00:00
|
|
|
};
|