feat: add app render-process-gone event (#23560)

This commit is contained in:
Milan Burda 2020-05-17 17:05:05 +02:00 committed by GitHub
parent 9d7ba98209
commit 52b50e6b33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 0 deletions

View file

@ -432,6 +432,25 @@ describe('app module', () => {
expect(webContents).to.equal(w.webContents);
});
it('should emit render-process-gone event when renderer crashes', async function () {
// FIXME: re-enable this test on win32.
if (process.platform === 'win32') { return this.skip(); }
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'render-process-gone');
w.webContents.executeJavaScript('process.crash()');
const [, webContents, details] = await promise;
expect(webContents).to.equal(w.webContents);
expect(details.reason).to.be.oneOf(['crashed', 'abnormal-exit']);
});
ifdescribe(features.isDesktopCapturerEnabled())('desktopCapturer module filtering', () => {
it('should emit desktop-capturer-get-sources event when desktopCapturer.getSources() is invoked', async () => {
w = new BrowserWindow({