|
@@ -5,7 +5,7 @@ import * as http from 'http'
|
|
|
import * as net from 'net'
|
|
|
import * as fs from 'fs'
|
|
|
import * as path from 'path'
|
|
|
-import { app, BrowserWindow, Menu } from 'electron'
|
|
|
+import { app, BrowserWindow, Menu, session } from 'electron'
|
|
|
import { emittedOnce } from './events-helpers'
|
|
|
import { closeWindow, closeAllWindows } from './window-helpers'
|
|
|
import { ifdescribe } from './spec-helpers'
|
|
@@ -305,6 +305,15 @@ describe('app module', () => {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
+ describe('certificate-error event', () => {
|
|
|
+ afterEach(closeAllWindows)
|
|
|
+ it('is emitted when visiting a server with a self-signed cert', async () => {
|
|
|
+ const w = new BrowserWindow({ show: false })
|
|
|
+ w.loadURL(secureUrl)
|
|
|
+ await emittedOnce(app, 'certificate-error')
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
// xdescribe('app.importCertificate', () => {
|
|
|
// let w = null
|
|
|
|
|
@@ -708,6 +717,7 @@ describe('app module', () => {
|
|
|
if (process.platform === 'linux') {
|
|
|
this.skip()
|
|
|
}
|
|
|
+ session.fromPartition('empty-certificate').setCertificateVerifyProc((req, cb) => { cb(0) })
|
|
|
})
|
|
|
|
|
|
beforeEach(() => {
|
|
@@ -722,6 +732,8 @@ describe('app module', () => {
|
|
|
|
|
|
afterEach(() => closeWindow(w).then(() => { w = null as any }))
|
|
|
|
|
|
+ after(() => session.fromPartition('empty-certificate').setCertificateVerifyProc(null))
|
|
|
+
|
|
|
it('can respond with empty certificate list', async () => {
|
|
|
app.once('select-client-certificate', function (event, webContents, url, list, callback) {
|
|
|
console.log('select-client-certificate emitted')
|