spec: de-flake ses.protocol test (#18884)
This commit is contained in:
parent
c27231ce5c
commit
e95d2129be
1 changed files with 5 additions and 4 deletions
|
@ -265,7 +265,7 @@ describe('session module', () => {
|
||||||
let customSession = null
|
let customSession = null
|
||||||
const protocol = session.defaultSession.protocol
|
const protocol = session.defaultSession.protocol
|
||||||
const handler = (ignoredError, callback) => {
|
const handler = (ignoredError, callback) => {
|
||||||
callback({ data: 'test', mimeType: 'text/html' })
|
callback({ data: `<script>require('electron').ipcRenderer.send('hello')</script>`, mimeType: 'text/html' })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
@ -273,7 +273,8 @@ describe('session module', () => {
|
||||||
w = new BrowserWindow({
|
w = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
partition: partitionName
|
partition: partitionName,
|
||||||
|
nodeIntegration: true,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
customSession = session.fromPartition(partitionName)
|
customSession = session.fromPartition(partitionName)
|
||||||
|
@ -294,8 +295,8 @@ describe('session module', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('handles requests from partition', async () => {
|
it('handles requests from partition', async () => {
|
||||||
await w.loadURL(`${protocolName}://fake-host`)
|
w.loadURL(`${protocolName}://fake-host`)
|
||||||
expect(await w.webContents.executeJavaScript('document.body.textContent')).to.equal('test')
|
await emittedOnce(ipcMain, 'hello')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue