test: worker should be able to load asar files (#28858)
This commit is contained in:
parent
72092c2312
commit
b97b973306
4 changed files with 58 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
import { expect } from 'chai';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
import { BrowserWindow, ipcMain } from 'electron/main';
|
||||
import { closeAllWindows } from './window-helpers';
|
||||
import { emittedOnce } from './events-helpers';
|
||||
|
@ -79,4 +80,32 @@ describe('asar package', () => {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('worker', () => {
|
||||
it('Worker can load asar file', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
await w.loadFile(path.join(fixtures, 'workers', 'load_worker.html'));
|
||||
|
||||
const workerUrl = url.format({
|
||||
pathname: path.resolve(fixtures, 'workers', 'workers.asar', 'worker.js').replace(/\\/g, '/'),
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
});
|
||||
const result = await w.webContents.executeJavaScript(`loadWorker('${workerUrl}')`);
|
||||
expect(result).to.equal('success');
|
||||
});
|
||||
|
||||
it('SharedWorker can load asar file', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
await w.loadFile(path.join(fixtures, 'workers', 'load_shared_worker.html'));
|
||||
|
||||
const workerUrl = url.format({
|
||||
pathname: path.resolve(fixtures, 'workers', 'workers.asar', 'shared_worker.js').replace(/\\/g, '/'),
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
});
|
||||
const result = await w.webContents.executeJavaScript(`loadSharedWorker('${workerUrl}')`);
|
||||
expect(result).to.equal('success');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue