2019-05-23 22:31:38 +00:00
|
|
|
const { app, net, session } = require('electron')
|
|
|
|
|
|
|
|
if (process.env.TEST_DUMP_FILE) {
|
|
|
|
app.commandLine.appendSwitch('log-net-log', process.env.TEST_DUMP_FILE)
|
|
|
|
}
|
|
|
|
|
|
|
|
function request () {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
const req = net.request(process.env.TEST_REQUEST_URL)
|
|
|
|
req.on('response', () => {
|
|
|
|
resolve()
|
|
|
|
})
|
|
|
|
req.end()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-02-03 22:43:22 +00:00
|
|
|
app.whenReady().then(async () => {
|
2019-05-23 22:31:38 +00:00
|
|
|
const netLog = session.defaultSession.netLog
|
|
|
|
|
|
|
|
if (process.env.TEST_DUMP_FILE_DYNAMIC) {
|
|
|
|
await netLog.startLogging(process.env.TEST_DUMP_FILE_DYNAMIC)
|
|
|
|
}
|
|
|
|
|
|
|
|
await request()
|
|
|
|
|
|
|
|
if (process.env.TEST_MANUAL_STOP) {
|
|
|
|
await netLog.stopLogging()
|
|
|
|
}
|
|
|
|
|
|
|
|
app.quit()
|
|
|
|
})
|