1 const assert = require('assert')
2 const desktopCapturer = require('electron').desktopCapturer
4 const isCI = require('electron').remote.getGlobal('isCi')
6 describe('desktopCapturer', function () {
7 if (isCI && process.platform === 'win32') {
11 it('should return a non-empty array of sources', function (done) {
12 desktopCapturer.getSources({
13 types: ['window', 'screen']
14 }, function (error, sources) {
15 assert.equal(error, null)
16 assert.notEqual(sources.length, 0)
21 it('throws an error for invalid options', function (done) {
22 desktopCapturer.getSources(['window', 'screen'], function (error) {
23 assert.equal(error.message, 'Invalid options')
28 it('does not throw an error when called more than once (regression)', function (done) {
30 var callback = function (error, sources) {
32 assert.equal(error, null)
33 assert.notEqual(sources.length, 0)
34 if (callCount === 2) done()
37 desktopCapturer.getSources({types: ['window', 'screen']}, callback)
38 desktopCapturer.getSources({types: ['window', 'screen']}, callback)
41 it('responds to subsequest calls of different options', function (done) {
43 var callback = function (error, sources) {
45 assert.equal(error, null)
46 if (callCount === 2) done()
49 desktopCapturer.getSources({types: ['window']}, callback)
50 desktopCapturer.getSources({types: ['screen']}, callback)