add spec and docs

This commit is contained in:
deepak1556 2016-08-24 06:53:14 +05:30
parent ad0c86db7a
commit ae297760af
3 changed files with 42 additions and 4 deletions

View file

@ -4,7 +4,7 @@ const path = require('path')
const qs = require('querystring')
const {closeWindow} = require('./window-helpers')
const remote = require('electron').remote
const {BrowserWindow, protocol, webContents} = remote
const {BrowserWindow, ipcMain, protocol, webContents} = remote
describe('protocol module', function () {
var protocolName = 'sp'
@ -965,5 +965,18 @@ describe('protocol module', function () {
w.loadURL(origin)
})
})
it('can access files through FileSystem API', function (done) {
let filePath = path.join(__dirname, 'fixtures', 'pages', 'filesystem.html')
const handler = function (request, callback) {
callback({path: filePath})
}
protocol.registerFileProtocol(standardScheme, handler, function (error) {
if (error) return done(error)
w.loadURL(origin)
})
ipcMain.once('file-system-error', (event, err) => done(err))
ipcMain.once('file-system-write-end', () => done())
})
})
})