message: testing passing in device ids/index
  returning a promise instead of invoking done
diff: @@ -44,60 +44,74 @@ define(["helper/Basic", "Tone/source/UserMedia", "Test", "Tone/source/Source"],
  //long timeout to give testers time to allow the microphone
  this.timeout(100000);
  - it ("open returns a promise", function(done){
  + it ("open returns a promise", function(){
  var extIn = new UserMedia();
  var promise = extIn.open();
  expect(promise).to.be.instanceOf(Promise);
  - promise.then(function(){
  + return promise.then(function(){
  extIn.dispose();
  - done();
  });
  });
  - it ("can open an input", function(done){
  + it ("can open an input", function(){
  var extIn = new UserMedia();
  - extIn.open().then(function(){
  + return extIn.open().then(function(){
  extIn.dispose();
  - done();
  });
  });
  - it ("is 'started' after media is open and 'stopped' otherwise", function(done){
  + it ("can open an input by name", function(){
  + var extIn = new UserMedia();
  + return extIn.open("default").then(function(){
  + expect(extIn.deviceId).to.equal("default");
  + extIn.dispose();
  + });
  + });
  +
  + it ("can open an input by index", function(){
  + var extIn = new UserMedia();
  + return extIn.open(0).then(function(){
  + extIn.dispose();
  + });
  + });
  +
  + it ("throws an error if it cant find the device name", function(){
  + var extIn = new UserMedia();
  + return extIn.open("doesn't exist").catch(function(){
  + extIn.dispose();
  + })
  + });
  +
  + it ("is 'started' after media is open and 'stopped' otherwise", function(){
  var extIn = new UserMedia();
  expect(extIn.state).to.equal("stopped");
  - extIn.open().then(function(){
  + return extIn.open().then(function(){
  expect(extIn.state).to.equal("started");
  extIn.dispose();
  - done();
  });
  });
  - it ("has a label, group and device id when open", function(done){
  + it ("has a label, group and device id when open", function(){
  var extIn = new UserMedia();
  - extIn.open().then(function(){
  + return extIn.open().then(function(){
  expect(extIn.deviceId).to.be.a("string");
  expect(extIn.groupId).to.be.a("string");
  expect(extIn.label).to.be.a("string");
  extIn.dispose();
  - done();
  });
  });
  - it ("can close an input", function(done){
  + it ("can close an input", function(){
  var extIn = new UserMedia();
  - extIn.open().then(function(){
  + return extIn.open().then(function(){
  extIn.close();
  extIn.dispose();
  - done();
  });
  });
  - it ("can enumerate devices", function(done){
  - var extIn = new UserMedia();
  - extIn.enumerateDevices().then(function(devices){
  + it ("can enumerate devices", function(){
  + return UserMedia.enumerateDevices().then(function(devices){
  expect(devices).to.be.instanceOf(Array);
  - extIn.dispose();
  - done();
  });
  });
  });
  