feat: add session.downloadURL() (#19889)
This commit is contained in:
parent
79e936aea8
commit
eed72c35d7
4 changed files with 34 additions and 0 deletions
|
@ -577,6 +577,18 @@ describe('session module', () => {
|
|||
fs.unlinkSync(downloadFilePath)
|
||||
}
|
||||
|
||||
it('can download using session.downloadURL', (done) => {
|
||||
const port = address.port
|
||||
session.defaultSession.once('will-download', function (e, item) {
|
||||
item.savePath = downloadFilePath
|
||||
item.on('done', function (e, state) {
|
||||
assertDownload(state, item)
|
||||
done()
|
||||
})
|
||||
})
|
||||
session.defaultSession.downloadURL(`${url}:${port}`)
|
||||
})
|
||||
|
||||
it('can download using WebContents.downloadURL', (done) => {
|
||||
const port = address.port
|
||||
w.webContents.session.once('will-download', function (e, item) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue