electron/spec/api-desktop-capturer-spec.js

28 lines
849 B
JavaScript
Raw Normal View History

2016-03-25 20:03:49 +00:00
const assert = require('assert')
const desktopCapturer = require('electron').desktopCapturer
2016-01-12 02:40:23 +00:00
2016-03-25 20:03:49 +00:00
describe('desktopCapturer', function () {
it('should return a non-empty array of sources', function (done) {
2016-01-19 18:54:12 +00:00
desktopCapturer.getSources({
2016-01-12 02:40:23 +00:00
types: ['window', 'screen']
2016-03-25 20:03:49 +00:00
}, function (error, sources) {
assert.equal(error, null)
assert.notEqual(sources.length, 0)
done()
})
})
2016-01-19 18:57:18 +00:00
2016-03-25 20:03:49 +00:00
it('does not throw an error when called more than once (regression)', function (done) {
var callCount = 0
2016-01-19 19:02:12 +00:00
var callback = function (error, sources) {
2016-03-25 20:03:49 +00:00
callCount++
assert.equal(error, null)
assert.notEqual(sources.length, 0)
if (callCount === 2) done()
}
2016-01-19 18:57:18 +00:00
2016-03-25 20:03:49 +00:00
desktopCapturer.getSources({types: ['window', 'screen']}, callback)
desktopCapturer.getSources({types: ['window', 'screen']}, callback)
})
})