2013-12-06 14:23:02 +00:00
|
|
|
assert = require 'assert'
|
|
|
|
path = require 'path'
|
|
|
|
http = require 'http'
|
|
|
|
remote = require 'remote'
|
2013-11-15 02:37:22 +00:00
|
|
|
formidable = require 'formidable'
|
2013-11-14 16:10:43 +00:00
|
|
|
|
2013-12-06 14:23:02 +00:00
|
|
|
BrowserWindow = remote.require 'browser-window'
|
2013-11-14 16:10:43 +00:00
|
|
|
|
|
|
|
describe 'crash-reporter module', ->
|
2013-12-06 14:23:02 +00:00
|
|
|
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) ->
|
2013-11-15 02:37:22 +00:00
|
|
|
form = new formidable.IncomingForm()
|
|
|
|
form.parse req, (error, fields, files) ->
|
2013-11-24 14:57:47 +00:00
|
|
|
assert.equal fields['prod'], 'Atom-Shell'
|
2013-11-18 10:03:41 +00:00
|
|
|
assert.equal fields['ver'], process.versions['atom-shell']
|
2013-11-15 02:37:22 +00:00
|
|
|
assert.equal fields['process_type'], 'renderer'
|
2013-11-18 10:37:32 +00:00
|
|
|
assert.equal fields['platform'], process.platform
|
|
|
|
assert.equal fields['extra1'], 'extra1'
|
|
|
|
assert.equal fields['extra2'], 'extra2'
|
2013-11-26 02:19:50 +00:00
|
|
|
assert.equal fields['_productName'], 'Zombies'
|
|
|
|
assert.equal fields['_companyName'], 'Umbrella Corporation'
|
|
|
|
assert.equal fields['_version'], require('remote').require('app').getVersion()
|
2013-11-24 14:57:47 +00:00
|
|
|
assert files['upload_file_minidump']['name']?
|
2013-11-15 02:37:22 +00:00
|
|
|
|
|
|
|
w.destroy()
|
|
|
|
res.end()
|
|
|
|
server.close()
|
|
|
|
done()
|
2013-11-18 10:37:32 +00:00
|
|
|
server.listen 1127, '127.0.0.1', ->
|
2013-11-14 16:10:43 +00:00
|
|
|
w.loadUrl 'file://' + path.join(fixtures, 'api', 'crash.html')
|