Add new test and enable plugins for existing tests
This commit is contained in:
parent
7982754958
commit
13665090d5
1 changed files with 21 additions and 3 deletions
|
@ -1012,16 +1012,18 @@ describe('chromium feature', function () {
|
|||
slashes: true
|
||||
})
|
||||
|
||||
beforeEach(function () {
|
||||
function createBrowserWindow (isPluginsEnabled) {
|
||||
w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
preload: path.join(fixtures, 'module', 'preload-inject-ipc.js')
|
||||
preload: path.join(fixtures, 'module', 'preload-inject-ipc.js'),
|
||||
plugins: isPluginsEnabled
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
it('opens when loading a pdf resource as top level navigation', function (done) {
|
||||
createBrowserWindow(true)
|
||||
ipcMain.once('pdf-loaded', function (event, success) {
|
||||
if (success) done()
|
||||
})
|
||||
|
@ -1043,7 +1045,23 @@ describe('chromium feature', function () {
|
|||
w.webContents.loadURL(pdfSource)
|
||||
})
|
||||
|
||||
it('should download a pdf when plugins are disabled', function (done) {
|
||||
createBrowserWindow(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')
|
||||
done()
|
||||
})
|
||||
w.webContents.loadURL(pdfSource)
|
||||
})
|
||||
|
||||
it('should not open when pdf is requested as sub resource', function (done) {
|
||||
createBrowserWindow(true)
|
||||
webFrame.registerURLSchemeAsPrivileged('file', {
|
||||
secure: false,
|
||||
bypassCSP: false,
|
||||
|
|
Loading…
Add table
Reference in a new issue