chore: add debugger specs for multiple sessions (#14598)

This commit is contained in:
Robo 2018-09-13 12:02:30 +05:30 committed by Samuel Attard
parent d663b4eaee
commit d9c6dd0254

View file

@ -72,6 +72,24 @@ describe('debugger module', () => {
}
w.webContents.debugger.detach()
})
it('doesn\'t disconnect an active devtools session', done => {
w.webContents.loadURL('about:blank')
try {
w.webContents.debugger.attach()
} catch (err) {
return done(`unexpected error : ${err}`)
}
w.webContents.openDevTools()
w.webContents.once('devtools-opened', () => {
w.webContents.debugger.detach()
})
w.webContents.debugger.on('detach', (e, reason) => {
expect(w.webContents.debugger.isAttached()).to.be.false()
expect(w.devToolsWebContents.isDestroyed()).to.be.false()
done()
})
})
})
describe('debugger.sendCommand', () => {
@ -105,6 +123,27 @@ describe('debugger module', () => {
w.webContents.debugger.sendCommand('Runtime.evaluate', params, callback)
})
it('returns response when devtools is opened', done => {
w.webContents.loadURL('about:blank')
try {
w.webContents.debugger.attach()
} catch (err) {
return done(`unexpected error : ${err}`)
}
const callback = (err, res) => {
expect(err.message).to.be.undefined()
expect(res.wasThrown).to.be.undefined()
expect(res.result.value).to.equal(6)
w.webContents.debugger.detach()
done()
}
w.webContents.openDevTools()
w.webContents.once('devtools-opened', () => {
const params = {'expression': '4+2'}
w.webContents.debugger.sendCommand('Runtime.evaluate', params, callback)
})
})
it('fires message event', done => {
const url = process.platform !== 'win32'
? `file://${path.join(fixtures, 'pages', 'a.html')}`