diff --git a/spec-main/api-app-spec.ts b/spec-main/api-app-spec.ts index 3d86691b884f..68ad3b059c82 100644 --- a/spec-main/api-app-spec.ts +++ b/spec-main/api-app-spec.ts @@ -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') diff --git a/spec-main/index.js b/spec-main/index.js index d79d766b8121..b6075851a7ec 100644 --- a/spec-main/index.js +++ b/spec-main/index.js @@ -20,9 +20,6 @@ v8.setFlagsFromString('--expose_gc') app.commandLine.appendSwitch('js-flags', '--expose_gc') // Prevent the spec runner quiting when the first window closes app.on('window-all-closed', () => null) -// TODO: This API should _probably_ only be enabled for the specific test that needs it -// not the entire test suite -app.commandLine.appendSwitch('ignore-certificate-errors') // Use fake device for Media Stream to replace actual camera and microphone. app.commandLine.appendSwitch('use-fake-device-for-media-stream')