Store process type as int

This commit is contained in:
Kevin Sawicki 2017-05-26 08:53:26 -07:00
parent cabcd0ef8f
commit 1e4dd9b163
3 changed files with 12 additions and 8 deletions

View file

@ -538,15 +538,21 @@ describe('app module', function () {
it('returns memory and cpu stats of all running electron processes', function () {
const appMetrics = app.getAppMetrics()
assert.ok(appMetrics.length > 0, 'App memory info object is not > 0')
const types = []
for (const {memory, pid, type, cpu} of appMetrics) {
assert.ok(memory.workingSetSize > 0, 'working set size is not > 0')
assert.ok(memory.privateBytes > 0, 'private bytes is not > 0')
assert.ok(memory.sharedBytes > 0, 'shared bytes is not > 0')
assert.ok(pid > 0, 'pid is not > 0')
assert.ok(type.length > 0, 'process type is null')
types.push(type)
assert.equal(typeof cpu.percentCPUUsage, 'number')
assert.equal(typeof cpu.idleWakeupsPerSecond, 'number')
}
assert.ok(types.includes('GPU'))
assert.ok(types.includes('Browser'))
assert.ok(types.includes('Tab'))
})
})
})