Merge pull request #4675 from atom/report-error-in-enumerate-devices-spec

Always call done callback in enumerateDevices spec
This commit is contained in:
Kevin Sawicki 2016-03-04 14:42:21 -08:00
commit ee1f69062e

View file

@ -7,6 +7,8 @@ const remote = require('electron').remote;
const BrowserWindow = remote.require('electron').BrowserWindow;
const session = remote.require('electron').session;
const isCI = remote.getGlobal('isCi');
describe('chromium feature', function() {
var fixtures = path.resolve(__dirname, 'fixtures');
var listener = null;
@ -91,13 +93,19 @@ describe('chromium feature', function() {
if (process.env.TRAVIS === 'true') {
return;
}
if (isCI && process.platform === 'linux') {
return;
}
it('can return labels of enumerated devices', function(done) {
navigator.mediaDevices.enumerateDevices().then((devices) => {
const result = devices.some((device) => !!device.label);
if (result)
const labels = devices.map((device) => device.label);
const labelFound = labels.some((label) => !!label);
if (labelFound)
done();
});
else
done('No device labels found: ' + JSON.stringify(labels));
}).catch(done);
});
});