build: fix for "enable_desktop_capturer = false" (#23864)

This commit is contained in:
Alexey Kuzmin 2020-06-01 16:13:47 +02:00 committed by GitHub
parent f67aff2704
commit 4133c71105
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 83 additions and 12 deletions

View file

@ -7,12 +7,20 @@ import { closeAllWindows } from './window-helpers';
const features = process.electronBinding('features');
ifdescribe(features.isDesktopCapturerEnabled() && !process.arch.includes('arm') && process.platform !== 'win32')('desktopCapturer', () => {
ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('desktopCapturer', () => {
if (!features.isDesktopCapturerEnabled()) {
// This condition can't go the `ifdescribe` call because its inner code
// it still executed, and if the feature is disabled some function calls here fail.
return;
}
let w: BrowserWindow;
before(async () => {
w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } });
await w.loadURL('about:blank');
});
after(closeAllWindows);
const getSources: typeof desktopCapturer.getSources = (options: SourcesOptions) => {