Add spec for updated extra parameters
This commit is contained in:
parent
a4bbad03c2
commit
b51adf8ae5
3 changed files with 69 additions and 1 deletions
|
@ -75,7 +75,7 @@ class CrashReporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
getUploadedReports () {
|
getUploadedReports () {
|
||||||
return binding._getUploadedReports(this.getCrashesDirectory())
|
return binding.getUploadedReports(this.getCrashesDirectory())
|
||||||
}
|
}
|
||||||
|
|
||||||
getCrashesDirectory () {
|
getCrashesDirectory () {
|
||||||
|
|
|
@ -72,6 +72,26 @@ describe('crashReporter module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should send minidump with updated extra parameters', function (done) {
|
||||||
|
if (process.env.APPVEYOR === 'True') return done()
|
||||||
|
if (process.env.TRAVIS === 'true') return done()
|
||||||
|
|
||||||
|
this.timeout(10000)
|
||||||
|
|
||||||
|
startServer({
|
||||||
|
callback (port) {
|
||||||
|
const crashUrl = url.format({
|
||||||
|
protocol: 'file',
|
||||||
|
pathname: path.join(fixtures, 'api', 'crash-restart.html'),
|
||||||
|
search: '?port=' + port
|
||||||
|
})
|
||||||
|
w.loadURL(crashUrl)
|
||||||
|
},
|
||||||
|
processType: 'renderer',
|
||||||
|
done: done
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('.start(options)', function () {
|
describe('.start(options)', function () {
|
||||||
it('requires that the companyName and submitURL options be specified', function () {
|
it('requires that the companyName and submitURL options be specified', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
|
@ -155,6 +175,7 @@ const startServer = ({callback, processType, done}) => {
|
||||||
assert.equal(fields.platform, process.platform)
|
assert.equal(fields.platform, process.platform)
|
||||||
assert.equal(fields.extra1, 'extra1')
|
assert.equal(fields.extra1, 'extra1')
|
||||||
assert.equal(fields.extra2, 'extra2')
|
assert.equal(fields.extra2, 'extra2')
|
||||||
|
assert.equal(fields.extra3, undefined)
|
||||||
assert.equal(fields._productName, 'Zombies')
|
assert.equal(fields._productName, 'Zombies')
|
||||||
assert.equal(fields._companyName, 'Umbrella Corporation')
|
assert.equal(fields._companyName, 'Umbrella Corporation')
|
||||||
assert.equal(fields._version, app.getVersion())
|
assert.equal(fields._version, app.getVersion())
|
||||||
|
@ -165,6 +186,7 @@ const startServer = ({callback, processType, done}) => {
|
||||||
assert.equal(crashReporter.getLastCrashReport().id, reportId)
|
assert.equal(crashReporter.getLastCrashReport().id, reportId)
|
||||||
assert.notEqual(crashReporter.getUploadedReports().length, 0)
|
assert.notEqual(crashReporter.getUploadedReports().length, 0)
|
||||||
assert.equal(crashReporter.getUploadedReports()[0].id, reportId)
|
assert.equal(crashReporter.getUploadedReports()[0].id, reportId)
|
||||||
|
req.socket.destroy()
|
||||||
done()
|
done()
|
||||||
}, done)
|
}, done)
|
||||||
})
|
})
|
||||||
|
|
46
spec/fixtures/api/crash-restart.html
vendored
Normal file
46
spec/fixtures/api/crash-restart.html
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
|
||||||
|
const {port} = require('url').parse(window.location.href, true).query
|
||||||
|
const {crashReporter} = require('electron')
|
||||||
|
|
||||||
|
crashReporter.start({
|
||||||
|
productName: 'Zombies',
|
||||||
|
companyName: 'Umbrella Corporation',
|
||||||
|
submitURL: 'http://127.0.0.1:' + port,
|
||||||
|
uploadToServer: true,
|
||||||
|
ignoreSystemCrashHandler: true,
|
||||||
|
extra: {
|
||||||
|
'extra1': 'extra1',
|
||||||
|
'extra2':'initial',
|
||||||
|
'extra3': 'extra3'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
setImmediate(() => {
|
||||||
|
if (process.platform === 'darwin2') {
|
||||||
|
crashReporter.setExtraParameter('extra2', 'extra2')
|
||||||
|
crashReporter.setExtraParameter('extra3', null)
|
||||||
|
} else {
|
||||||
|
crashReporter.start({
|
||||||
|
productName: 'Zombies',
|
||||||
|
companyName: 'Umbrella Corporation',
|
||||||
|
submitURL: 'http://127.0.0.1:' + port,
|
||||||
|
uploadToServer: true,
|
||||||
|
ignoreSystemCrashHandler: true,
|
||||||
|
extra: {
|
||||||
|
'extra1': 'extra1',
|
||||||
|
'extra2': 'extra2'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
setImmediate(() => {
|
||||||
|
process.crash()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Reference in a new issue