     describe 'areAllCaptured', ->
 
       it 'should return true if only if all browsers captured', ->
-        l.launch ['Chrome', 'ChromeCanary'], 'localhost', 1234
+        l.launch ['Fake', 'Fake'], 'localhost', 1234
 
         expect(l.areAllCaptured()).to.equal  false
 

        exitSpy = sinon.spy()

      it 'should kill all running processe', ->
        l.launch ['Chrome', 'ChromeCanary'], 'localhost', 1234
        l.kill()

        expect(mockSpawn._processes.length).to.equal 2
        expect(mockSpawn._processes[0].kill).to.have.been.called
        expect(mockSpawn._processes[1].kill).to.have.been.called


      it 'should call callback when all processes killed', ->
        l.launch ['Chrome', 'ChromeCanary'], 'localhost', 1234
        l.kill exitSpy

        expect(exitSpy).not.to.have.been.called
        mockSpawn._processes[0].emit 'close'
        expect(exitSpy).not.to.have.been.called
        mockSpawn._processes[1].emit 'close'
        expect(exitSpy).not.to.have.been.called

        # rm temp dirs
        expect(mockRimraf).to.have.been.calledTwice
        mockRimraf._callbacks[0]()
        mockRimraf._callbacks[1]()
        expect(exitSpy).to.have.been.called


      it 'should call callback even if a process had already been killed', (done) ->
        l.launch ['Chrome', 'ChromeCanary'], 'localhost', 1234, '/', 0, 1 # disable retry
        mockSpawn._processes[0].emit 'close', 1
        mockSpawn._processes[1].emit 'close', 1

        l.kill done


      it 'should call callback even if no browsers lanunched', (done) ->

# lib/launcher.js module
#==============================================================================
describe 'launcher', ->
  di = require 'di'
  events = require '../../lib/events'
  logger = require '../../lib/logger'
  launcher = require '../../lib/launcher'

  # mock out id generator
  lastGeneratedId = null
  launcher.Launcher.generateId = ->
    ++lastGeneratedId

  class FakeBrowser
    constructor: (@id, @name, baseBrowserDecorator) ->
      baseBrowserDecorator @
      FakeBrowser._instances.push @
      sinon.stub @, 'start'
      sinon.stub @, 'kill'

  class ScriptBrowser
    constructor: (@id, @name, baseBrowserDecorator) ->
      baseBrowserDecorator @
      ScriptBrowser._instances.push @
      sinon.stub @, 'start'
      sinon.stub @, 'kill'


  beforeEach ->
    lastGeneratedId = 0
    FakeBrowser._instances = []
    ScriptBrowser._instances = []

    # disable logger
    logger.setup 'OFF'
