feat: expose setBackgroundThrottling api (#15104)

This commit is contained in:
Andy Dill 2018-10-18 17:32:22 -07:00 committed by Samuel Attard
parent 10db2bce4e
commit 37f2113032
5 changed files with 71 additions and 0 deletions

View file

@ -905,4 +905,31 @@ describe('webContents module', () => {
return expect(promise).to.be.eventually.rejectedWith(Error, 'takeHeapSnapshot failed')
})
})
describe('setBackgroundThrottling()', () => {
it('does not crash when allowing', (done) => {
w.webContents.setBackgroundThrottling(true)
done()
})
it('does not crash when disallowing', (done) => {
w.destroy()
w = new BrowserWindow({
show: false,
width: 400,
height: 400,
webPreferences: {
backgroundThrottling: true
}
})
w.webContents.setBackgroundThrottling(false)
done()
})
it('does not crash when called via BrowserWindow', (done) => {
w.setBackgroundThrottling(true)
done()
})
})
})