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