electron/spec/api-crash-reporter-spec.coffee

34 lines
1.3 KiB
CoffeeScript
Raw Normal View History

assert = require 'assert'
path = require 'path'
http = require 'http'
remote = require 'remote'
formidable = require 'formidable'
2013-11-14 16:10:43 +00:00
BrowserWindow = remote.require 'browser-window'
2013-11-14 16:10:43 +00:00
describe 'crash-reporter module', ->
fixtures = path.resolve __dirname, 'fixtures'
2013-11-14 16:10:43 +00:00
it 'should send minidump when renderer crashes', (done) ->
w = new BrowserWindow(show: false)
server = http.createServer (req, res) ->
form = new formidable.IncomingForm()
form.parse req, (error, fields, files) ->
assert.equal fields['prod'], 'Atom-Shell'
assert.equal fields['ver'], process.versions['atom-shell']
assert.equal fields['process_type'], 'renderer'
assert.equal fields['platform'], process.platform
assert.equal fields['extra1'], 'extra1'
assert.equal fields['extra2'], 'extra2'
assert.equal fields['_productName'], 'Zombies'
assert.equal fields['_companyName'], 'Umbrella Corporation'
assert.equal fields['_version'], require('remote').require('app').getVersion()
assert files['upload_file_minidump']['name']?
w.destroy()
res.end()
server.close()
done()
server.listen 1127, '127.0.0.1', ->
2013-11-14 16:10:43 +00:00
w.loadUrl 'file://' + path.join(fixtures, 'api', 'crash.html')