Merge pull request #9516 from electron/flaky-pid-test

Assert OS pid after load finishes
This commit is contained in:
Kevin Sawicki 2017-05-17 17:11:03 -07:00 committed by GitHub
commit 9ce3a8c3a7

View file

@ -325,13 +325,16 @@ describe('webContents module', function () {
})
describe('getOSProcessId()', function () {
it('returns a valid procress id', function () {
it('returns a valid procress id', function (done) {
assert.strictEqual(w.webContents.getOSProcessId(), 0)
w.webContents.once('did-finish-load', () => {
const pid = w.webContents.getOSProcessId()
assert.equal(typeof pid, 'number')
assert(pid > 0, `pid ${pid} is not greater than 0`)
done()
})
w.loadURL('about:blank')
const pid = w.webContents.getOSProcessId()
assert(typeof pid === 'number', 'is a number')
assert(pid > 0, 'superior to 0')
})
})