Add spec for rejecting using old signature

This commit is contained in:
Kevin Sawicki 2017-02-08 12:51:24 -08:00
parent 1e581d6814
commit 18e15a1e53

View file

@ -569,7 +569,8 @@ describe('session module', function () {
w.loadURL(`https://127.0.0.1:${server.address().port}`)
})
it('supports the old function signature', function (done) {
describe('deprecated function signature', function () {
it('supports accepting the request', function (done) {
session.defaultSession.setCertificateVerifyProc(function (hostname, certificate, callback) {
assert.equal(hostname, '127.0.0.1')
callback(true)
@ -582,6 +583,21 @@ describe('session module', function () {
w.loadURL(`https://127.0.0.1:${server.address().port}`)
})
it('supports rejecting the request', function (done) {
session.defaultSession.setCertificateVerifyProc(function (hostname, certificate, callback) {
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)
})
})
it('rejects the request when the callback is called with false', function (done) {
session.defaultSession.setCertificateVerifyProc(function ({hostname, certificate, verificationResult}, callback) {
assert.equal(hostname, '127.0.0.1')