Making test code run directly in main browser context to avoid rpc persistent handles.
This commit is contained in:
parent
c6ae27c7c9
commit
9b4e9c642a
2 changed files with 15 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
const assert = require('assert')
|
||||
const {remote} = require('electron')
|
||||
const {ipcRenderer} = require('electron')
|
||||
const http = require('http')
|
||||
const url = require('url')
|
||||
const {net} = remote
|
||||
|
@ -1169,13 +1170,21 @@ describe('net module', function () {
|
|||
server = null
|
||||
})
|
||||
|
||||
it.only('should free unreferenced, never-started request objects', function() {
|
||||
it.only('should free unreferenced, never-started request objects', function(done) {
|
||||
const requestUrl = '/requestUrl'
|
||||
const urlRequest = net.request( `${server.url}${requestUrl}`)
|
||||
ipcRenderer.on('api-net-spec-done', function() {
|
||||
done()
|
||||
})
|
||||
const testCode = `
|
||||
// Load the net module in the main browser process.
|
||||
const {net} = require('electron')
|
||||
const urlRequest = net.request('${server.url}${requestUrl}')
|
||||
process.nextTick(function() {
|
||||
net._RequestGarbageCollectionForTesting()
|
||||
process.nextTick(done)
|
||||
event.sender.send('api-net-spec-done')
|
||||
})
|
||||
`
|
||||
ipcRenderer.send('eval', testCode)
|
||||
})
|
||||
it.skip('should not collect on-going requests', function(done) {
|
||||
assert(false)
|
||||
|
@ -1183,5 +1192,5 @@ describe('net module', function () {
|
|||
it.skip('should collect unreferenced, ended requests', function(done) {
|
||||
assert(false)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -8,6 +8,7 @@ const ipcMain = electron.ipcMain
|
|||
const dialog = electron.dialog
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
const protocol = electron.protocol
|
||||
const v8 = require('v8');
|
||||
|
||||
const Coverage = require('electabul').Coverage
|
||||
const fs = require('fs')
|
||||
|
@ -24,6 +25,7 @@ var argv = require('yargs')
|
|||
var window = null
|
||||
process.port = 0 // will be used by crash-reporter spec.
|
||||
|
||||
v8.setFlagsFromString('--expose_gc')
|
||||
app.commandLine.appendSwitch('js-flags', '--expose_gc')
|
||||
app.commandLine.appendSwitch('ignore-certificate-errors')
|
||||
app.commandLine.appendSwitch('disable-renderer-backgrounding')
|
||||
|
|
Loading…
Reference in a new issue