diff --git a/spec/api-session-spec.js b/spec/api-session-spec.js index 640cc44551d..e6f5737b33b 100644 --- a/spec/api-session-spec.js +++ b/spec/api-session-spec.js @@ -239,9 +239,10 @@ describe('session module', function () { res.end(mockPDF) downloadServer.close() }) - var assertDownload = function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename, port) { + var assertDownload = function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename, port, savePath) { assert.equal(state, 'completed') assert.equal(filename, 'mock.pdf') + assert.equal(savePath, path.join(__dirname, 'fixtures', 'mock.pdf')) assert.equal(url, 'http://127.0.0.1:' + port + '/') assert.equal(mimeType, 'application/pdf') assert.equal(receivedBytes, mockPDF.length) @@ -256,8 +257,8 @@ describe('session module', function () { var port = downloadServer.address().port ipcRenderer.sendSync('set-download-option', false, false) w.loadURL(url + ':' + port) - ipcRenderer.once('download-done', function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) { - assertDownload(event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename, port) + ipcRenderer.once('download-done', function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename, savePath) { + assertDownload(event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename, port, savePath) done() }) }) @@ -272,8 +273,8 @@ describe('session module', function () { webview.addEventListener('did-finish-load', function () { webview.downloadURL(url + ':' + port + '/') }) - ipcRenderer.once('download-done', function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) { - assertDownload(event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename, port) + ipcRenderer.once('download-done', function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename, savePath) { + assertDownload(event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename, port, savePath) document.body.removeChild(webview) done() }) diff --git a/spec/static/main.js b/spec/static/main.js index 5104a0f2525..8a432532f8e 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -142,7 +142,8 @@ app.on('ready', function () { item.getReceivedBytes(), item.getTotalBytes(), item.getContentDisposition(), - item.getFilename()) + item.getFilename(), + item.getSavePath()) }) if (needCancel) item.cancel() }