2018-09-13 16:10:51 +00:00
|
|
|
const { app, net, netLog } = require('electron')
|
2018-06-19 01:45:58 +00:00
|
|
|
|
|
|
|
function request () {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
const req = net.request(process.env.TEST_REQUEST_URL)
|
|
|
|
req.on('response', () => {
|
|
|
|
resolve()
|
|
|
|
})
|
|
|
|
req.end()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function stopLogging () {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
netLog.stopLogging(() => {
|
|
|
|
resolve()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
app.on('ready', async () => {
|
|
|
|
if (process.env.TEST_DUMP_FILE) {
|
|
|
|
netLog.startLogging(process.env.TEST_DUMP_FILE)
|
|
|
|
}
|
|
|
|
|
|
|
|
await request()
|
|
|
|
|
|
|
|
if (process.env.TEST_MANUAL_STOP) {
|
|
|
|
await stopLogging()
|
|
|
|
}
|
|
|
|
|
|
|
|
app.quit()
|
|
|
|
})
|