Delete mock.pdf after download completes
This commit is contained in:
parent
25015c4c63
commit
647e88da5a
1 changed files with 6 additions and 5 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue