|
@@ -7,6 +7,7 @@ import { closeWindow } from './lib/window-helpers';
|
|
|
import { once } from 'node:events';
|
|
|
import { pathToFileURL } from 'node:url';
|
|
|
import { setImmediate } from 'node:timers/promises';
|
|
|
+import { systemPreferences } from 'electron';
|
|
|
|
|
|
const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'utility-process');
|
|
|
const isWindowsOnArm = process.platform === 'win32' && process.arch === 'arm64';
|
|
@@ -404,6 +405,18 @@ describe('utilityProcess module', () => {
|
|
|
expect(output).to.include(result);
|
|
|
});
|
|
|
|
|
|
+ ifit(process.platform !== 'linux')('can access exposed main process modules from the utility process', async () => {
|
|
|
+ const message = 'Message from utility process';
|
|
|
+ const child = utilityProcess.fork(path.join(fixturesPath, 'expose-main-process-module.js'));
|
|
|
+ await once(child, 'spawn');
|
|
|
+ child.postMessage(message);
|
|
|
+ const [data] = await once(child, 'message');
|
|
|
+ expect(data).to.equal(systemPreferences.getMediaAccessStatus('screen'));
|
|
|
+ const exit = once(child, 'exit');
|
|
|
+ expect(child.kill()).to.be.true();
|
|
|
+ await exit;
|
|
|
+ });
|
|
|
+
|
|
|
it('can establish communication channel with sandboxed renderer', async () => {
|
|
|
const result = 'Message from sandboxed renderer';
|
|
|
const w = new BrowserWindow({
|