Add spec for rejecting using old signature
This commit is contained in:
parent
1e581d6814
commit
18e15a1e53
1 changed files with 24 additions and 8 deletions
|
@ -569,17 +569,33 @@ describe('session module', function () {
|
||||||
w.loadURL(`https://127.0.0.1:${server.address().port}`)
|
w.loadURL(`https://127.0.0.1:${server.address().port}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('supports the old function signature', function (done) {
|
describe('deprecated function signature', function () {
|
||||||
session.defaultSession.setCertificateVerifyProc(function (hostname, certificate, callback) {
|
it('supports accepting the request', function (done) {
|
||||||
assert.equal(hostname, '127.0.0.1')
|
session.defaultSession.setCertificateVerifyProc(function (hostname, certificate, callback) {
|
||||||
callback(true)
|
assert.equal(hostname, '127.0.0.1')
|
||||||
|
callback(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
w.webContents.once('did-finish-load', function () {
|
||||||
|
assert.equal(w.webContents.getTitle(), 'hello')
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
w.loadURL(`https://127.0.0.1:${server.address().port}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
w.webContents.once('did-finish-load', function () {
|
it('supports rejecting the request', function (done) {
|
||||||
assert.equal(w.webContents.getTitle(), 'hello')
|
session.defaultSession.setCertificateVerifyProc(function (hostname, certificate, callback) {
|
||||||
done()
|
assert.equal(hostname, '127.0.0.1')
|
||||||
|
callback(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
var url = `https://127.0.0.1:${server.address().port}`
|
||||||
|
w.webContents.once('did-finish-load', function () {
|
||||||
|
assert.equal(w.webContents.getTitle(), url)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
w.loadURL(url)
|
||||||
})
|
})
|
||||||
w.loadURL(`https://127.0.0.1:${server.address().port}`)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('rejects the request when the callback is called with false', function (done) {
|
it('rejects the request when the callback is called with false', function (done) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue