diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index 42d6ff2f519c..fe132166d602 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -1012,18 +1012,18 @@ describe('chromium feature', function () { slashes: true }) - function createBrowserWindow (isPluginsEnabled) { + function createBrowserWindow ({plugins}) { w = new BrowserWindow({ show: false, webPreferences: { preload: path.join(fixtures, 'module', 'preload-inject-ipc.js'), - plugins: isPluginsEnabled + plugins: plugins } }) } it('opens when loading a pdf resource as top level navigation', function (done) { - createBrowserWindow(true) + createBrowserWindow({plugins: true}) ipcMain.once('pdf-loaded', function (event, success) { if (success) done() }) @@ -1046,19 +1046,20 @@ describe('chromium feature', function () { }) it('should download a pdf when plugins are disabled', function (done) { - createBrowserWindow(false) + createBrowserWindow({plugins: false}) ipcRenderer.sendSync('set-download-option', false, false) ipcRenderer.once('download-done', function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) { assert.equal(state, 'completed') assert.equal(filename, 'cat.pdf') assert.equal(mimeType, 'application/pdf') + fs.unlinkSync(path.join(fixtures, 'mock.pdf')) done() }) w.webContents.loadURL(pdfSource) }) it('should not open when pdf is requested as sub resource', function (done) { - createBrowserWindow(true) + createBrowserWindow({plugins: true}) webFrame.registerURLSchemeAsPrivileged('file', { secure: false, bypassCSP: false,